Why do I receive an undefined function or variable error in a standalone application?
Afficher commentaires plus anciens
I'm trying to build a standalone application that reads data from an excel file and writes some results into the same file (I use xlsread and xlswrite).
When I launch my program from the MATLAB Editor it works fine, but after building the standalone and running it, I get this error:
??? Undefined function or variable 'myfun'. MATLAB:UndefinedFunction"
I build my standalone using the deploytool; including myfun.m in "main function" folder. This should be something similar to "mcc -m myfun.m"
Does anybody know how to fix this problem?
7 commentaires
Aurelio
le 7 Fév 2011
You must try it with MATLAB Builder EX
Kaustubha Govind
le 7 Fév 2011
What is 'myfun' in your code? Also, are you running the executable on a machine that has Excel installed?
Unai
le 7 Fév 2011
Todd Flanagan
le 7 Fév 2011
I don't think this has anything to do with xlsread or xlswrite. It doesn't look like you function is running in the standalone. Could you edit your question and include the mcc command you used to build the standalone? That would be very helpful.
Unai
le 8 Fév 2011
Joana borges
le 4 Juil 2013
Hi! I´m having a similar problem now with my standalone. I didn´t understand how you´ve solved it. Where do I type 'MCR_CACHE_ROOT=%TEMP%\%USER% '? Is this permanente (I only have to do it once or every time i run the standalone)?
Walter Roberson
le 5 Juil 2013
In MS Windows, you can use the registry editor to create environment variables, but you would not typically do that.
In MS Windows, if you access the icon properties of the icon you use to launch your executable, then you can create environment variables as specific properties (I think. It's been a long time.)
In MS Windows, if you need to, you can edit the command line associated with the icon so that the icon creates the environment variables before running the executable. I do not know how that would be done.
In MS Windows, if you need to, you can swap out the actual executable name associated with an icon so that you instead name a .bat file, and the .bat file sets the environment variables and then runs the real executable.
Réponses (1)
Walter Roberson
le 7 Fév 2011
0 votes
Unless you have the most recent version, the compiler can only compile functions and not scripts.
1 commentaire
Bachtiar Muhammad Lubis
le 24 Juil 2019
by the way i face this problem as well.
i get this error "Undefined function or variable 'application'". when trying to run my .exe file (output after installing the applicationCompiler output).
what should i do to fix this ?
and why this is happened Walter?
:(
thanks in advance
Catégories
En savoir plus sur Spreadsheets dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!