Vectorizable Embedded MATLAB Function

This set of Simulink models demonstrates how to create a reusable Embedded MATLAB function for scala
1,5K Downloads
Aktualisiert 1. Sep 2016

Lizenz anzeigen

The three Simulink models provided demonstrate how to develop a reusable Embedded MATLAB function that can be used on scalars and vectors. The Embedded MATLAB function, a simple quadratic equation, is implemented in the model my_eml_func.mdl. This model is referenced as a Model Reference in the library my_lib.mdl. The library contains a configurable subsystem that can be set to either a scalar or vector choice. The scalar choice contains just the reference model for the Embedded MATLAB function and the vector choice contains the same reference model plus a for iterator, vector selector blocks and a vector assignment block. The latter subsystem allows the Embedded MATLAB function to operate in a for loop that addapts to the size of the input signals. A third model, eml_mr_inherited_dim.mdl, includes three instances of the library block to demostrate how the single Embedded MATLAB function can be used for a scalar input, a vector input of width 3 and a vector input of width 5.
This example does have two limitations. This first limitation is that all inputs to the function must have the same vector width. The second limitation is that the Embedded MATLAB function cannot contain any persistent variables.

This technique allows a reusable Embedded MATLAB function to be built and tested once, then the function can be reused many times in other models on any size input vector.

For more information about the Embedded MATLAB subset, please visit the MathWorks web-site:
http://www.mathworks.com/products/featured/embeddedmatlab/

Zitieren als

Bill Potter (2024). Vectorizable Embedded MATLAB Function (https://www.mathworks.com/matlabcentral/fileexchange/18075-vectorizable-embedded-matlab-function), MATLAB Central File Exchange. Abgerufen.

Kompatibilität der MATLAB-Version
Erstellt mit R2007b
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Prepare Model Inputs and Outputs finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Veröffentlicht Versionshinweise
1.0.0.1

Updated license

1.0.0.0

Corrected summary and added product link.