MATLAB Answers

Joseph Cullen

Matlab Coder Error: Cannot Process Options

Asked by Joseph Cullen
on 25 May 2012

I am getting a cyptic error when compiling very simple test code. I am running Matlab on a mac.

>> coder -args { 0 } HW -report  
Cannot process options.
function ans = HW(x)
ans = x*2;

Running mex -setup returns

>> mex -setup
      Options files control which compiler to use, the compiler and link command
      options, and the runtime libraries to link against.
      Using the 'mex -setup' command selects an options file that is
      placed in /Users/Joseph/.matlab/R2012a and used by default for 'mex'. An options 
      file in the current working directory or specified on the command line 
      overrides the default options file in /Users/Joseph/.matlab/R2012a.
      To override the default options file, use the 'mex -f' command
      (see 'mex -help' for more information).
The options files available for mex are:
    1: /Applications/ : 
        Template Options file for building gcc MEX-files
    0: Exit with no changes
Enter the number of the compiler (0-1):



No products are associated with this question.

2 Answers

Answer by Kaustubha Govind
on 29 May 2012
 Accepted answer

You need to run the "codegen" command, not the "coder" command:

     >> codegen -args {0} HW -report

  1 Comment

oh wow...that was a stupid mistake. Thanks!

Answer by Walter Roberson
on 25 May 2012

-args has to go after the function it applies to.

coder HW -args {0} -report


It makes no difference whether or not the -args is before or after the function. Any other ideas?

>> coder HW -args { 0 } -report
Cannot process options.

I would be curious as to whether the problem disappears if you have no spaces in the args, {0} instead of { 0 } ?

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!