필터 지우기
필터 지우기

Transposing cells

조회 수: 33 (최근 30일)
Syed Abbas
Syed Abbas 2012년 1월 19일
hi, how can I transpose each cell in a cell array?

채택된 답변

the cyclist
the cyclist 2012년 1월 19일
Do you mean that each cell in the cell array contains a matrix, and you want to transpose each matrix? If so, then you need the cellfun command:
% Fill the cell array
a{1} = [1 2; 3 4];
a{2} = [5 6; 7 8];
% Display the cell array before the transpose
a{:}
% Do the transpose
a = cellfun(@transpose,a,'UniformOutput',false);
% Display the results
a{:}
  댓글 수: 1
Syed Abbas
Syed Abbas 2012년 1월 19일
Great! Thanks

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

추가 답변 (1개)

Jan
Jan 2012년 1월 19일
Or by a loop:
a{1} = [1 2; 3 4];
a{2} = [5 6; 7 8];
for i = 1:numel(a)
a{i} = transpose(a{i});
end
  댓글 수: 1
Syed Abbas
Syed Abbas 2012년 1월 19일
Thanks!

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by