Having trouble compiling uigetfile function
1 次查看(过去 30 天)
显示 更早的评论
Hello everyone! I created a GUI that has a feature to import and get data from an Excel file. To do that i used uigetfile function. When I compile it,the process goes without any errors and I can launch the .exe file without any problems. So far so good. But when I press my load button and choose the xls file I want to load nothing happens. I can see the file in choose file window and when I hit OK, nothing changes. It seems like compiler forgot to include some uigetfile files or something. I tried it on 2 different computers with 2 different guis and the problem is always the same. Any ideas how to fix it? In main files of compiler I choose .m file, in other files I put my .fig file with the gui layout and .jpg file with gui background picture. Thank you!
2 个评论
采纳的回答
Sebastian Holmqvist
2012-7-18
It always works for me. It could be that you only call
filename = uigetfile('*.xls','Select your file');
Instead, you should call
[filename, pathname] = uigetfile('*.xls','Select your file');
to make sure the whole file path is included. Then open your file with
file = xlsread([pathname filename])
to incorporate the file whole path.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!