For demo purposes, I've made a little class that streams live data from some other software I programmed via TCP and I'd like to plot the incoming data as a 3D mesh or surface. The code looks something like this:
c = MyClient( 'localhost', 5555 );
ButtonHandle = uicontrol('Style', 'PushButton', ...
'String', 'Stop loop', ...
fprintf( 'Loop stopped by user\n' );
[ret,m] = c.read();
if( ret == true )
surf( m );
pause( .05 );
I would like the value range to be constant, so I inserted zlim. This works fine, basically. Now when I add a colorbar, everything seems to become really slow. I'm not sure how the plotting works internally, but I thought maybe it's not meant to be used this way. My hypothesis is that the plot is created from scratch each loop. If that's true, is there a way of reusing the mesh and just update the values? If not, how would I do something like that in MATLAB?
I guess my overall question is what is a recommended way of plotting live data? I also noticed that when 3D rotating the plot, it jumps back to initial perspective all the time, so ideally I would like to have a mesh I can just update with new values. Is that even possible?