Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable problems

Status
Not open for further replies.

gaaasa

Programmer
Feb 21, 2003
6
BE
Hello,

My problem

I want to plot a data file that is selected by the user in gnuplot. I can open a channel to gnuplot, and I can plot a specified data file BUT when the user selects a file with an file open menu, the path and file name are stored in a variable and there is my problem.

When I do something like this it will work!!!

set F1 [open "|gnuplot" r+]
puts $F1 {plot "/users/myaccount/data.dat"}
flush $F1

now the part that doesn't work. If for instance we have a variable path

set path "/users/myaccount/data.dat"
set F1 [open "|gnuplot" r+]
puts $F1 {plot $path}
flush $F1

THIS WON'T WORK IF SOMEONE COULD HELP ME I WOULD BE VERY HAPPY

I tried everything with "" without {} it all doesn't mather
 
Have you tried eval?
ex:
eval puts $F1 {plot $path}
 
Hello thanks for your post, but I tried it before and it doesn't work.
 
Thank you very much evryone for your dedicated help. ;O)
But I have found a solution.

put everything in one variable like this and it will work.

set CMD {plot "/users/myaccount/data.dat"}
put $channel $CMD
 
Thank you very much evryone for your dedicated help. ;O)
But I have found a solution.

put everything in one variable like this and it will work.

set CMD {plot "/users/myaccount/data.dat"}
put $channel $CMD

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top