subscript indices should be positive integer or logical, please help

1 view (last 30 days)
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 Comment
Stephen23
Stephen23 on 12 Apr 2018
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 ?

Sign in to comment.

Answers (0)

Categories

Find more on Get Started with MATLAB 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!