Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Error in my matlab program regarding value of an index. Help.

조회 수: 3 (최근 30일)
Virajan Verma
Virajan Verma 2018년 10월 15일
마감: MATLAB Answer Bot 2021년 8월 20일
for i=1:9
N_matrix(1,i)=N(rem(i,3))*ex(i/3);(ERROR HERE)
end
Attempted to access ex(0.333333); index must be a positive integer or logical.
Error in practisee3 (line 9) N_matrix(1,i)=N(rem(i,3))*ex(i/3);
  댓글 수: 8
Dennis
Dennis 2018년 10월 15일
편집: Dennis 2018년 10월 15일
This actually shows that ex is not a function, but a matrix. Matrix indices need to be positive integer (1,2,3,4,5). ex(1/3) does not exist.
Kevin Chng
Kevin Chng 2018년 10월 15일
편집: Kevin Chng 2018년 10월 15일
why do you want to do i/3 for ex if it is a matrix? because 1/3 won't be 1 for your first iteration.

답변 (0개)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by