Array indices must be positive integers or logical values

Hello All,
I am trying to rearrange the elements in a matrix based on index values using matrix indexing.
I have tried multiple times, checked each and every element in the matrix - every element is positive and >0 and <1504 (length of matrix). I wonder why I still get this error
Kindly, help me with this.
Please find the attachments for the required matrices and data. The following is the command I used:
Output = input_sequence(IntOutAdr);

 채택된 답변

"every element is positive and >0"
Nope:
S = load('data_req.mat')
S = struct with fields:
IntOutAdr: [1×1504 double] input_sequence: [1×1504 double]
find(S.IntOutAdr==0)
ans = 1481

댓글 수: 1

I tried this and got a zero, thank you for pointing it out

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

추가 답변 (1개)

David Fletcher
David Fletcher 2021년 5월 10일

1 개 추천

Error is caused by element 1481 of IntOutAdr which is 0 - this will cause an indexing error

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

2021년 5월 10일

댓글:

2021년 5월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by