help-octave
[Top][All Lists]
Advanced

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

Help filling a matrix


From: Mark P. Esplin
Subject: Help filling a matrix
Date: Tue, 11 May 2004 10:12:34 -0400
User-agent: KMail/1.5.4

        I have the data that will make a gray scale image in three separate 1-D 
arrays, x, y, z.  The value of the i'th pixel is z(i) with the x and y 
corrdinates in x(i), and y(i).   The following does what I want, but is there 
a way of doing it without a loop? 

n = length(x);
z2d = zeros(n,n);
for i=1:n
        z2d(x(i),y(i)) = z(i);
endfor

                 -Mark Esplin



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