matlab won't run any script or function
显示 更早的评论
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 个评论
dpb
2014-7-6
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
2017-3-10
Dear dpb,
Thank you for the clarification, I ran my script from another path and it worked.
Best regards, Taylor
Liana Mihaela
2017-3-15
Hey, how can I run from another path ? Thank you!
Jorge Ramirez
2022-8-19
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.
回答(1 个)
Image Analyst
2014-7-6
1 个投票
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 个评论
Image Analyst
2014-7-6
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
2014-7-6
Image Analyst
2014-7-6
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
2014-7-6
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
2017-3-10
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...
类别
在 帮助中心 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!