Error using 'YLim' for NEGATIVE Values (in plot\gca\YLim)

8 ビュー (過去 30 日間)
A D
A D 2016 年 6 月 9 日
回答済み: Star Strider 2016 年 6 月 9 日
Hello,
Please assist in getting below issue resolved.
We intend to define NEGATIVE values in Ylim parameter in gca for plotting purpose.
Sincerely,
A
*> A. TASK:*
1. Plot NEGATIVE VALUES ranging from -50 to -30. (-50 : -30)
2. In plotted figure, Demonstrate Y-Axis range from (-60 : -10)
*> B. ERROR:*
When YLim is used, following error is received:
"
Subscript indices must either be real positive integers or logicals.
Error in YTickIssue (line 11)
ax1.YLim([-60 -20]); "
*> C. CODE:*
"
x = [1:1:5];
y = [-36,-32,-46,-35,-37];
plot(x,y);
ax1 = gca;
ax1.YLim([-60 -20]);
"

回答 (1 件)

Star Strider
Star Strider 2016 年 6 月 9 日
That is not the correct way to set the YLim property.
Try this instead:
ax1.YLim = [-60 -20];

カテゴリ

Help Center および File ExchangeAudio I/O and Waveform Generation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by