Write Data to .txt or .csv file?
조회 수: 5 (최근 30일)
이전 댓글 표시
I'm trying to write data that I have in a matrix to a .txt or .csv file. I have data in a 250x2 matrix, and would simply like to be able to write this out to a file of my choice, say 'data.txt' or something like that. Is there an easy way to do this?
댓글 수: 0
채택된 답변
Oleg Komarov
2011년 8월 4일
댓글 수: 4
Oleg Komarov
2011년 8월 4일
compose the destination folder dynamically:
root = 'C:\User\Me\Documents\';
fname = 'filename.txt';
dlmwrite([root fname]...)
Image Analyst
2011년 8월 4일
Or use fullfile
fullFileName = fullfile(root, fname);
fullfile takes care of creating the correct filename regardless of whether root has a trailing slash or not.
or sprintf
fullFileName = sprintf('%s/%s', root, fname);
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Text Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!