Trouble with subplot size

10 ビュー (過去 30 日間)
Jessica Eliason
Jessica Eliason 2017 年 1 月 11 日
コメント済み: Jessica Eliason 2017 年 1 月 12 日
I've been getting an error when I try to subplot in my function, so I tried the EXACT code found in the subplot doc as an example, and still got the same error.
The error is "Index exceeds matrix dimensions"
Or, if I'm running the debugger it says "Attempted to access subplot(2,1,1); index out of bounds because size(subplot)=[1,1,1]."
Here's the example:
x= linspace(0,10)
y1=sin(x)
y2=sin(5*x)
figure
subplot(2,1,1);
plot (x,y1)
subplot(2,1,2);
plot (x,y2)

採用された回答

Adam
Adam 2017 年 1 月 11 日
編集済み: Adam 2017 年 1 月 11 日
What is the result of
which subplot
?
This is an error you would get if you have a variable of the same name as the function. Certainly if Matlab sees subplot as a function it would not be giving errors about its size - that clearly relates to a variable instead.
  1 件のコメント
Jessica Eliason
Jessica Eliason 2017 年 1 月 12 日
Thank you!! I found the variable

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by