Aradhya - everytime you call plot3 you are creating a new plot (graphics) object and the previous one is deleted. Perhaps that is why you are not seeing all of the data being plotted (if I understand your question correctly). Rather than using a loop to plot the data, just do it all at once
plot3( x_accel(1:999), y_accel(1:999), z_accel(1:999))
Else if you want to plot each point (with perhaps a pause between each one), then you will want to create one plot object and update that on each iteration of your loop
hPlot = plot3(x_accel(1), y_accel(1), z_accel(1));
for k = 2:1000-1
pause(0.5);
xdata = [get(hPlot, 'XData') ; x_accel(k)];
ydata = [get(hPlot, 'YData') ; y_accel(k)];
zdata = [get(hPlot, 'ZData') ; z_accel(k)];
set(hPlot, 'XData', xdata, 'YData', ydata, 'ZData', zdata);
end
I haven't tested the above, but it should work something like that.
2 Comments
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/499499-how-can-i-get-3d-continuous-plot-of-real-time-data#comment_784265
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/499499-how-can-i-get-3d-continuous-plot-of-real-time-data#comment_784265
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/499499-how-can-i-get-3d-continuous-plot-of-real-time-data#comment_784641
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/499499-how-can-i-get-3d-continuous-plot-of-real-time-data#comment_784641
Sign in to comment.