comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Declaring large vectors in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Declaring large vectors in IDL [message #70480 is a reply to message #70472] Sat, 17 April 2010 07:22 Go to previous messageGo to previous message
Gray is currently offline  Gray
Messages: 253
Registered: February 2010
Senior Member
On Apr 17, 4:02 am, fgg <fabioguimaraesgoncal...@gmail.com> wrote:
> On Apr 16, 6:35 pm, pp <pp.pente...@gmail.com> wrote:
>
>
>
>
>
>> On Apr 16, 10:17 pm, fgg <fabioguimaraesgoncal...@gmail.com> wrote:
>
>>> ... and I'd like to add it to the variables view. When I type @'path/
>>> batchfilename.pro' at the IDL prompt, I get the following message: "%
>>> Program code area full". Any suggestions?
>
>> Do not write large literals, like that one. You just demonstrated one
>> of the several reasons not to do it. Put those numbers into a file,
>> then read it into the variable.
>
>> There are many ways to read those values from a file, depending on how
>> you write them into the file. If all you do is strip the "a = [" and
>> the "]" from the ends of that file, you could read it as
>
>> nl=file_lines('file.txt')
>> a=strarr(nl)
>> openr,unit,'file.txt',/get_lun
>> readf,unit,a
>> free_lun,unit
>> a=strjoin(a)
>> a=strsplit(a,',',/extract)
>> a=fix(a)
>
>> There are much simpler ways to read it, if the file is written a
>> little differently.
>
> Thanks for the suggestion. But what if the text file has more than one
> variable in it? Say "a" and "b".

Then you can use the same kind of thing I already showed you - read in
the lines of the file as a strarr, then use where, stregex, and
value_locate to pick out the lines with '=' in them and associate each
line with an equals sign, then concatenate the lines using strjoin,
then use strsplit to turn the long string into an array.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Comparison operators and floating-point errors
Next Topic: Re: Virtual machine popup

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 23:33:54 PDT 2025

Total time taken to generate the page: 1.03857 seconds