Why this error message? Subscript indices must either be real positive integers or logicals.
Info
This question is closed. Reopen it to edit or answer.
Show older comments
Why do i get this error message
Subscript indices must either be real positive integers or logicals.
for i = 1:numel(matrix_a)
handles.index_a = matrix_a(i)
handles.index_b = matrix_b(i)
for somthin
[u v] = function(var_u(handles.index_a, handles.index_b)var_v(handles.index_a, handles.index_b))
end
end
pls help
Answers (1)
the cyclist
on 25 Aug 2014
0 votes
Just a guess, but ...
You are using handles.index_a and handles.index_b as indices into var_u and var_v. Because handles.index_a traces back to matrix_a, I am guessing that matrix_a (or b) has some entries that are not positive integers, and therefore cannot be used as an index.
4 Comments
Image Analyst
on 25 Aug 2014
I think that's it. Also Antonio, if this is actual code, not pseudocode, you need a comma before var_v and you can't name functions "function" since that's a reserved word.
Antonio
on 25 Aug 2014
Antonio
on 25 Aug 2014
the cyclist
on 25 Aug 2014
There is a conceptual error in your code, that I don't think we can fix for you. If the first column of matrix_a has a zero, then it cannot be an index. The code simply needs to be rewritten such that you really only access the indices you want.
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!