Assign multiple values to a cell
18 ビュー (過去 30 日間)
古いコメントを表示
Riccardo Tronconi
2021 年 10 月 6 日
編集済み: Riccardo Tronconi
2021 年 10 月 6 日
I'm trying to assign three value stored in 2 different array to a single cell.
P=[1;2];
XY=[2,5; 4 ,6];
C represent my cell. The desired output is:
C{1,1}= [1,2,5];
C{2,1}= [2,4,6];
Is there a way to do that?
0 件のコメント
採用された回答
Chetan Bhavsar
2021 年 10 月 6 日
編集済み: Chetan Bhavsar
2021 年 10 月 6 日
@Riccardo Tronconi Here you Go !
P=[1;2];
XY=[2,5; 4 ,6];
C= [P(:,:) XY(:,:)]
%OR
C=arrayfun(@(x) [P(x,:) XY(x,:)],P,'UniformOutput',false)
Please Click on "Accept this answer" If its fullfilled your Requirement.
C =
2×1 cell array
{[1 2 5]}
{[2 4 6]}
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!