Store fllepath in variable

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 日

1 投票

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 日

1 投票

Sure:
fp = 'C:\Users\ecorbett\Documents\MATLAB\Labelers\fred\' %added extra \
csvwrite([fp 'my_example_csv.csv'], magic(5)) %add file name

1 件のコメント

B_Richardson
B_Richardson 2011 年 8 月 2 日
This works!

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeVariables についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by