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

2 次查看(过去 30 天)
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 个评论
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 个评论

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by