필터 지우기
필터 지우기

how to solve error Index exceeds matrix dimensions. The array locs is empty and therefore has no valid indices.

조회 수: 7 (최근 30일)
hello everyone, I have an array of frequency domain fft on simulink of [11x501] and I want to enter into the matlab function block containing the findpeaks code but then the error appears above, what should I do if maybe I need to change the leading zeros to another number? But it can't be a constant or monotonous number, is it possible that someone should know how to duplicate another array to fill in the leading zero?
I have tried to delete it but then an error appeared, namely unable to delete element in this array because this array has fixed size.
is there someone who can provide help? thank you for your attention

답변 (1개)

Walter Roberson
Walter Roberson 2021년 1월 7일
u(1,:) = -u(2,:)
unless the second row is 0.
If the second row is 0 then you need to scan down the column to determine whether there is any non-zero. If not then set the first row to 1 to force it to be a peak.
But really since you are looping the findpeaks just test to see whether the findpeaks is empty and if so arbitrarily designate one of the positions as a peak.
  댓글 수: 11
Walter Roberson
Walter Roberson 2021년 1월 9일
... You would not be continuing to have this problem if you had followed my advice,
" just test to see whether the findpeaks is empty and if so arbitrarily designate one of the positions as a peak."
Naufal Arfani
Naufal Arfani 2021년 1월 10일
I'm sorry if I'm still an amateur in Matlab and Simulink, but can you give me more explanation about the two suggestions that you gave above? I seemed quite catchy but couldn't figure out how @Walter Roberson

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

카테고리

Help CenterFile Exchange에서 Array and Matrix Mathematics에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by