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
Ali Al raeesi
Ali Al raeesi 2021년 3월 26일
@KSSV but all input are real and positve and not fractions
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에서 Large Files and Big Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by