subscript indices should be positive integer or logical, please help
1 次查看(过去 30 天)
显示 更早的评论
Am trying to create some voting space for the synthetic model and i end up with "subscript indices must be either positive integers or logicals" Here's the similar code with less dimensions, for ex-
a = [-1.32 -2.56 -3.8;-4.2 -5.7 -6.23;-7.02 -8.4 -9.59];
rows =3;
columns =3;
w=ones(rows,columns);
vy = zeros(3,3);
for i =1:rows
for j=1:columns
low_v=floor(a(i,j));
high_v=ceil(a(i,j));
vy(i,a(i,j)-1)=vy(i,a(i,j)-1) + w(i,j);
end
end
I understand that each index is having a negative values(which i mentioned intentionally) instead of a positive integer, but my goal is to get results for the negative values. Could someone help me out with the possible modification that i could the desired results Thank you so much in advance
Regards Vignesh
1 个评论
Stephen23
2018-4-12
Given that a contains fractional values, what do you expect
vy(i,a(i,j)-1)
to be? Where is this located in the matrix vy ?
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!