cell to double with reduced array size
5 ビュー (過去 30 日間)
古いコメントを表示
Hi I want to convert cell array to double. I am using cell2mat but again I am getting matrix of 34490x20. I want 34490x2 double. otherwise there is no purpose to use cell2mat. please help me in this regard. thnx
0 件のコメント
回答 (1 件)
Star Strider
2014 年 11 月 24 日
編集済み: Star Strider
2014 年 11 月 24 日
You can do it without cell2mat. If you want to get specific columns, use one of these assignment options to get your (34490x2) double array:
C = {randi(10,30,20)}; % Create Data (Cell Array)
D = C{:}(:,1:2); % Get Columns 1 & 2 As Double Array
D = C{:}(:,[10 15]); % Alternative: Get Any 2 Columns (Here 10 & 15)
Alternatively, if you have more than one array in your cell:
C = {randi(10,30,20) randi(10,30,20)}; % Create Data (Cell Array)
D = C{1}(:,1:2); % Get Colimns 1 & 2 Of Array 1 As Double Array
D = C{2}(:,[10 15]); % Alternative: Get Any 2 Columns Of Array 2
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!