It is not possible to remove file from Compiler Project in 2016b
Show older comments
After deleting a file in the deploy tool, along with documentation, the file is automatically inserted back within a few seconds. Then it is included in compiled binary. Rel. R2016b.
Is it possible to remove the file permanently?
9 Comments
Kojiro Saito
on 18 Oct 2016
I cannot reproduce the issue. After deleting required files, they don't appear again.
Could you tell me the reproduction steps? If possible, screenshots are welcome.
Adam
on 18 Oct 2016
I assume it is one of the main file's dependencies so that the auto dependency-checker sees it is missing and adds it back in.
Carbol
on 2 Nov 2016
I have exactly the same problem: I'm using a mat-file to dynamically change calibration data for a compiled GUI - and this compiler change, obviously introduced with 2016b, is really annoying!
I just filed a support case regarding this problem...
Kaixiang Wang
on 6 Jul 2018
@Carsten I have the same problem here. I am using 2017a. I've been searching for the solution everywhere but just couldn't find it. Have you solved your problem?
Kaixiang Wang
on 6 Jul 2018
I ended up manually deleting the depended mat-files from my disk, and restore them after compilation. Then it works.
WTF MATLAB!
Adam
on 9 Jul 2018
I still don't get what the issue is here. I have never seen files added automatically that are not dependencies of your code. If it is a dependency then why shouldn't it be added and, conversely, if you don't want it why is it a dependency of the code? Or am I missing something? No-one has given any meaningful details despite 3 people saying they have the same problem!
Christoph Kern
on 10 Jul 2018
I have this problem too. It's true that the program does rely on the file in question. However, this is a configuration file that I would like the user to be able to edit manually. Therefore, rather than including it in the compiled software package, I would like it to show up in the list of 'Files installed for your end user'.
Adam
on 10 Jul 2018
I just tested this out actually and was surprised that a .mat file gets picked up as a dependency so I guess this was a change from years ago.
If you refer to the file you are loading via a relative path formed from e.g. a function then it does not get picked up as a dependency and you can add it where you wish.
I have a few files that I ship for end users though they vary in how I choose to do them. At last one I actually have a class whose function creates the file at the user end if it doesn't exist, thus eliminating the need to include an actual .mat or .txt file.
Others though I include in code with something like:
configFilename = fullfile( getMatlabHomeDir( ), 'config.txt' );
where getMatlabHomeDir( ) returns a folder that, in my case is defined in an environment variable that my end users must set, but equally I have other functions that make use of
doc ctfroot
with an isdeployed flag to return me a directory that I can use for a relative path depending whether I am in a deployed application or in Matlab itself.
doc mfilename
is also useful for this kind of thing to give relative paths. In a few places I have a function in a folder whose only purpose is to return me the address of the folder it sits in for me to use as a relative path whether my code is deployed or not.
Kaixiang Wang
on 23 Jul 2018
@Adam Thanks for the reply. My understanding of your approach is, basically, to fool the dependency analyzer so it does not know the path to the data files? Quite a smart idea. I will give it a try.
Answers (2)
Soma Ardhanareeswaran
on 20 Oct 2016
1 vote
I agree with Adam, the Dependency Analysis step would pick up the dependent files that are found in the current directory or from the MATLAB path and get included into the compiler project.
5 Comments
Jan
on 20 Oct 2016
Kaixiang Wang
on 6 Jul 2018
@Jan I have the same problem here. I am using 2017a. I've been searching for the solution everywhere but just couldn't find it. Have you solved your problem?
Kaixiang Wang
on 6 Jul 2018
I ended up manually deleting the depended mat-files from my disk, and restore them after compilation. Then it works.
WTF MATLAB!
Jan
on 6 Jul 2018
Kaixiang Wang
on 23 Jul 2018
@Jan Hi Jan, thanks for replying! Eventually I managed to find a few ways, and yes, asking the user for an input location is one of them.
The other approach you mentioned could be a good idea too, but unfortunately not practical for my case. My .mat file is generated by another program which would not know the temp directory (across different machines).
Anyway, it is nice to discuss with you! Cheers!
Mike Smith
on 25 Jul 2019
0 votes
Hello,
I know it'a been a while since this question was posted but I thought I'd comment on my experience with this to keep it all in the same thread. I am using Matlab 2018a with deploytool to make a standalone application. I have a few lines in the app startup function that look for a file "locationOfConfig.m" that represents a Matlab variable (string) that is the absolute path to the actual configuration file. It uses this path to check for the file and if its not there the app launches a little configuration window where the user can make/edit the config file. Once the configuration window is filled out, the configuration file location ("locationOfConfig.m") file and the actual configuration file ("config.txt") are written.
Anyway, during compiling, it was annoying because my "locationOfConfig.m" file kept being automatically incorporated into the "Files required for your application to run" section. But I need the user to be able to generate their own unique file upon installation...not use my absolute path! To work around this, I simply save my local "locationOfConfig.m" in a location that is not set in the official Matlab path (Set Path) and then Matlab doesn't see it upon searching for dependencies. This allows me to compile without the Matlab-declared "dependent" file.
Hope that helps somebody out there.
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!