extracting columns from arrays within a cell
Show older comments
I have a cell consisting of 8 2x1 arrays and I want to extract the second column from them all. Usually, i'd use
k = cell2mat(data)
data1 = k(:,1:2:end);
But that doesn't work. How do I do this with cells?
Answers (1)
% Demo data
A = cell(8,1) ;
for i = 1:8
A{i} = rand(2,1);
end
data = cell2mat(A')' ;
data(:,2)
Categories
Find more on Data Type Conversion 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!