Creating and managing subplots App Designer Matlab

17 vues (au cours des 30 derniers jours)
Iacopo
Iacopo le 9 Mai 2022
Hi all,
I'm writing an app in App Designer that displays 3 subplots for each tab within a panel as the results of some calculation from a matrix in columns. The tabs and subplots are generated in a for cycle and the number of tabs depends on the columns of the initial matrix.
I wrote the following syntax for the plot:
app.axis1(i) = axes(app.Plotpanel.Children.Children(i),"Position",[0.1300 0.8420 0.7750 0.105]);
plot(app.axis1(i),time,value(1:length(time),shift_3d+1),'g');
hold(app.axis1(i));
app.axis2(i) = axes(app.Plotpanel.Children.Children(i),"Position",[0.1300 0.8420 0.7750 0.105]);
plot(app.axis2(i),time,value(1:length(time),shift_3d+2),'b');
hold(app.axis2(i));
app.axis3(i) = axes(app.Plotpanel.Children.Children(i),"Position",[0.1300 0.8420 0.7750 0.105]);
plot(app.axis3(i),time,value(1:length(time),shift_3d+3),'r');
hold(app.axis3(i));
The app works but I need to sort out few things:
1)) I get the following warning msg from Matlab:
Specify the axes handle
How can I sort this? I believe I introducted the axes handle at the beginning of every plot above.
I suspect this can create some errors in the following passages when I try to resize the figures manually
2)) Furthermore, at the beginning of the app execution, Matlab displays the following msgs:
Current plot held
Current plot held
Current plot held
For each subplot created even though I have places a semicolo after each hold.
3)) And finally, Matlab shows at the beginning of the execution the following warning:
Warning: 'SizeChangedFcn' callback will not execute while 'AutoResizeChildren' is set to 'on'.
> In APP/createComponents (line 753)
In APP (line 883)
Warning: 'SizeChangedFcn' callback will not execute while 'AutoResizeChildren' is set to 'on'.
> In APP/createComponents (line 806)
In APP (line 883)
Warning: 'SizeChangedFcn' callback will not execute while 'AutoResizeChildren' is set to 'on'.
> In APP/createComponents (line 819)
In APP (line 883)
Warning: 'SizeChangedFcn' callback will not execute while 'AutoResizeChildren' is set to 'on'.
> In APP/createComponents (line 833)
In APP (line 883)
Thanks everyone who will be able to help me!

Réponse acceptée

Kevin Holly
Kevin Holly le 10 Mai 2022
1. Do you know what line in the code generates this error?
2. If you do not want the message, "Current plot held" to be displayed. Specify that you want the hold to be on, hold(app.axis1(i),"on"). Note, if you use the same command, "hold(app.axis1(i))", a sceond time you would get the message, "Current plot released", which would be the same as hold(app.axis1(i),"off").
app.axis1(i) = axes(app.Plotpanel.Children.Children(i),"Position",[0.1300 0.8420 0.7750 0.105]);
plot(app.axis1(i),time,value(1:length(time),shift_3d+1),'g');
hold(app.axis1(i),"on");
app.axis2(i) = axes(app.Plotpanel.Children.Children(i),"Position",[0.1300 0.8420 0.7750 0.105]);
plot(app.axis2(i),time,value(1:length(time),shift_3d+2),'b');
hold(app.axis2(i),"on");
app.axis3(i) = axes(app.Plotpanel.Children.Children(i),"Position",[0.1300 0.8420 0.7750 0.105]);
plot(app.axis3(i),time,value(1:length(time),shift_3d+3),'r');
hold(app.axis3(i),"on");
3. See Answer here

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by