round function fails when used in subscript index
古いコメントを表示
i'm puzzled. the following code runs without a problem:
x=[1 2 3]
x(round(end/2))
but this:
x=3;
y=round(x/2);
x=[1 2 3]
x(round(end/2)
gives the following error: "error using round. Not enough input arguments."
so round fails only if had has been called before here. anyone who can explain this?
3 件のコメント
David Sanchez
2013 年 7 月 24 日
Here is what I get:
>> x=[1 2 3]
x(round(end/2))
x=3;
y=round(x/2);
x=[1 2 3]
x(round(end/2))
x =
1 2 3
ans =
2
x =
1 2 3
ans =
2
no error displayed. Are you sure you are doing it all right?
Peter
2013 年 7 月 24 日
dpb
2013 年 7 月 24 日
...so round fails only if had has been called before here
Doesn't really imply that's the root cause...what if the test case doesn't use end but another constant or other expression?
Since R2011b has been superceded, ir can reproduce the above, go ahead and submit a bug report to official TMW support but likely they'll tell you to upgrade.
Oh--and see if there are any patches available to you for your license.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!