MATLAB: Is the FIND function available in the Embedded MATLAB function set in Simulink 7.2 (R2008b)

embeddedfindMATLABsimulink

I want to use the FIND function to implement my logic within the Embedded MATLAB Function block in Simulink.

Best Answer

This change has been incorporated in Simulink 7.4 (R2009b). For previous releases the ability to use the FIND function is not available in the Embedded MATLAB Function set in Simulink 7.1 (R2008a).
A workaround for this is to declare the FIND function extrinsic in an Embedded MATLAB function. For example, the following code declares the MATLAB function FIND extrinsic in the Embedded MATLAB function foo:
function y = foo
eml.extrinsic('find');
x = ones(4);
y = x;
y = find(x);
Note, however, that a Simulink model using eml.extrinsic within an Embedded MATLAB Function block cannot be compiled. Use eml.extrinsic in Embedded MATLAB functions only. Using it in MATLAB functions generates an error.