help-octave
[Top][All Lists]
Advanced

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

How doyou vectorize pulling values out of a matrix?


From: Robert A. Macy
Subject: How doyou vectorize pulling values out of a matrix?
Date: Mon, 24 Jul 2006 15:47:38 -0700

Assume there is mymatrix [500,500] and I wish to retrieve
100 certain values from there.

The specific indices are stored in two vectors Xindex and
Yindex that are each [1,100]

this for loop works...
>> for i=1:100
>> output(i)=mymatrix(Xindex(i),Yindex(i));
>> endfor

but this didn't...
>> output(1,:)=mymatrix(Xindex(1,:),Yindex(1,:));
everything matches, what's wrong?  

how do you vectorize this operation?  

shouldn't matter but running octave 2.1.50a on Win98

              - Robert -


reply via email to

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