フィルターのクリア

writing data to a .txt file

1 回表示 (過去 30 日間)
shanmukh
shanmukh 2013 年 5 月 23 日
回答済み: elham soltani 2014 年 11 月 3 日
i have 2 columns of data
a= { 1
2
3
4 }
b= { 5
6
7
8 }
i used
fprintf(f, '%d;%d;\n',[a b]);
i get output .txt file as
1;2;
3;4;
5;6;
7;8;
but i need data in this format
1;5;
2;6;
3;7;
4;8;

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 5 月 23 日
fprintf(f, '%d%d\n',cell2mat([a'; b']));
  2 件のコメント
shanmukh
shanmukh 2013 年 5 月 23 日
i am getting an error
*Cell contents reference from a non-cell array object.
Error in cell2mat (line 43) cellclass = class(c{1});*
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 5 月 23 日
if a and b are not cell array, use
fprintf(f, '%d%d\n',[a'; b']);

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

その他の回答 (1 件)

elham soltani
elham soltani 2014 年 11 月 3 日
what is f in fprintf(f, '%d%d\n',[a'; b']);??

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by