cell to double with reduced array size
2 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Star Strider
on 24 Nov 2014
Edited: Star Strider
on 24 Nov 2014
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 Comments
See Also
Categories
Find more on Cell Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!