Store fllepath in variable

3 ビュー (過去 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 件のコメント
B_Richardson
B_Richardson 2011 年 8 月 2 日
Thank you!

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

その他の回答 (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
  1 件のコメント
B_Richardson
B_Richardson 2011 年 8 月 2 日
This works!

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

カテゴリ

Help Center および File ExchangeText Files についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by