Transposing cells

32 次查看(过去 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 个)

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

类别

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