Error in nexttile after adding colorbar for whole tiledlayout
1 view (last 30 days)
Show older comments
I'm encountering this error on Matlab R2020b:
f = figure;
t = tiledlayout(f, 'flow');
nexttile %adding any two plots
plot(1:100)
nexttile
plot(1:100)
cb = colorbar; %adding colorbar
cb.Layout.Tile = 'East' %following the documentation on how to add colorbar for entire tiledlayout
So far, everthing works great. The colorbar belongs to the second axes but it is on the right side of the entire tiledlayout and it looks how it is supposed to. But when I now try to alter the first axes with
nexttile(1)
I get this error message
"Operands to the || and && operators must be convertible to logical scalar values.
Error in nexttile"
Does anyone have a clue what's going on there?
0 Comments
Answers (1)
Srivardhan Gadila
on 28 Nov 2020
You can try storing the axes when you create a new tile and use the stored axes later as follows:
f = figure;
t = tiledlayout(f, 'flow');
ax1 = nexttile %adding any two plots
plot(1:50)
ax2 = nexttile
plot(1:100)
cb = colorbar;
cb.Layout.Tile = 'East';
% you can make use of the stored axes ax1 and ax2
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!