save table as space delimted text file, not tab delimited
조회 수: 7 (최근 30일)
이전 댓글 표시
Dear experts,
I want to save a table as a space delimted file. In the code below I save the table as tab delimted (\t). How can I the save the imput as space delimited?
table = [1 2 12;2 1 14;3 1 15]
%output file
fid = fopen('subjectlist.txt','wt');
for ii = 1:size(table,1)
fprintf(fid,'%.0f\t',table(ii,:));
fprintf(fid,'\n');
end
fclose(fid);
Thanks in advance!
Marty
댓글 수: 0
채택된 답변
Azzi Abdelmalek
2014년 5월 3일
Add one space or more after %.0f
fprintf(fid,'%.0f ',table(ii,:))
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!