Matlab cannot run a *.m file

조회 수: 10 (최근 30일)
Eva Maria Cirugeda Roldan
Eva Maria Cirugeda Roldan 2016년 7월 27일
댓글: John D'Errico 2016년 7월 28일
I have an script named Cast_Analysis.m. I have already run it and it was working, but according to memory constraints the simulation was aborted. I had to restart Matlab but when tried to run it again Matlab keeps returning the following message:
Undefined function or variable 'Cast_Analysis'
I have tried to run it from the command window, from the run button in the editor tab and F5 button
The file, is stored under: C:\Users\emcirugedaroldan\Desktop\MatlabCoding\scripts\
i have checked that Matlab is able to find the file:
>> exist('Cast_Analysis')
ans =
2
I have checked Matlab has rights to execute it
>> fileattrib('Cast_Analysis.m')
Name: 'C:\Users\emcirugedaroldan\Desktop\MatlabCoding\scripts\Cast_Analysis.m'
archive: 1
system: 0
hidden: 0
directory: 0
UserRead: 1
UserWrite: 1
UserExecute: 1
GroupRead: NaN
GroupWrite: NaN
GroupExecute: NaN
OtherRead: NaN
OtherWrite: NaN
OtherExecute: NaN
I have checked Matlab finds the file in the specified directory
>> what(pwd)
MATLAB Code files in folder C:\Users\emcirugedaroldan\Desktop\MatlabCoding\scripts
Arrythmia_testing EstHRV PhysioNet_DB_Download_qrs mti
CAST_DB EstRR fn2fm spbrk
Cast_Analysis PhysioNet_DB_Download fnbrk spval
ComputeTime PhysioNet_DB_Download_noAnnot fnval
Can someone help me with it?
  댓글 수: 5
Eva Maria Cirugeda Roldan
Eva Maria Cirugeda Roldan 2016년 7월 28일
italic
Thanks,
Exactly, I ran it, Matlab crashed, reopen Matlab and tried to run it again --> undefined.
reboot computer, restarted Matlab, tried to run it --> undefined
created new file inside folder with new name, copied code, tried to run --> undefined
create new folder, copy file, tried to run --> undefined
the three ways, by code on comand line, by green button and by F5
no, no input arguments but calls to other functions
John D'Errico
John D'Errico 2016년 7월 28일
You need to have that folder on your search path though. If you created a new folder, that new folder needs to be on the search path.
You can do that by using CD inside MATLAB to move to the new folder. Or you can use addpath or pathtool to add the folder to the path.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by