help-octave
[Top][All Lists]
Advanced

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

Re: Scripting question


From: Thorsten Meyer
Subject: Re: Scripting question
Date: Fri, 26 Mar 2004 09:26:36 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113

Hi,

you can write

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

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

Thorsten



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





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