필터 지우기
필터 지우기

Unable to perform assignment because the indices on the left side are not compatible with the size of the right side

조회 수: 1 (최근 30일)
I have a window frame B and B is an array of 1x(length(frame)). I have a signal that is divided into 10 segments that is as long as length(frame) with 50% overlap 'hop' that is hop = length(frame)/2. The segment is saved in an array 'Fil' of size length(frame) x 19. I want to take the fft of every segment with a window applied to it.It is all done in a for loop with k = 20 and FFT is a newly created array in the loop. I used this line of code but it give me the error in the title.
for n = 1:k -1
FFT(:,n) = fft(B'.*Fil(:,n));
end

채택된 답변

Walter Roberson
Walter Roberson 2023년 10월 22일
Give the command window command
dbstop if error
Run the code. When it stops, query
n
size(B.')
size(Fil(:,n))
size(fft(B'.*Fil(:,n)))
whos FFT
and tell us the results
  댓글 수: 2
Louis du Pisani
Louis du Pisani 2023년 10월 23일
Thank you.
FFT still had the dimensions of the previous execution of the code and that is why the indices did not match for the new signal.
I want to post my results, but I had to use 'assignin' to get the variable into my workspace since I am coding in Matlab App Designer.
Walter Roberson
Walter Roberson 2023년 10월 23일
You should be using functions... then you would not have to worry about the possibility of left-over arrays of incompatible size in local variables.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Signal Processing Toolbox에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by