필터 지우기
필터 지우기

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 CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by