How to convert multiple cell array matrix having different sizes (having different variable names) to single matrix with their variable names individually ?
2 ビュー (過去 30 日間)
古いコメントを表示
Find the attachment of the image having the multiple cell arrays ? I need to convert those multiple cell array to matrix of the same size in a single matrix
Thanks
0 件のコメント
回答 (1 件)
Walter Roberson
2016 年 1 月 5 日
You only have a single variable in what you show. If you want to create a single array from it then
Bmat = cell2mat( cellfun(@int32, B, 'Uniform', 0) );
The cellfun() layer is to convert everything to the same datatype
2 件のコメント
Walter Roberson
2016 年 9 月 4 日
You only have a single variable in what you show. It cannot be converted to a single matrix because the number of rows varies from column to column. If you want to put all of the entries in a column together into one entry then you can use
newB = arrayfun(@(idx) vertcat(B{:,idx}), 1:size(B,2), 'Uniform', 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!