Optimize code with live plots
2 views (last 30 days)
Show older comments
Hello everyone,
I am trying to optimize my code in order to reduce the time it takes to compute. Basically my script is running within a WHILE loop, and inside this loop are multiple calculations and plots being made. However, I would like to know how can I simplify this following code for example:
axes(handles.axes9);
scatter(xmatrix, ymatrix, [], pressure);
colorbar;
hold on;
set(handles.axes9, 'XTick', [], 'YTick', [], 'color', 'k', 'box', 'off');
axis equal;
plot(xmatrix(position), ymatrix(position), 'or', 'MarkerFaceColor', 'w', 'MarkerSize', 8, 'LineWidth', 2);
hold off;
It does what I want it to do, but everytime the whole scatter plot is being redrawn. How can I isolate it outside my WHILE loop but still update the same axes with the PLOT function shown above? The "position" variable is also calculated inside the loop if that can help.
Cheers!
0 Comments
Answers (0)
See Also
Categories
Find more on Subplots 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!