How can I know which files are being used by my compiled GUI?
Show older comments
Hello,
I've created a uitility via App Designer, and compiled an exe version for my colleagues to use it as well.
The utiliy composed of all sorts of files: *.m , *.jpg , *.xml
I'd like to prepare a "distribution" folder with only the necessary files. I mean the main exe file itself + (???)
How this can be done? Obviously if I open the exe and try to do a certain functionality, I may revieve an error if a certain file is missing. So that way I know for sure this file is required to be included in my "distribution folder". BUT, the GUI has a lot of options / functionalities / modes of operation... I don't want to go a check each and everyone of them, to see if it works in the compiled version.
So, either I simply share with everyone the FULL Project folder that contains everything, or is there a smart & easy way to do this selection?
THANK YOU.
9 Comments
Rik
on 28 Apr 2022
The m files should be taken care of by the compiler (unless you're using things like eval, in which case it's on you).
I'm not aware of any automated tools to detect the use of other files.
Mark Golberg
on 28 Apr 2022
Bruno Luong
on 28 Apr 2022
Edited: Bruno Luong
on 30 Apr 2022
Required source code files (not data files or such)
fLists = matlab.codetools.requiredFilesAndProducts('YourGUI.m')
Mark Golberg
on 30 Apr 2022
Bruno Luong
on 30 Apr 2022
"How can I have a list of all the files that are need to be added to the already compiled exe file?"
How on earth MATLAB can know that? You the app designer you should know what files are needed.
Mark Golberg
on 30 Apr 2022
Steven Lord
on 30 Apr 2022
Suppose your app calls uigetfile to let the user select a data file to import. Let's say that call tells MATLAB to allow the user to select an XML file that contains configuration data for a particular type of problem. [It doesn't hard-code the name of a specific XML file.] Should the Compiler then look for all XML files on your computer and "figure out" which of those "look like" a configuration file? Or should it depend on you to tell it which configuration files it should include in your application?
Suppose I have created a GUI with hundredrs of different files it rely on? Mat files, JPEG files, xml files, you name it...
Then for your own sake and the sake of developers who may be working on this GUI in the future you should probably have those files organized in some way that makes it easy to distinguish what is needed for what parts of your GUI's functionality. Look at MATLAB itself -- there are hundreds or thousands of MATLAB functions but they're organized into directories that (more or less) all relate to a particular type of capability.
- The graph and network algorithms functions are in the graphfun directory.
- The sparse matrix functions are more or less all in the sparfun directory.
- The string processing functions live in the strfun directory.
When I want to look at one of those functions, knowing generally what "category" it belongs to gives me a good idea where I need to go to look at it. If you have your files organized, you should be able to more easily determine if a category of files need to be included.
The Projects functionality in MATLAB can help with organizing your files, as could using a source control management system..
Now, can't MATLAB really tell me which files needs to be added to the compilation folders? which files need to be shared along with the exe distribution folder?
Not necessarily just from static analysis, no.
Mark Golberg
on 1 May 2022
Rik
on 1 May 2022
The point of the already compiled file is that it should already include all m files. Therefore asking for identification of all other files doesn't make sense, for reasons Steven pointed out.
I personally use my own system of flags in comments when I call one of my own functions. Not bulletproof, but it works reasonably well. I use it to compose a single large m file, but gathering files for a compilation to exe should also be possible.
Accepted Answer
More Answers (0)
Categories
Find more on Large Files and Big Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!