Trying add chunk of data to a array

답변 (1개)

Steve Eddins
Steve Eddins 2020년 11월 4일

1 개 추천

As I understand the code, the fact that ls is empty after the loop implies that either:
  • The while loop body never executes
  • The if body never executes; or
  • z is empty in the assignment ls = [ls z];
You haven't shown us how the values of x or i or Nfft get set, so we can only make educated guesses about the specific cause.
I suggest that you single-step through the code using the debugger. At each line, check the values of the key variables and make sure that each one contains what you think it should.

댓글 수: 5

AJ Woodson
AJ Woodson 2020년 11월 4일
Thank you so much for reaching out hope your doing well in this case x is a arrary = Columns 1 through 19 12 3 43 2 2 3 4 1 88 888 666 444 22 56 7 4 2 0 9 Columns 20 through 30 8 5 2 4 7 8 9 0 7 5 3, i = 1, win = 30
AJ Woodson
AJ Woodson 2020년 11월 4일
I think I know now why this might not work array is 30 and win 30 so no deal
Steve Eddins
Steve Eddins 2020년 11월 4일
Yep. The if-body never executes because i+win <= length(x) is never true.
AJ Woodson
AJ Woodson 2020년 11월 4일
So I just ran this with win 2 Nfft =3 now runs but it taking forever same x
AJ Woodson
AJ Woodson 2020년 11월 4일
Nvm sorry figured it out

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

카테고리

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

제품

릴리스

R2018a

질문:

2020년 11월 4일

편집:

2020년 11월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by