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

4 次查看(过去 30 天)
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!

采纳的回答

Arif Hoq
Arif Hoq 2022-3-24
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....

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Cell Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by