[scilab-Users] map from a data file
harishankar ramachandran
hsr at ee.iitm.ac.in
Wed Jun 11 10:14:38 CEST 2008
Use the "matrix" command:
// to convert gnuplot's splot data file format into a matrix
A=read("matrix-data.txt",-1,3); // or use fscanfMat
m=max(A(:,1)); // number of rows
n=max(A(:,2)); // number of cols
M=matrix(A(:,3),m,n); // Takes a matrix and reshapes it into
// another matrix with the same number of elements, columnwise.
// So if your data is entered row-wise, I guess you have to transpose
// the result
plot3d(1:m,1:n,M);
where the data file I used was:
1 1 0
1 2 1
1 3 2
2 1 1
2 2 2
2 3 3
3 1 2
3 2 3
3 3 4
Regards
hari ramachandran
On Tuesday 10 June 2008 16:25, Maso Ricci wrote:
> Hi all,
>
> I have a question: I have some data having the following structure
>
> 1 1 <value>
> 1 2 <value>
> 1 3 <value>
> 2 1 <value>
> 2 2 <value>
> 2 3 <value>
> 3 1 <value>
> .
> .
> .
> .
>
> well I would like to plot them like a map using the first two columns as
> X and Y respectively and the third one as Z value.
> Of course it would be great if the Z value could determines the colour
> of the point in the map
>
> thanks for the hints
--
Dr. Hari Ramachandran, Professor, 332B ESB, EE Dept, IIT-Madras
Interests: Nonlinear Optics, Nonlinear Waves, Plasma Physics, Particle
Simulations, Computational Algorithms, Linux.
Off: 91-44-2257-4421 Fax: 91-44-2257-0120
Res: 91-44-2663-1863 Home Email: omkarbharathi at gmail.com
More information about the users
mailing list