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 で Resizing and Reshaping Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!