Can one define a "directory" as a "variable"?
1 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
Fangjun Jiang
2020-11-23
directory='c:\myfolder';
filename='myfile.xlsx';
readtable(fullfile(directory,filename));
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 File Operations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!