From: Max on

Jérôme wrote:
> Hi,
>
> here is a small example :
>
> M=[0:5; (1:5)' rand(5)]
>
> [X,Y]=meshgrid(M(2:end,1),M(1,2:end));
>
> surf(X,Y,M(2:end,2:end))
>
> Jérôme

Thanks, I understand it a little better now. However, I'm running into
errors such as:

Mismatch between file and format string.

I've had education in C++, and by looking at a code I was given, it's
hard to say why.

Here's the code given to me:

clear all;close all;home; %Initialize workspace
cd('c:\matlab\');

data = dlmread('FBG1-13A.dat',',');
[i q] = size(data); %get the size of data
n=1;
while n <= 14
data( (n*i)+1:1:(n*i)+i,1) = 0; %Build zero matrix
data( (n*i)+1:1:(n*i)+i,1) = data(1:1:i,1); %copy time axis
column1
data( (n*i)+1:1:(n*i)+i,2) = data(1:1:i,(2*n)); %copy pos axis
column 2n
data( (n*i)+1:1:(n*i)+i,3) = data(1:1:i,(2*n)+1);%copy temp
n=n+1;
end

pi = linspace(34,98,100); %Region of support for positioning
ti = linspace(0,14.5,100); %Region of support for time

[XI,YI] = meshgrid(ti,pi); %Two dimensional mesh, rectangular
ZI = griddata(data(:,1),data(:,2),data(:,3),XI,YI); %Fit into
topological surface
surf(XI,YI,ZI) %Graph surface
axis tight
xlabel('Time (hr)');
ylabel('Position (ft)');
zlabel('Temperature (F)');

From: J?r?me on
Could you post a small example for the ascii file ?

J?r?me
From: Max on

Jérôme wrote:
> Could you post a small example for the ascii file ?
>
> Jérôme
Sure thing.

0 97.03478 98.52174
2.343608 97.03478 98.52174
2.343886 96.98782 98.70956
2.344163 96.98782 98.6313
2.344441 96.94087 98.85043
2.344719 97.05044 98.6

The first column is the time in seconds.
Second-third (14 total) column is 13 data sets with hundreds of rows of
data.

From: spok on
oups, sorry, I left a little bit early last friday ! ;o)
and I think I wrote that quick and I made a little mistake.. :o)

from your ex., that we'd called it data ;o) and let say that the first
column is your x, and the first row your y (stop me if it is not)

type:

[x y] = meshgrid(data(1,2:end),data(2:end,1));
z = data(2:end,2:end);
surf(x,y,z)

should do the work properly.