Editing MATLAB Code in Simulink
Guy Rouleau over at Seth on Simulink recently wrote about the different ways to include MATLAB code in a Simulink model. One of these ways is using an Embedded MATLAB block. Embedded MATLAB (sometimes abbreviated EML) is a subset of the MATLAB language that can be compiled to C code for use in an embedded system. The Embedded MATLAB language comes with Simulink along with the Embedded MATLAB Editor. You can open this editor by double-clicking any Embedded MATLAB block.
The Embedded MATLAB Editor looks a lot like the regular MATLAB Editor– it has syntax highlighting, M-Lint, and debugging; but it also has Simulink buttons on the toolbar — build, open the block diagram, edit the block’s ports, etc. You can access some of the same functionality as the editor: debugging, evaluation, and text commenting and indenting, but most of advanced functionality (e.g. run configurations, publishing, tab completion, etc) is not yet available. To take advantage of those features you can cut and paste the code from the EML editor to the MATLAB Editor. When you’re done, copy the code back to the Embedded MATLAB Editor.
Bonus tip: to get M-Lint warnings related to the Embedded MATLAB language in the regular Editor, add a “%#eml” anywhere in the file.
If you’re a Simulink user, check out Guy’s post and the Embedded MATLAB Language, and let us know what you think of the editing experience.
- カテゴリ:
- Editor
コメント
コメントを残すには、ここ をクリックして MathWorks アカウントにサインインするか新しい MathWorks アカウントを作成します。