Let’s say you have x, y points describing a surface and z as color data for all those points and want to plot those in Matlab. You need to create a mesh grid for making grids to assign color data.

B = dlmread ('test.dat','','A1..F251001' ); % reads data from a dat file and B1 is the cell id like excel
xx=B(:,1);
yy=B(:,2);
ee=B(:,4);

x = -25.0:.1:25;
y = -25.0:.1:25;
[X,Y] = meshgrid(x, y);
enew=[];
count = 1;
for i=1:501
  for j=1:501
    enew(j,i)=ee(count);
    j=j+1;
    count = count +1;
  end
  i=i+1;
end
contourf(X,Y,enew)

Output figure,

meep

Last modified: 2017-12-31