matlab won't run any script or function
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
dpb
on 6 Jul 2014
You've got something munged in path or aliased -- that whatever the function name is it's "ffs" that isn't being found is key.
Try
clear all
and
which ffs
BTW, you don't need run here, just
hw
from the command line suffices.
See what
matlabpath
returns; it's possible you've somehow munged it.
Taylor
on 10 Mar 2017
Dear dpb,
Thank you for the clarification, I ran my script from another path and it worked.
Best regards, Taylor
Liana Mihaela
on 15 Mar 2017
Hey, how can I run from another path ? Thank you!
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
1 vote
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
It's not in base MATLAB so it must be in a toolbox or some custom written function that you think you have. You don't have any toolboxes at all installer. When you said which, why did it say
[...]/hw.m % Has no license available
Are you sure it didn't give a path rather than [...]? I've never seen it not give a full path if it found the file.
Pascal
on 6 Jul 2014
Image Analyst
on 6 Jul 2014
Weird. If it's your own function that you wrote, it should not be asking about a license. Does it still complain about the license if you put it in a different folder, like your "My documents" folder?
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...
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!