How to copy all cell array row to other cell row
18 views (last 30 days)
Show older comments
How to copy all cell array row to other cell row?
Because I can only copy one rows one cell at a time.
A = [1 2;3 4;5 6; 7 8; 9 10; 11 12];
Y = {};
Acell = [];
for Nr = 1:6
Acell{Nr} = A(Nr, :);
end
B = nchoosek(Acell,2)
C = B{1,:};
Y{1,1}=B{1,1}
Y{1,2}=B{1,2}
Y{2,1}=B{2}
0 Comments
Accepted Answer
DGM
on 22 Nov 2021
Edited: DGM
on 22 Nov 2021
Something like this
A = [1 2;3 4;5 6; 7 8; 9 10; 11 12];
Acell = num2cell(A,2); % don't need the loop
B = nchoosek(Acell,2);
%C = B{1,:}; % idk what this is for
Y = cell(5,2); % or whatever size
Y(1,:) = B(1,:); % no curly braces here
Y(2,:) = B(2,:)
% ... and so on
0 Comments
More Answers (0)
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!