New line for each character before space.

조회 수: 1 (최근 30일)
Abdul Ghani Zahid
Abdul Ghani Zahid 2020년 4월 25일
댓글: Abdul Ghani Zahid 2020년 4월 25일
I have a cell array which I converted to strcat and exported it into .txt file. Now the problem is that I want each value to go into a new line where as my values keep on coming in the same line after 3 spaces . Following is the code I am using
ECG_BIN_CELL = bin(fi(sigECG,1,32,31));
temp = strcat(cellstr(ECG_BIN_CELL));
fid = fopen('ECG_BIN.txt', 'wt');
fprintf(fid, '%s/n', temp{:});
fclose(fid);

답변 (1개)

Walter Roberson
Walter Roberson 2020년 4월 25일
fprintf(fid, '%s\n', temp{:}); %\n not /n
  댓글 수: 1
Abdul Ghani Zahid
Abdul Ghani Zahid 2020년 4월 25일
I did it but I get the same result
The txt file I get shows the answer as
00000110000000110101010011111111 00000110001111100001100001110011 00000110010000000011001110100100 00000110000100110100101111011101 00000101101111101110101101010100
where as I want it as
00000110000000110101010011111111
00000110001111100001100001110011
00000110010000000011001110100100
00000110000100110100101111011101
00000101101111101110101101010100

댓글을 달려면 로그인하십시오.

카테고리

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