How to draw a 3D graph in app designer?

3 views (last 30 days)
Tong Jin
Tong Jin on 9 Jun 2021
Commented: Tong Jin on 9 Jun 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 Comment
Tong Jin
Tong Jin on 9 Jun 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!!

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!