For loop returns vector with different sizes, how to put them in a single matrix?

조회 수: 1 (최근 30일)
I have a for loop which returns a vector after each iteraion, but the vector length is different each time. How to store the results in a matrix or table or whatever , so that I can use the values for other operations.
for k = 1:length(sect)
SS(k,:) = find(TS{:,2}<sect(k+1) & TS{:,2}>=sect(k) );
k+1;
end
  댓글 수: 4
Walter Roberson
Walter Roberson 2019년 7월 7일
SS{k} = find(....)
By the way you should consider using histc or histcounts or discretize to determine the bin numbers.

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

채택된 답변

Pratyush Das
Pratyush Das 2019년 8월 25일
SS{k} = find(....)
Thank you Walter Roberson for the answer. It creates a cell array.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by