Error when running simple script containing local function in Octave
问题 My file testtest.m looks like : pluse(1, 2) function retval = pluse(input1, input2) retval = input1 + input2; endfunction Then I get: error: 'pluse' undefined near line 1 column 1 error: called from testtest at line 1 column 1 Why do I get this error? 回答1: To answer your question properly, I need to point out two things: The canonical way to create a function in both octave and matlab is by placing it in a dedicated file by the same name, and starting the file with a function declaration .