sodiumnitrate
sodiumnitrate

Reputation: 3143

trisurf doesn't work in my MATLAB GUI code

I am trying to write a code that plots a convex hull of some points that I generated with convhulln. I have the triangle data (n by 3 matrix), and the Cartesian coordinates of the points (m by 3). Normally, when I'm not dealing with the GUI, I can just do the following, and have no problems:

a=rand(20,3);
t=convhulln(a);
trisurf(t,a(:,1),a(:,2),a(:,3));

This works just fine. But when I try to do the same thing within the code of the GUI, it does not work. Here's what I have:

tt=convhulln(cluster);
trisurf(handles.trisurf_area,tt,cluster(:,1),cluster(:,2),cluster(:,3));

trisurf_area is the tag of the plot area.

I should also note that the following code works perfectly fine:

scatter3(handles.trisurf_area,cluster(:,1),cluster(:,2),cluster(:,3));

I use MATLAB 2012a.

Upvotes: 0

Views: 227

Answers (1)

Torsten Schönfeld
Torsten Schönfeld

Reputation: 108

Try trisurf(tt,a(:,1),a(:,2),a(:,3),'Parent',handles.trisurf_area).

Upvotes: 0

Related Questions