matlab won't run any script or function
33 views (last 30 days)
Show older comments
I couldn't run any function or script in matlab for 2 days now and it's killing me.
Lets say I have
disp('Hello world')
saved as hw.m in a path known to matlab. Sounds simple enough but I can't run this script. Hitting the run button in the gui yields
Undefined function or variable 'hw'
I tried to run hw.m from the command line...
run 'hw.m'
Undefined variable "hw" or class "hw.m".
Error in run (line 74)
evalin('caller',[script ';']);
Defining the script as a function didn't work either...
5 Comments
Jorge Ramirez
on 19 Aug 2022
Yeap, I can confirm that the problem is the path your trying to run from, In my case I was trying to run from the bin folder inside the MATLAB installation folder in Linux, changed to my home directory and the problem was gone.
Answers (1)
Image Analyst
on 6 Jul 2014
What toolbox was it in? What does "ver" show in the command window? Could it have been a temporary/trial license for that toolbox which expired?
7 Comments
Image Analyst
on 6 Jul 2014
Perhaps they have some invisible characters in there but it seems weird that that would cause it to say that some license is missing. I'd call the Mathworks and ask them. Is the hw file a standalone file that I can try to run, or does it need all kinds of other files? If you can post it, I could try it.
dpb
on 10 Mar 2017
Possible you inadvertently created (or broke) a path via a symbolic link so the path you think you're looking at isn't actually there at all? That kinda' thing sounds to me like what would bring in the licensing issues but I don't know diddley about Unix or the Matlab install on same; just a guess...
See Also
Categories
Find more on Introduction to Installation and Licensing 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!