MATLAB: Transposing cells

cell arraytranspose

hi, how can I transpose each cell in a cell array?

Best Answer

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{:}