how to write this data in text file?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
how can i store my data in .txt as it is shown in workspace that is in separate column..
where variable name is sets(9:i) now this i is 5 in this case but it could be other wise
for i=1:5
fprintf(fid, '%.2f\n',sets(9,i) );
end
not working..its writing all (9*5) data in a single column...
댓글 수: 0
채택된 답변
Sara
2014년 7월 30일
Try this:
sets = rand(9,5)
for i = 1:9
fprintf(fid,'%.2f ',sets(i,:) );
fprintf(fid,'\n');
end
댓글 수: 0
추가 답변 (2개)
Roger Wohlwend
2014년 7월 30일
Use the function csvwrite:
csvwrite(filename,Matrix)
Or consider saving the matrix in a mat-file using the command save.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!