Info
This question is closed. Reopen it to edit or answer.
Why this error message? Subscript indices must either be real positive integers or logicals.
2 views (last 30 days)
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
2 Comments
Ben11
on 25 Aug 2014
well it looks like the "somthin" you use in the 2nd loop is not made up of real positive integers or logicals. Can you show what it is?
Answers (1)
the cyclist
on 25 Aug 2014
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
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.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!