필터 지우기
필터 지우기

Simple question about for loop

조회 수: 3 (최근 30일)
주희 박
주희 박 2022년 5월 11일
편집: Matt J 2022년 5월 11일
Hi I have cell data that consist of different row size like below picture. Let's assume this name of this cell is A.
And I want to make simple for loop
B= zeros(length(A), ???);
for i = 1: length(A)
b= function{i};
B(i,:)=b;
end
Each row has different size.
I wonder what should i write in ???.

채택된 답변

Matt J
Matt J 2022년 5월 11일
편집: Matt J 2022년 5월 11일
There is no way to know from the code you've shown. You've shown us the dimensions of A{i}, but not of b. In any case, you might consider using cellfun instead,
B=cell2mat( cellfun(@(z) reshape(func(z),[],1), A,'uni',0) )

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by