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

8 visualizaciones (últimos 30 días)
A D
A D el 9 de Jun. de 2016
Respondida: Star Strider el 9 de Jun. de 2016
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]);
"

Respuestas (1)

Star Strider
Star Strider el 9 de Jun. de 2016
That is not the correct way to set the YLim property.
Try this instead:
ax1.YLim = [-60 -20];

Categorías

Más información sobre Audio I/O and Waveform Generation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by