MATLAB: How to make a scaled image of this data

datadelimitedexcelimagescMATLABplotsurf

I have data in this excel sheet which I'd like to make into a scaled image plot. I have imported it as a matrix and am calling the specific columns as variables. I've tried a bunch of different things and keep getting weird results, I think my main problem is in the data formatting. I have three columns which have been generated by a labview program I've written. x position, y position, and current.
I am taking a scan of a beam of simulated sunlight with a reference silicon cell and would like to plot the current against the x and y coordinate to get a map of the power distribution. I keep getting errors like 'z must be a matrix, not a vector or scalar' or that my matrix dimensions do not match. I've tried using meshgrid and imagesc. I know this must be a basic thing to plot but I'm not very good with Matlab, thank you for any help. I've attached the delimited spreadsheet generated by labview as a .txt file.

Best Answer

Your data are actually gridded, so all you need to do is to reshape the three columns. Then you can use contour, contourf, mesh and surf. I use surfc here:
D = load('test2.txt');
Xmtx = reshape(D(:,1), 32, []);
Ymtx = reshape(D(:,2), 32, []);
Zmtx = reshape(D(:,3), 32, []);
figure(1)
surfc(Xmtx, Ymtx, Zmtx)
grid on
That should do what you want.