cell to double with reduced array size

5 visualizaciones (últimos 30 días)
ali mujtaba
ali mujtaba el 24 de Nov. de 2014
Editada: Star Strider el 24 de Nov. de 2014
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

Respuestas (1)

Star Strider
Star Strider el 24 de Nov. de 2014
Editada: Star Strider el 24 de Nov. de 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

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by