How to solve the 'Index exceeds number of subplots' error?
Show older comments
Hi guys, I have to solve this problem: I have this code:
for p=1:22
subplot(5,2,p)
end
It gives me the following error 'Index exceeds number of subplots', how can I solve it?
2 Comments
Iqra Jabeen
on 13 Sep 2020
how to solve 2*5 grid subplot
the cyclist
on 14 Sep 2020
Please add more detail to this question. Or, better yet, ask a brand-new question the fully explains what you want to know.
Accepted Answer
More Answers (1)
the cyclist
on 23 Jan 2018
Edited: the cyclist
on 23 Jan 2018
0 votes
The way you have defined the subplot layout, you have a 5-by-2 grid of subplots, which is a total of 10 subplot locations. But you are trying to place 22 subplots.
You need to increase the number of subplot locations (maybe use 5x5?), or decrease the number of subplots.
1 Comment
Categories
Find more on Image Arithmetic 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!