Can one define a "directory" as a "variable"?

1 回表示 (過去 30 日間)
alpedhuez
alpedhuez 2020 年 11 月 23 日
コメント済み: alpedhuez 2020 年 11 月 23 日
Suppose I want to use readtable to read a file. I understand the format
readtable('C:\myFolder\myFile.xlsx')
readtable('C:\myFolder\myFile2.xlsx')
But in my case such directory name is very long and it is cumbersome that I need to specify that long directory name each time. Is it possible to define a directory name as a variable and simplify the process?

採用された回答

Fangjun Jiang
Fangjun Jiang 2020 年 11 月 23 日
directory='c:\myfolder';
filename='myfile.xlsx';
readtable(fullfile(directory,filename));
  1 件のコメント
alpedhuez
alpedhuez 2020 年 11 月 23 日
Thank you.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by