Changing the start folder for compiled App shortcut (Matlab 2014a)

Using the Standalone Application compiler in Matlab 2014a you can add files to installed with your application. I have added a few files to this section that are subject to manual changes depending on what tasks the end user might want to perform with the program and to handle driver installations. I have noticed that when running the MCR installer that is created for the application that it will asks the user if they would like to create a shortcut to the desktop for the application.
Once the program has been installed if you run it using the shortcut created by the installer it starts in is the local desktop folder so any of the files that are in the application folder cannot be seen by the program because it is not part of the path. But if I manually create a shortcut by going to the installed exe file and send it to desktop as a shortcut when I run the program using that shortcut the program will start in application folder that was created by the installer.
My question is this, is there a way to to either check to see where the program is installed so I can change my directory to be in the correct location or make i so the the shortcut created by the mcr installer will have the program boot in the installed folder?

 Accepted Answer

Yes. See my attached function. Call it in the startup code of your app.

6 Comments

Hi ImageAnalyst,
By startup code what do you mean?
I have added your code into my startup.m onto the end of the script but it doesn't seem to have worked. Have I done this correctly or am I missing some link somewhere?
No, not in startup.m but in the OpeningFcn() of your application.
Thanks Image Analyst. It works perfectly. I had the same issue.
Great answer! Thank you my hero

Sign in to comment.

More Answers (0)

Categories

Products

Asked:

on 13 Mar 2015

Commented:

on 26 Oct 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!