[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to convert mesh data in octave to Gnuplot data file
From: |
pauljoseph |
Subject: |
Re: How to convert mesh data in octave to Gnuplot data file |
Date: |
Wed, 17 Sep 2008 21:41:29 -0700 (PDT) |
Marc Normandin wrote:
>
> Does something like
>
> [x,y] = meshgrid (1:size(z,1), 1:size(z,2))
>
> do what you want?
>
>
Hi Marc,
I tried using meshgrid, but I still need to "reshape" the matrix, but then
when I write to file, I need some breaklines. I didn't how to do it but
manually.
This is what I have done.
z=[0,0,0;0,1,0;0,0,0];
x=[1,2,3];
y=[1,2,3];
[XX,YY]=meshgrid(x,y);
gpX=reshape(XX,9,1);
gpY=reshape(YY,9,1);
gpZ=reshape(z,9,1);
[gpX,gpY,gpZ]=
1 1 0
1 2 0
1 3 0
2 1 0
2 2 1
2 3 0
3 1 0
3 2 0
3 3 0
dlmwrite('test.dat',[gpX,gpY,gpZ],'\t');
So ya, this is almost what I want, but when I write to text file, I need
break lines among the blocks, the desired output in the text file should be
1 1 0
1 2 0
1 3 0
2 1 0
2 2 1
2 3 0
3 1 0
3 2 0
3 3 0
--
View this message in context:
http://www.nabble.com/How-to-convert-mesh-data-in-octave-to-Gnuplot-data-file-tp19545393p19545814.html
Sent from the Octave - General mailing list archive at Nabble.com.