MATLAB: Attempt to execute SCRIPT as a function

attempt to execute script as a function

Hi all, I am a new user of Matlab. Im learning how to debug a .m file called "test.m". I was asked to copy one backup, I made the name "test_debug.m". When I run the test_debug.m file, there is a error msg,
Attempt to execute SCRIPT test as a function: D:\ProgramFiles\Reference_src\test.m
test.m is not in path. But it could still successful run. It has called several functions inside the script. What should I add into/make changes for test_debug.m?
Thank you!

Best Answer

Does the first line of test_debug say either
function test()
or
function test_debug()
or does it not have a function line at all?
It should say function test_debug - if it does not but has included other functions declared within the same m-file, then you will get that message since you can't have a script and a function in the same m-file. It has to be just a single script (meaning no function line) or it has to be one or more functions that are declared in it. ?