Indexing vectors in a cell matrix with for loops?
Show older comments
Hello,
I have a 1x8 cell matrix. Each cell contains a 30x500 matrix. I need to combine the 3 first row vectors in each cell to form a new matrix. The new matrix needs to have 8 columns, each column representing the original cell. That being said, the 3 original row vectors have to be combined in one column vector. My final matrix will be 1500x8.
Basically, I have no idea how to index vectors from each cell to form a new matrix.
Thank you in advance.
Accepted Answer
More Answers (1)
David Hill
on 7 Jun 2021
newmat=zeros(1500,8)
for k=1:8
t=yourCell{k}(1:3,:);
t=t';
newmat(:,k)=t(:);
end
1 Comment
Camille Godin
on 7 Jun 2021
Categories
Find more on Matrices and 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!