Please I need help, i am running a code but i am receiving an error message: Attempted to access Px(1.18059); index must be positive integer or logical
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
Please I need help, i am running a code but i am receiving an error message: Attempted to access Px(1.18059); index must be positive integer or logical
1 件のコメント
B.k Sumedha
2015 年 6 月 3 日
Post that part of the code.So that the error be identified in a more easier way.
回答 (2 件)
B.k Sumedha
2015 年 6 月 3 日
編集済み: B.k Sumedha
2015 年 6 月 3 日
0 投票
Its a floating point error down at the 5th significant figure. If you simply round "Px", it'll MAY work
6 件のコメント
Guillaume
2015 年 6 月 3 日
"It'll work" in the sense that it will make the error go away. Whether or not it will make the code produce the correct result is unknown due to the limited information supplied.
The correct solution is to find out why the OP is getting a floating point index in the first place. Note that the error is at the 1st decimal figure, not the 5th.
B.k Sumedha
2015 年 6 月 3 日
Where is the code to find out why the OP is getting a floating point index in the first place.. If u have the code u can post it.I will check it :)
Guillaume
2015 年 6 月 3 日
Oh, I totally agree that the OP has not provided sufficient information to answer the question. But saying "it'll work" is a bit of a stretch.
B.k Sumedha
2015 年 6 月 3 日
Ok fine updated.It MAY work ;)
olawoyin abiodun
2015 年 6 月 4 日
編集済み: Walter Roberson
2015 年 6 月 4 日
Walter Roberson
2015 年 6 月 4 日
Px(var_ab _ var_ae) is not valid syntax. Possibly you meant
Px(var_ab - var_ae)
If so then you would be attempting to subtract the two variables and use the result to index the array "Px".
Possibly you intended multiplication,
Rx = log2((1 + Px*(var_ab - var_ae)+(1 +var_ae*Pw +Pb*var_be.^2+ 2*sqrt(Pb*Px*var_ab*var_ae))));
Image Analyst
2015 年 6 月 4 日
0 投票
I think the FAQ explains the general cause of this error pretty well: http://matlab.wikia.com/wiki/FAQ#How_do_I_fix_the_error_.22Subscript_indices_must_either_be_real_positive_integers_or_logicals..22.3F
0 件のコメント
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!