Creating subplots in a for cycle with App Designer
Mostrar comentarios más antiguos
Hi all,
I’m trying to create subplots within a Panel with a for cycle in App Designer.
I was able to implement my first 3 subplots in a single panel in the following way:
app.subplot1(3,1,1,'Parent',app.Plotpanel);
plot(app.subplot1,t,a(:,1),’g’]);
hold(app.subplot1);
app.subplot2(3,1,2,'Parent',app.Plotpanel);
plot(app.subplot2,t,a(:,2),’b’]);
hold(app.subplot2);
app.subplot3(3,1,3,'Parent',app.Plotpanel);
plot(app.subplot3,t,a(:,3),’r’]);
hold(app.subplot3);
I have defined my subplots at the beginning of the app in the following way:
properties (Access = public)
subplot1 matlab.ui.control.UIAxes % Description
subplot2 matlab.ui.control.UIAxes % Description
subplot3 matlab.ui.control.UIAxes % Description
Supposing that my matrix a to plot is actually is bigger than 3 columns and I want to plot, at any cycle, columns 1,2,3 and then 4,5,6 and then 7,8,9 etc etc..
How can I implement that in App Designer? If I write this:
figure(n3) %n3 is the index that moves the columns of a in a for cycle
app.subplot1(3,1,1,'Parent',app.Plotpanel);
plot(app.subplot1,t,a(:,1),’g’]);
hold(app.subplot1);
I get this message: Unable to use a value of type matlab.ui.container.Panel as an index.
I would like that every set of 3 columns of the data are plotted as subplots in the same panel, maybe adding a sort of scrolling tab, is this possibile?
I hold Matlab R2022a. Thanks to everyone who will be able to help me.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Subplots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!