How do I extract column vectors from a cell of doubles array?

5 visualizaciones (últimos 30 días)
Hi,
I have the cell of doubles array "cell_of_doubles" with 19 columns (19 cells). I am looking to extract only the first three columns from each cell and save them seperately in a three column vector (not a cell array).
This way I would like to create 19 new variables each containing three columns.
How would I do that?
Thank you!

Respuesta aceptada

Arif Hoq
Arif Hoq el 24 de Mzo. de 2022
A=load('cell_of_doubles.mat');
B=A.cell_of_double_balls ;
C=cell(size(B,2),1);
for i=1:size(B,2)
C{i}=B{1, i}(:,1:3); % first 3 columns from every cell
end
firstcell=C{1, 1}; % extract variable 1 by linear indexing
secondcell=C{2, 1}; % extract variable 2 by linear indexing and so on....

Más respuestas (0)

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by