Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


dpb
Posts:
8,867
Registered:
6/7/07


Re: Converting z data to matrix
Posted:
Jan 26, 2013 10:51 AM


On 1/26/2013 9:32 AM, Ian wrote: ... > ... If I have x,y, and z data as follows: > > X= 1 2 3 4 5 > y= 1 2 3 4 5 > z= 8 4 9 7 3 > > Is there any way of making z into the matrix from the above: > > Z= 0 0 0 0 3 > 0 0 0 7 0 > 0 0 9 0 0 > 0 4 0 0 0 8 0 0 0 0 ...
>> z= [8 4 9 7 3]; >> Z=fliplr(diag(z,0)) Z = 0 0 0 0 8 0 0 0 4 0 0 0 9 0 0 0 7 0 0 0 3 0 0 0 0 >>




