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

Home » Public Forums » archive » Calling vectors in readcol from a string array?
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: Calling vectors in readcol from a string array? [message #85126 is a reply to message #85125] Mon, 08 July 2013 14:24 Go to previous messageGo to previous message
pslough93 is currently offline  pslough93
Messages: 2
Registered: July 2013
Junior Member
On Monday, July 8, 2013 3:51:22 PM UTC-5, wlandsman wrote:
> On Monday, July 8, 2013 12:37:17 PM UTC-4, pslo...@gmail.com wrote:
>
>
>
>>
>
>> I have tried using the execute command (i.e. execute('readcol,' + spreadsheets[I] + ',' + vectorname1[I] + ',' ...) but IDL returns an error when it encounters the additional quotes in the format keyword.
>
>>
>
> I'm not sure I completely understand the question but here's a try.
>
>
>
> Use double quotes for the format keyword so it won't be confused with the single quotes used for EXECUTE().
>
>
>
> While you should be able to use EXECUTE(), it might be better to use SCOPE_VARFETCH() to create a new variable given its string name. The little program below prompts the user to create a variable name, and then assigns the output of READCOL into that named variable.
>
>
>
> pro test
>
>
>
> ;Ask user to supply a variable name
>
> vectorname = ''
>
> read,'Enter Vector name: ',vectorname
>
>
>
> ; Use READCOL to read into a temporary variable
>
> readcol,'test.dat',temp
>
>
>
> ;Assign temporary variable to user-supplied variable name
>
> (scope_varfetch(vectorname,/enter)) = temporary(temp)
>
>
>
> return
>
> end

Thanks for alerting me to the double quotes thing. Using execute now works as intended.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Widget_Table set_value interrupts editing. Solution needed.
Next Topic: "OPENW: Error opening file. Unit: (...) Too many links" - What does this mean? (Possible I/O problem)

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

Current Time: Sat Oct 11 10:17:30 PDT 2025

Total time taken to generate the page: 1.12204 seconds