help-octave
[Top][All Lists]
Advanced

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

Re: Constructing arrays


From: Martin Helm
Subject: Re: Constructing arrays
Date: Mon, 26 Jul 2010 13:44:18 +0200
User-agent: KMail/1.12.4 (Linux/2.6.31.12-0.2-desktop; KDE/4.3.5; x86_64; ; )

Am Montag, 26. Juli 2010 13:15:41 schrieb dirac:
> Hi again,
> 
> Probably another really simple problem: I have a vector that I want to plot
> values from given the indecies of the particular data I need. The indecies
> are stored in another column vector. Is there a function that will do this
> in Octave?
> 
> Many thanks
> Martin
> 
> -----
> Pretty much convinced Octave>Excel for scientific data analysis!
> 
You can index one vector with the indexes stored in another that way

octave:1> a = 10:20;
octave:2> b = [3 7 4];
octave:3> a(b)
ans =

   12   16   13

So assuming the vector with the indexes is b and the vector with the values is 
a you would simply

plot(a(b))

- mh


reply via email to

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