Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Getting the error:Subscript indices must either be real positive integers or logicals.

1 回表示 (過去 30 日間)
NMK
NMK 2017 年 2 月 6 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi I am trying to run:
theq=thetav(min(abs(c-dcv))); but it gives me this error: Subscript indices must either be real positive integers or logicals.
I even tried to to do something like:
A=abs(c-dcv); theq=thetav(min(A));
it still says the same.
c is a 1x1 double and dcv is a 100x1 double.
Would appreciate any advice on fixing this.
Thanks,
  1 件のコメント
Stephen23
Stephen23 2017 年 2 月 6 日
Please tell us exactly what this command displays:
min(abs(c-dcv))

回答 (1 件)

dbmn
dbmn 2017 年 2 月 6 日
The problem is, that you try to access the 4.275th (or smth) element of thetav. You can only access Elements 1 to infinity (indexing).
This wont work:
theq=thetav(4.75);
but this will:
theq=thetav(4);
You should try to reference by indices. For example with
theq=thetav(A==min(A));

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by