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 #85125 is a reply to message #85124] Mon, 08 July 2013 13:51 Go to previous messageGo to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
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
[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: Fri Oct 10 14:57:45 PDT 2025

Total time taken to generate the page: 1.04197 seconds