필터 지우기
필터 지우기

Rounding of a number/ text file format

조회 수: 4 (최근 30일)
missC
missC 2014년 7월 23일
댓글: missC 2014년 7월 24일
Hi, i used this command to save a work space variable into text file.
save('corner.txt', 'new_bpCols', '-ASCII', '-double','-append');
and the output is like I attached, I wanted to have the exact values as in the variables which is:
What format I should use?
The workspace variable value: 19 20 38 46 64 66 101 105 122 129 148 149
Thank you

채택된 답변

Mischa Kim
Mischa Kim 2014년 7월 23일
편집: Mischa Kim 2014년 7월 23일
missC, you could use instead
x = 1:5;
fid = fopen('corner.txt','w');
fprintf(fid,' %d\n',x); % > %d: write integer values to text file
fclose(fid)
  댓글 수: 2
missC
missC 2014년 7월 24일
great thanks! :)
missC
missC 2014년 7월 24일
another question. How to concatenate two variables into one text file in column wise. For example: X in one column and Y in another column. Appreciate your help x = a; y = b; fid = fopen('corners.txt','w');
%table header
fprintf(fid, 'X Y \r\n');
fprintf(fid,x,'%d %d\r\n',y);

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by