How to use the function uigetfile?
4 次查看(过去 30 天)
显示 更早的评论
When I use the uigetfile function
And want to select any file that is not in the same folder as my M file code
I'm getting an error
How can I select the file from any folder on my computer?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/683658/image.png)
0 个评论
采纳的回答
Walter Roberson
2021-7-13
[read_my_file, rmfdir] = uigetfile('*.xlsx')
if ~ischar(read_my_file); return; end %user cancel
rmfn = fullfile(rmfdir, read_my_file)
read_my_file_table = readtable(rmfn) ;
更多回答(1 个)
ANKUR KUMAR
2021-7-13
编辑:ANKUR KUMAR
2021-7-13
"How can I select the file from any folder on my computer?"
This is pretty simple. You need to provide the full path of the file while calling uigetfile function.
uigetfile('D:\folder\subfolder\subsubfolder\*.xlsx')
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Adding custom doc 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!