Optimize code with live plots

2 views (last 30 days)
Matt
Matt on 8 Dec 2014
Edited: Matt on 8 Dec 2014
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!

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!