save data in a special folder

조회 수: 2 (최근 30일)
Rica
Rica 2012년 12월 7일
i used this dlmwrite('phase.txt',phase) to save the phase in a txt file.
how could i tell matlab to save this data in a spacial folder. for exemple
C:\A\b\data
thank you!

채택된 답변

Vishal Rane
Vishal Rane 2012년 12월 7일
Instead of 'phase.txt' use the full file-name
dlmwrite('C:\A\b\data\phase.txt',phase)
  댓글 수: 2
Rica
Rica 2012년 12월 7일
so easy!
Image Analyst
Image Analyst 2012년 12월 7일
A more robust way is to use fullfile():
fullFileName = fullfile('C:\A\b\data', 'phase.txt');
It handles the proper direction of slashes (forward or backward) and will also figure out if it needs to append a trailing slash to the folder (which is the first argument) before it concatenates them. You might also want to call uigetdir() to let the user decide what folder to store the file in.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by