How can I do contour plot from set of data from .xlsx?

1 view (last 30 days)
I get this code from this website http://linuxrajib.blogspot.com/2012/04/2d-contour-plot-in-matlab.html but I don't know how to do with it. I want to do contour plot like this in my .xlsx file. (.xlsx file in the attachment)
clear all;
close all;
L1 = load('dataset1.dat');
N1=6;
N2=220;
k = 1;
for i = 1 : 1 : N1
for j = 1 : 1: N2
k = (i - 1) * N2 + j;
X1(j,i) = L1(k, 1);
Y1(j,i) = L1(k, 2);
Z1(j,i) = L1(k, 3);
end
end
contourf(X1, Y1, Z1);
lighting gouraud
xlim([0.0 0.6])
ylim([0.04 0.09])
set(gca, 'xtick', 0.0:0.1:0.6,'Fontsize', 15)
set(gca, 'ytick', 0.04:0.01:0.09,'Fontsize', 15)
xlabel('xlabel text','Fontsize', 20);
ylabel('ylabel text','FontSize', 20);

Answers (1)

Jacob Mathew
Jacob Mathew on 3 Jan 2025
Hey Nanthanon,
You can refer to the following documentation to understand how to load spreadsheets into MATLAB:
Once you have the required data from the spreadsheet, refer to the following documentation to create contour plots:

Categories

Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!