How to create a two columns cell array from two different cells?
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi all,
I've got two 781x1 cells.
for k=1:1:781
Time3{k}=(k);
Ratt1{k}=(Ratt);
end
The second one contains 781 vectors of different lengths made of different combinations of numbers from 1 to 24.
The vectors Ratt are generated by a function.
I'd like to join them into a 781x2 cell array so I could read numbers from 1 to 781 in the first column and all the vectors in the second one, like this:
1 [1, 2, 5, 7, 8]
2 [3, 11, 15]
.........
Is it possible?
Thanks
댓글 수: 0
채택된 답변
madhan ravi
2020년 7월 8일
편집: madhan ravi
2020년 7월 8일
k = 1 : numel(vectors);
Wanted = [num2cell(k(:)), num2cell(vectors(:), 2)]
댓글 수: 3
madhan ravi
2020년 7월 9일
[Time3, Ratt1] = deal(cell(781,1));
for k=1:781
Time3{k} = k;
Ratt1{k} = Ratt;
end
Wanted = [Time3, Ratt1]
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!