Store fllepath in variable

조회 수: 2 (최근 30일)
B_Richardson
B_Richardson 2011년 8월 2일
Hello all! Quick question:
is it possible to store a fullpath: C:\Users\ecorbett\Documents\MATLAB\Labelers\fred into a variable and use that variable in functions like csvwrite?

채택된 답변

Nathan Greco
Nathan Greco 2011년 8월 2일
Yes. Just store it as a string.
filepath = 'C:\Users\ecorbett\Documents\MATLAB\Labelers\fred';
filename = 'text.csv';
csvwrite(fullfile(filepath,filename),MatrixYouWantToStoreToFile);

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2011년 8월 2일
Sure:
fp = 'C:\Users\ecorbett\Documents\MATLAB\Labelers\fred\' %added extra \
csvwrite([fp 'my_example_csv.csv'], magic(5)) %add file name

카테고리

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