placing elements of a cell array into a matrix
3 次查看(过去 30 天)
显示 更早的评论
I am reading in data from several files. For each file I first read the data into elements in a cell array. This works fine. I then want to place the elements of the cell array into a second matrix, where their position int eh second matrix depends on their position in the cell array. I can't seem to get this to work properly. My cell array is Nx1 and each element is a 2 column array with a variable number of rows. I would like the elements of the first column in the cell array at M to be appended to the second matrix at column M. to be more explicit..
say A is a 144X1 Cell array.
Say B is a 1X200 Matrix I would like to do something like
for m=1:length(A)
B(:,m)=[B(:,m);A{m}(:,1)]
end
does this make sense? It keeps giving me an index out o bounds error. I think that is because I am putting A{m}(:,1) into each row of A but I am not sure..
How can I do this? thanks for your help..
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!