フィルターのクリア

Concatenate cell of arrays

1 回表示 (過去 30 日間)
RuiQi
RuiQi 2016 年 6 月 22 日
コメント済み: RuiQi 2016 年 6 月 23 日
I have a cell(1 row x many columns) of arrays( many rows x 5 columns).
cell = [ 3 x 5 double, 2 x 5 double]
I want to write them all to a file row by row. So my text file will look like
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
2 2 3 4 5
2 2 3 4 5
where the first 3 rows come from the 1st cell and the next 2 rows from the 2nd cell for example. I have tried this but it does not work
fprintf(fid,'%d %f %f %f %f\r\n', bbs{1,1:end});
So i just found out about dlm write but it only accepts a matrix input. My input is a cell of matrices.

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 6 月 22 日
A={randi(5,3,5) randi(5,2,5)}
B=cell2mat(A')
  1 件のコメント
RuiQi
RuiQi 2016 年 6 月 23 日
Thanks ! I didn't know I had to transpose to get it to work

サインインしてコメントする。

その他の回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2016 年 6 月 22 日
out = cat(1,yourcells{:});

カテゴリ

Help Center および File ExchangeCell Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by