Need helping creating a countour map of grid data points.

I am trying to create a contour map of a grid systems of data points measured. My text file that is loaded in is of a grid of point 5x5x7. My code is as follows:
clear all clc
IGRF=52241.5; load labdata.txt;
x=labdata(:,1); y=labdata(:,2); z=labdata(:,3)-IGRF;
xinterp = linspace(0,95,500); yinterp = linspace(0,63,500); [X1, Y1] = meshgrid(xinterp, yinterp);
Z1 = griddata(x,y,z,X1,Y1,'cubic');
figure(1); set(gca,'YDir','normal');
[C,h] = contourf(xinterp,yinterp,Z1,10); hold on;
plot(x,y,'ko'); plot(10,20,'rx'); plot(90,42,'b*'); plot(95, 42,'b*'); plot(90,40,'b*'); hold off;
colorbar;
xlabel('Distance (m)'); ylabel('Distance (m)');
axis equal
When I run the program I get this error:
Warning: The underlying triangulation is empty - the points may be collinear. > In griddata>cubic at 251 In griddata at 129 In lastlab at 19 Error using .* Matrix dimensions must agree.
Error in linspace (line 31) y = d1 + (0:n1).*(d2 - d1)/n1;
Error in contourf>parseargs (line 441) levs = linspace(zmin, zmax, args{nargs} + 2);
Error in contourf (line 64) [pvpairs, ~, msg] = parseargs(args);
Error in lastlab (line 24) [C,h] = contourf(xinterp,yinterp,Z1,10);
I am not sure what this means and I do not have lines 441 or 64. Why is my code not working and I am getting errors from lines that do not even exist in my code??
Thanks for the help! I am stuckkk!!!!!

Answers (0)

Asked:

on 19 Apr 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!