Making cell array out of two same length vectors
1 回表示 (過去 30 日間)
古いコメントを表示
Hi all, I am trying to make cell array out of two same length vectors, i.e. I have two vectors each is 1066 element and I want to join every element in vector1 with it’s comparative element in vector2 so that to make a cell array made of 1066 equal size vectors each of two elements. Please help
0 件のコメント
採用された回答
Stephan M. H.
2013 年 5 月 15 日
編集済み: Stephan M. H.
2013 年 5 月 15 日
Hi Mohammed,
if you have the two vectors x1 and x2 (each of size 1x1066) you can merge them frist to a matrix:
X = [x1;x2]
and then transform it into a cell array
C = mat2cell(X,2,ones(1,1066))
This will give you an cell-array of size 1x1066, where each cell j contains the pair X(:,j).
best,
Stephan
その他の回答 (1 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!