open files from different directorys
1 次查看(过去 30 天)
显示 更早的评论
I have to load data from a .m file to a uitable, thats my code:
diretorio = uigetdir;
filename = uigetfile('*.mat','Select the MATLAB code file');
d = ' \';
e = strtrim(d); % Usado para salvar "/" em forma de string
Dados_1 = strcat(diretorio,e,filename);
Dados_2 = open(Dados_1);
As you can see, its not functional, once i need to ask for the directory name, the file name, then manipulate strings and finally open it. Is there a function that opens files from different directorys?
0 个评论
采纳的回答
Image Analyst
2011-10-2
Accept BOTH return values from uigetdir(), then combine them with fullfile().
5 个评论
Jan
2011-10-9
I recommend to use "load(fullfile(caminho filename));" instead. In opposite to the simple concatenation it cares for the necessary file separators.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dialog Boxes 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!