MATLAB: Trisurf handles related…..

animationfacefeasetsurfacetrisurf

Hi all
I have an issue with trisurf..I have a huge data from FEA. I want to make animation at the end. As the elements are triangular, I am using trisurf for animation. I want to use handles of trisurf for animation. My code is as follows:
h.fig = figure('Color','w') ;
h.ax = handle(axes) ;
h.surf = handle( trisurf(nodes,x,y,z)) ; %// create surface object
% set the data
set(h.surf,'Faces',nodes, 'XData',x , 'YData',x , 'ZData',z, 'Edgecolor','none')
set( h.ax,'XLim',xLim,'YLim',yLim,'ZLim',zLim )
But MATLAB hangs with the above lines. How to get the surface object with trisurf?
Thanks in advance.
Srinivas

Best Answer

When you use the handle() form, you should usually not use set() or get() and should instead access properties with dot notation. For now leave out the handle() calls:
h.fig = figure('Color','w') ;
h.ax = axes('Parent', h.fig) ;
h.surf = trisurf(nodes,x,y,z, 'Parent', h.ax) ; %// create surface object

% set the data
set(h.surf,'Faces',nodes, 'XData',x , 'YData',x , 'ZData',z, 'Edgecolor','none')
set( h.ax,'XLim',xLim,'YLim',yLim,'ZLim',zLim )
Also those set calls are not needed:
h.fig = figure('Color','w') ;
h.ax = axes('Parent', h.fig) ;
h.surf = trisurf(nodes,x,y,z, 'Parent', h.ax, 'EdgeColor', 'none') ; %// create surface object