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

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.
Pascal
Pascal 2014년 7월 6일
편집: Pascal 2014년 7월 6일
Subsituted ffs with hw. Sorry this was a mistake in the question.
ahh, which hw gives me
[...]/hw.m % Has no license available
any idea why the license would be unavailable all of a sudden?
Taylor
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
Liana Mihaela 2017년 3월 15일
Hey, how can I run from another path ? Thank you!
Jorge Ramirez
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
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

Pascal
Pascal 2014년 7월 6일
편집: Pascal 2014년 7월 6일
Don't quite get what you mean with "What toolbox was it in?". The problem occurs with each and every script or function I try to execute.
I use matlab on a university computer so I don't have much insights into licensing matters.
Output of ver:
ver
-------------------------------------------------------------------------------------------------------
MATLAB Version: 8.0.0.783 (R2012b)
MATLAB License Number: ••••••
Operating System: Linux 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64
Java Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
-------------------------------------------------------------------------------------------------------
MATLAB Version 8.0 (R2012b)
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.
sure, it gave a path to my desktop where I saved hw.m. Sorry for the confusion. As stated in my question hw.m is only a test script I created that contains nothing but
disp('hello world')
(yes, my desktop folder has been added to path!)
Image Analyst
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?
Pascal
Pascal 2014년 7월 6일
편집: Pascal 2014년 7월 6일
Super weird indeed. Copying my files to a new folder doesn't fix it but everything works fine again after I generated a new file with identical code in another folder . Seems like some of the old files are corrupt if that makes any sense?
Image Analyst
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
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에 대해 자세히 알아보기

제품

태그

질문:

2014년 7월 6일

댓글:

2022년 8월 19일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by