Z must be a matrix, not scalar or vector - surface plot

1 回表示 (過去 30 日間)
Sclay748
Sclay748 2020 年 10 月 28 日
コメント済み: Sclay748 2020 年 10 月 28 日
Hello,
Attached is a screenshot of my code and a table I recreated in excel. Just pretend it is in MATLAB. Unfortunaltly, because this is for work, I cannot share actual screenshots, so I made a simplified mock up to show you.
'bs' is the variable name I call from.
The table is a 1x4 structure with 4 fields. I converted the data to a table as this fixed my issue last time, but now I get the error 'Z must be a matrix, not scalar or vector' again.
I appreciate any help/advice. Thanks!

採用された回答

Abdolkarim Mohammadi
Abdolkarim Mohammadi 2020 年 10 月 28 日
You use surf when you have z value for each combination of x and y vectors. Here, you have x, y, and z vectors, so you should draw a 3D scatter plot using scatter3() function.
scatter3 (tbl.temp, tbl.humid, tbl.k);

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by