help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: reading strings


From: Ben Sapp
Subject: Re: reading strings
Date: Mon, 11 Jun 2001 11:20:41 -0600

Phil Reardon wrote:
> 
> >From within a script, I want to read in some labels from a file and place
> them on a graph.  Then I can modify the file but leave the script untouched
> from run to run.  However, I can't seem to do that.  Here is some code that
> fails:
> 
> label1 = fscanf(fp0,"%s","C");
> gset label label1 at .8,.2
> 
> Can you help me find the correct syntax for what I want to do?
> Thanks for any help you can provide. PCR

Does label1 hold the correct value?   Since I don't see any thing
obviously wrong with the fscanf statement I am going to assume that
label1 is a string variable holding the correct label.  Then your code
would look something like this:

label1 = fscanf(fp0,"%s","C");
cmd = fprintf("gset label %s at .8,.2",label1);
eval(cmd)

You could also do something very similar with the graw command. 
However, I prefer the above method.  Octave does not interpret variables
on a line starting with gset.  If it did it would try to interpret the
"label" and "at" which would most likely lead to an error.  

-- 
Ben Sapp                         Los Alamos National Laboratory
email: <mailto:address@hidden>   Phone: (505)667-3277
Fax:   (505)665-7920             URL:   http://www.neutrino.lanl.gov/
--



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]