MATLAB: Cell2mat of specific coulmns cell to mat I have a cell called A, with 6*1 cell, each cell has 8*3 doubles. How I create matrix B with 6*8 size which each column of B includes 3rd column of each cell of A? Best Answer A=arrayfun(@(x) randi(10,8,3),1:6,'un',0) % ----Example------B=cell2mat(cellfun(@(x) x(:,3),A,'un',0)) Related SolutionsMATLAB: Transposing cells 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 arraya{1} = [1 2; 3 4];a{2} = [5 6; 7 8];% Display the cell array before the transposea{:}% Do the transposea = cellfun(@transpose,a,'UniformOutput',false);% Display the resultsa{:} MATLAB: Converting a cell array to a matrix a={rand(1877958,7); rand(1251972,7)};n=max(cellfun(@(x) size(x,1),a));b=cell2mat(cellfun(@(x) [x ;zeros(n-size(x,1),7)],a,'un',0)) Related QuestionTaking a certain column from each cell with different sizeConvert an 18×1 cell array in a 3×6 cell arrayHow to transpose a cell arrayPrelocation of array entriesHow to convert a cell to matrix
Best Answer