打包exe后,dir函数无法读取exe内部文件夹数据。
6 views (last 30 days)
Show older comments
编写GUI时,在OpeningFcn里写入一个dir语句,其中test是GUI同一目录下的一个文件夹,内部含有子文件夹,目的是要读取test内所有文件夹的名字,现发现,直接运行GUI程序时,dir函数可以正常读取数据,但是打包成exe后,确无法读取,寻求各位大神帮助!
function Database_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Database (see VARARGIN)
% Choose default command line output for Database
handles.output = hObject;
File_name=dir('test'); %该函数打包exe无法读取数据
% % Update handles structure
guidata(hObject, handles);
0 Comments
Accepted Answer
saimme
on 17 May 2023
dir 肯定无法读取 exe 文件里面的东西你可以把读取文件放到exe 相同目录进行读取,又或 把需要读取的数据 直接在代码里面定义。
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!