How to use scrollable subplots in a tabbed panel? (function scrollsubplot)

14 vues (au cours des 30 derniers jours)
I want to display all my calculation results in one figure window with tabbed panels.
As I would like to show multiple subplots in one tab, I started using the FileExchange function "scrollsubplot" (https://de.mathworks.com/matlabcentral/fileexchange/7730-scrollsubplot) , which seems to work fine for using subplots in an figure without tabs, but when trying to run it inside a tab panel, an error occurs.
Here is the code I use for creating simple standard subplots in a tabbed panel (which works fine, but is highly unconfortable for many subplots):
f = figure();
tab1 = uitab();
ax1 = axes('Parent', tab1);
x= linspace(-1, 1, 20);
y=x;
subplot(2,2,1);
plot(x, y);
And here ist the Code which uses the function "scrollsubplot" and displays an error:
f = figure();
tab1 = uitab();
ax1 = axes('Parent', tab1);
x= linspace(-1, 1, 20);
y=x;
scrollsubplot(2,2,1); %The only change
plot(x, y);
The Error says:
" Error using / Matrix dimensions must agree.
Error in scrollsubplot (line 247) 'sliderstep',[1/nrows 1]/(1/((nrows)/max(1,1+maxrownr(:)-minrownr(:)-nrows)))) " .
I appreciate every help and am thankful for every clue!

Réponse acceptée

Bob Blaine
Bob Blaine le 21 Juil 2017
Hi Sven,
I was able to get this to work by making a small change to your code:
f = figure();
tab1 = uitab();
x= linspace(-1, 1, 20);
y=x;
ax = scrollsubplot(2,2,1);
ax.Parent = tab1;
plot(x,y)
I'm not familiar with scroll subplot, but it looks like it wants to create its own axes, which you can then parent to the tab.

Plus de réponses (0)

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by