How do i correct this mistake in my matlab program? Please help.

조회 수: 1 (최근 30일)
Virajan Verma
Virajan Verma 2018년 10월 16일
댓글: Walter Roberson 2018년 10월 16일
ex(1)=lx/J %%first i term in ex matrix
ex(2)=mx/J %%second j term in ex matrix
ex(3)=nx/J %%third k term in ex matrix
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 practisee2 (line 225)
N_matrix(1,i)=N(rem(i,3))*ex(i / 3);
  댓글 수: 5
Virajan Verma
Virajan Verma 2018년 10월 16일
Yes. It is 2015 version. How do i eliminate the error??
Walter Roberson
Walter Roberson 2018년 10월 16일
First you explain what you intend it to mean. In one of your related posts you said that ex is a function, but it was clear that you had initialized ex as a variable.

댓글을 달려면 로그인하십시오.

답변 (1개)

madhan ravi
madhan ravi 2018년 10월 16일
편집: madhan ravi 2018년 10월 16일
ex(i / 3); Should be an integer value not a float
So try ex(i)/3
  댓글 수: 3
madhan ravi
madhan ravi 2018년 10월 16일
you have to explain what you want to do learn about indexing first
Walter Roberson
Walter Roberson 2018년 10월 16일
What is the intended meaning of ex(i/3) when i is 1 ?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by