Surface plot from excel data

조회 수: 16 (최근 30일)
Sairaj Ghate
Sairaj Ghate 2020년 11월 13일
댓글: Ameer Hamza 2020년 11월 13일
Hi there,
Could anyone please help me with plotting 3d surface graph of the attached excel data.

답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 11월 13일
편집: Ameer Hamza 2020년 11월 13일
This is one way
data = readtable('load.xlsx');
month_names = data.Properties.VariableNames(2:end);
x = 1:numel(month_names);
y = data.Hour;
z = data{:, 2:end};
ax = axes();
[X, Y] = meshgrid(x, y);
surf(X, Y, z)
ax.XTick = x;
ax.XTickLabel = month_names;
ax.XTickLabelRotation = -45;
In case you need to plot lines
data = readtable('load.xlsx');
month_names = data.Properties.VariableNames(2:end);
x = 1:numel(month_names);
y = data.Hour;
z = data{:, 2:end};
ax = axes();
[X, Y] = meshgrid(x, y);
plot3(X, Y, z)
ax.XTick = x;
ax.XTickLabel = month_names;
ax.XTickLabelRotation = -45;
grid on
  댓글 수: 2
Sairaj Ghate
Sairaj Ghate 2020년 11월 13일
Thank you very much.... really apprreciate it.
Ameer Hamza
Ameer Hamza 2020년 11월 13일
I am glad to be of help!!!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by