subscript indices should be positive integer or logical, please help

조회 수: 2 (최근 30일)
vigneshwaran Loganathan
vigneshwaran Loganathan 2018년 4월 12일
댓글: Stephen23 2018년 4월 12일
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
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개)

카테고리

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