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

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by