How to save a multiple plots data with labels, title, legends and then plot again on uiaxes?
Show older comments

a = 0:0.01:2*pi;
b = sin(a);
c = cos(a);
P1 = plot(app.UIAxes,a,b,'DisplayName','Sin Wave');
xlabel('Time1');
ylabel('Range1');
title('Sin Wave Plot')
P2 = plot(app.UIAxes,a,c,'DisplayName','Cos Wave');
xlabel('Time2');
ylabel('Range2');
title('Cos Wave Plot')
i am running above code in "startup" function, this first draw sinwave and then draw cos wave plot on uiaxes.. now i want to plot P1 of sin wave again on uiaxes with same labels, title and legends . in other words i want to toggle between sin and cos plot through a previous and next button... there are some ways to manually copy axes and children but it is not convinient if i have dozen of plots with multiple legends and data in each plot. Kindly guide any precise way.
there a copyuiaxes function available on fileexchange which may give some desired functionality but i want to do this through in default matlab.
Accepted Answer
More Answers (0)
Categories
Find more on Graphics Object Properties 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!