Consider I have a cell array containing 4 cells
Each cell containd 'n' elements
Now I want to covert it into an array of size "n*4" where element of each row is take from elements of each cell
If it has tto be more clear for eg: ist row of the matrix contains 4 elements - each element is picked from 1st element of each cell.
I have used the model
for i = 1:numel(W{1})
wid(i,:)=double(cellfun(@(v) v(i),W));
end
But it is taking more time in matlab.So, is there any best and simple solution for this problem which can be simulated in less time?
2 Comments
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/496324-converting-a-cell-array-into-a-matrix-of-stipulated-number-of-columns-and-rows#comment_777417
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/496324-converting-a-cell-array-into-a-matrix-of-stipulated-number-of-columns-and-rows#comment_777417
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/496324-converting-a-cell-array-into-a-matrix-of-stipulated-number-of-columns-and-rows#comment_777418
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/496324-converting-a-cell-array-into-a-matrix-of-stipulated-number-of-columns-and-rows#comment_777418
Sign in to comment.