subscript indices should be positive integer or logical, please help
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Stephen23
el 12 de Abr. de 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 ?
Respuestas (0)
Ver también
Categorías
Más información sobre Get Started with MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!