Continuously update MATLAB surf plot and animate it
Show older comments
I have the following loop that plots and re-plots data in MATLAB using thesurf() function. How do I get the plot to update while the values are changing and how do I animate it?
s = 1;
timerID = tic;
while true
if(toc(timerID) > 25)
break;
end
for i=1: 5
removeChannel(session, 7)
addAnalogInputChannel(session,'cDAQ1Mod8',['ai' num2str(i+15)],'Voltage');
for j=1: 5
measurements(6-j,6-i) = abs(session.inputSingleScan) - abs(base);
end
end
surf(interp2(flipud(abs(measurements)),4));
view(0, 90);
colorbar;
pause(0.05)
s = s+1;
end
Accepted Answer
More Answers (0)
Categories
Find more on Animation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!