MATLAB: Can Embedded MATLAB create C code that generates an error message

emlMATLAB

I would like to include error checking in my C code generated from Embedded MATLAB. For example, if I need to check to see if some variable "x" is zero and throw an error if it is, my Embedded MATLAB code would look like this:
if x==0,
eml.error('Some Error Message')
end
where "eml.error" is the function I would like. It could generate C code that throws the error I specify.

Best Answer

There is no Embedded MATLAB function that auto generates C code that throws an error message.
To workaround this issue, you can use the "eml.ceval" functionality to insert your own C code in the generated code.
Related Question