Subscript indices must either be real positive integers or logicals.
Show older comments
I have problem running this loop. The error is : Subscript indices must either be real positive integers or logicals.. Please, if you can help, please do! I just start learning matlab loops!
for i=1:length(xy_pairs)
x=xy_pairs(i,1);
y=xy_pairs(i,2);
count=phsp_array(x,y);
phsp_array=count+1;
end
Answers (2)
Image Analyst
on 11 Oct 2015
1 vote
x and y are probably zero, negative integers, or not positive integers. See the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_fix_the_error_.22Subscript_indices_must_either_be_real_positive_integers_or_logicals..22.3F
sunil sharma
on 16 Mar 2017
0 votes
c7=4.*g3(y).*sin(ld)./((2.*(ld.^4).*g1+k0.*re.*ph./l+(v0.*f1.*ph.*(ld.^2)./(h.*h0)))); % cn=4*g3*sin(ld)./(ld.^4)*(2+k0*re) pre=st.*bt.*c7;
I am getting the following results. Subscript indices must either be real positive integers or logicals.
Error in Magneticfield (line 33) c7=4.*g3(y).*sin(ld)./((2.*(ld.^4).*g1+k0.*re.*ph./l+(v0.*f1.*ph.*(ld.^2)./(h.*h0))));
Please help me.
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!