How to make an app built by AppDesigner suitable for deployment as santdalone?

5 views (last 30 days)
I am not sure whether my question is primitive or not, but since it's my first time building a standalone application, I would like some help: I have built an app using AppDesigner in R2016b, and I would like to deploy it as a standalone .exe application. However, I have a few concerns: my app extracts data by using the evalin function, i.e. the user has to provide the data in the workspace, and provide the app with the variable name so that the data can be used by the app. If my app becomes standalone, how will MATLAB handle the evalin command? and how the user will then be able to input the data if they don't have MATLAB installed? If evalin causes problems for standalone apps, what would be a better replacement? Note: my user inputs are matrices representing datasets. Also, my app depends on Mathworks toolboxes such as the Optimization and Neural Networks toolboxes; thus how will that be accommodated in the standalone version?
  1 Comment
Eric Long
Eric Long on 21 May 2018
Hi, I am working on an app that will require a similar style of loading workspace data.Could you provide some more info on how you were able to load this data and define the variables? Thanks

Sign in to comment.

Accepted Answer

Prannay Jain
Prannay Jain on 7 Feb 2017
I understand that you would like to provide matrices available in a workspace as user inputs to your standalone application. In general, compiled applications do not process dynamic content at the run time, for example, MATLAB files. Since you want a workspace variable to be available as an input to the application, one way of doing this is to save those variables in a '.mat' file as follows:
>> save filename.mat
After saving the workspace variables you could either include this "filename.mat" while creating the standalone application or take this file as an input through GUI of application which I guess you are trying to achieve. You can browse through this file using 'uigetfile' function, store path and file name and provide this full path of file to 'importdata' function to read '.mat' file as follows:
function TestInput()
filename=[pathname filename];
This way you will not have to use 'evalin' function which requires current workspace.
I would suggest looking at the below documentation link which talks about refraining from using dynamic code at run time of application and alternative of 'eval'.
I hope this will help you in resolving the issue.
  1 Comment
Gonzalo Morales
Gonzalo Morales on 19 Mar 2020
I have tried doing what is suggested here about saving the workspace and then including it as part of the "files required for my application to run", but it still will give me an error when the standalone app calls the evalin function to the base workspace. Is there anything else I should do before compiling?

Sign in to comment.

More Answers (1)

Prannay Jain
Prannay Jain on 7 Feb 2017
Regarding your second question of using toolboxes inside the application, MATLAB Compile Runtime (MCR) will take care of most of the toolboxes functionalities. To run a standalone application you will have to install MCR if MATLAB is not installed on that machine. MCR is a standalone set of shared libraries, MATLAB code, and other files that enables the execution of MATLAB files on computers without an installed version of MATLAB. MCR supports the full MATLAB language including objects, most MATLAB toolboxes, and user-developed user interfaces. However, there are some functionalities that MCR do not support as shown in the below documentation link:
  1 Comment
Mazen Azzam
Mazen Azzam on 8 Feb 2017
Thank you for your help. I have another question regarding dialog windows in apps: I notice whenever the user presses cancel on a certain dialog box, the app is thrown into the background and the main workspace becomes the active window. Sometimes this happens even when the user continues with the prompted action. Could there be something that I forgot to add to my code or is this behavior normal in matlab apps?

Sign in to comment.


Find more on Migrate GUIDE Apps 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!

Translated by