I have a problem while i'm trying to plot some data // Error using matlab.graphics.axis.Axes/set
68 ビュー (過去 30 日間)
古いコメントを表示
Error using matlab.graphics.axis.Axes/se
Value must be a 1x2 vector of numeric type in which the second element is larger than the first and may be Inf
This is the message that appears in the command window
0 件のコメント
回答 (2 件)
Walter Roberson
2018 年 5 月 5 日
You would get that if you tried to set() the axes XLim or YLim for a regular numeric plot, but you had a problem with the values you passed.
When you set() XLim or YLim, you need to pass a vector of exactly two elements. Both elements must be numeric -- you cannot set the XLim for a numeric plot to be datetime() values for example. Neither element may be nan. The second element must be strictly greater than (not equal to) the first. It is acceptable for the first element to be -inf and it is acceptable for the second element to be +inf.
For example, using [9 3] or [9 9] would not be accepted because the second element is not strictly greater than the first.
2 件のコメント
Bachtiar Muhammad Lubis
2019 年 2 月 6 日
@walter roberson : i have passed handle.axes1 object. and then i got error same as him. what would i do to solve then sir ? while i passed handle.object from my another program ito xlim() t worked properly.
Walter Roberson
2019 年 2 月 6 日
At the time you do the set(), what is the XLim or YLim that you are trying to set, and what is the datatypes of the xdata and ydata of what you graphed ?
You could get this problem with one axes but not another if the two axes were different kinds of axes. For example if one axes was a datetime axes then it would be fine to set datetime xlim for it, but it would not be acceptable to set datetime xlim for a numeric axes.
Akash kumar
2021 年 3 月 22 日
編集済み: Akash kumar
2021 年 3 月 22 日
Dear Luis Salas,
These Problem occur:-- if you do not properly assgin the axis like :-- axis([50 8 50 85]);-- Gives the error:- because 1'st element value is less than the second element value (in x axis part), similarly for y axis.
Proper assginment of the aforementioned example is:-axis([50 80 50 85]);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!