![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/913869/image.jpeg)
How to Create a Surface Plot from Table Data Imported from Excel
35 ビュー (過去 30 日間)
古いコメントを表示
I am trying to create a surface plot for the excel table shown in the image below using the "surf" function. TetherK and TetherC are my inputs. Power is my output (the white cells). I can't seem to get the surf fucntion to work. I imported the data and have a table in MATLAB for TetherK, TetherC, and my Output (shown below). What do I need to do so that I can make a surface plot from tables in MATLAB?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/913834/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/913839/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/913844/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/913849/image.png)
0 件のコメント
採用された回答
Scott MacKenzie
2022 年 3 月 3 日
編集済み: Scott MacKenzie
2022 年 3 月 3 日
Given some test data (attached) similar to yours...
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/913869/image.jpeg)
... a surface plot can be created thus...
M = readmatrix('testdata.xlsx');
[X,Y] = meshgrid(M(1,2:end),M(2:end,1));
Z = M(2:end,2:end);
surf(X,Y,Z);
The test data are random values. Hopefully, your plot will look more interesting.
その他の回答 (1 件)
Walter Roberson
2022 年 3 月 3 日
x = PlotTestS1.TetherK;
y = PlotTestS2.TetherCn
z = table2array(PlotTestS3) ;
surf(x, y, z, 'edgecolor', 'none')
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!