help-octave
[Top][All Lists]
Advanced

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

Re: Scripting question


From: John B. Thoo
Subject: Re: Scripting question
Date: Fri, 26 Mar 2004 06:55:30 -0800

Thorsten---

On Mar 26, 2004, at 12:26 AM, Thorsten Meyer wrote:

you can write

for i=1:nframes
   plot(x,beul(i+1,:));
end

Ooh ... this one _animates_ the solution in gnuplot.  Neat.


or even shorter:
 plot(x,beul(2:nframes,:))

And this one plots all the frames as if with 'hold on'.

I like both of your suggestions---thanks!---so I'm going to save them; however, I'm still looking for a way to plot a particular frame with something like

   plotframe (3)

say, to plot only frame 3.

Cheers.
---John.


John B. Thoo wrote:

Hi.  I'm sorry if this is a faq.  I tried to RTFM, but to no avail.

I have an array of data in a file, beul.dat, that I would like to plot. Typing the following, e.g.,

octave:54> plot (beul (1,:), beul (2,:))
octave:55> plot (beul (1,:), beul (3,:))

etc., works to give different plots. But each one's a lot to type. So, I thought I would simplify life by writing a "for" loop:

octave:56> nframes = 10;
octave:57> x = beul (1,:);
octave:58> for i = 1:nframes
> plotframe (i) = eval (sprintf ("plot (x, %s);", beul (i+1,:)));
> endfor

in the hope that I could simply type "plotframe (1)", "plotframe (2)", etc., to get the different plots. HOWEVER, I get the following errors:

error: octave_base_value::string_value(): wrong type argument `matrix'
error: evaluating argument list element number 1
error: evaluating assignment expression near line 59, column 15
error: evaluating for command near line 58, column 1
octave:58>

I only guessed at the syntax to use in the "for" loop based on the recent threads on plotting, but, to be honest, I have absolutely no idea what I'm doing. Any suggestions?

TIA.
---John.



-------------------------------------------------------------
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]