How to draw a 3D graph in app designer?

2 vues (au cours des 30 derniers jours)
Tong Jin
Tong Jin le 9 Juin 2021
Commenté : Tong Jin le 9 Juin 2021
Hello, guys! Could someone please answer my question about 3D-plot. In App designer I have a table. And then I would like to draw a 3D-Plot by surf(X,Y,Z,C). X is column named X(mm), Y is column named Y(mm), Z is column Z(mm) and color is column ED+. I have already converted the datatype from table to matrix by table2array. But I got the error :'' Z must be a matrix, not a scalar or a vector''. Then I checked the Tipps of surf: ''Z must have at least two rows and two columns''. But in my table Z is a Xx1 Matrix. How can I exchange Z to fulfill this condition. Thanks a lot!
  1 commentaire
Tong Jin
Tong Jin le 9 Juin 2021
Hello, guys! Fortunately I have solved this question! I converted matrix Z und ED+ by 'repmat' to repeat copies of array: https://de.mathworks.com/help/matlab/ref/repmat.html
Before convert X,Y,Z are (m,1) matric
Expanding Z and ED+ to (m,m) matrix. It means, repeating the column of Z and ED+ for m times.
Finally 3D Plot worked!!!!
I hope it's helpful, if someone face the same question!!

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by