0

I'm trying to execute a compiled matlab script. When I run the same script in the matlab command window, it works fine, nevertheless, when I try to run the compiled version, I get this error message: "Undefined function or variable". When i was debugging the code, I found what could possible be the error. That missing variable was declared in another ".m" script file. Is this a problem from the compiler command? I've tried to include the variable declaration file within the compiler command, but the problem persists.

1 Answers1

0

You should declare your variable as global in original *.m script:

global var
var= 100;

You can find more here

madbitloman
  • 816
  • 2
  • 13
  • 21