why i get Array indices must be positive integers or logical values.

1 次查看(过去 30 天)
can you help me in this code i did everthing and how can i solve it .
i get Array indices must be positive integers or logical values.
plz help
Array indices must be positive integers or logical values.
Error in Untitled (line 98)
z(length(R),length(R)-1) = -R(length(R)-1) ; %This is the last mesh = element [n*n-1]
  7 个评论
the cyclist
the cyclist 2021-3-26
编辑:the cyclist 2021-3-26
Again, @Ali Al raeesi, I ask that you provide specific inputs that create the error, so that we do not have to guess. For example, what would the user type when asked for the input for R?

请先登录,再进行评论。

采纳的回答

the cyclist
the cyclist 2021-3-26
编辑:the cyclist 2021-3-26
In this line
z(length(R),length(R)-1) = -R(length(R)-1)
if the user enters a resistance vector that is length 1, then you try to access R(0), which will give that error.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by