Filter löschen
Filter löschen

how can we create simulink block using m file in matlab 2012a?

3 Ansichten (letzte 30 Tage)
Kanwal Aslam
Kanwal Aslam am 25 Aug. 2012
i have created my m file in matlab is there any way to create a simulation block without using s function

Antworten (2)

Azzi Abdelmalek
Azzi Abdelmalek am 25 Aug. 2012
you can use
  1. new_system('ModelName') to create a simulink model
  2. open_system('ModelName') to open your model
  3. add_block('Simulink/Sources/step','ModelName/BlockName') % for example
  4. set_param to configure blocks
  5. use add_line to connect block
  6. sim('ModelName',options) to start simulation
  7. close_system, to close your simulink Model
  2 Kommentare
Kaustubha Govind
Kaustubha Govind am 27 Aug. 2012
Azzi: I think Kanwal's question is about calling his MATLAB code from Simulink, not about constructing a model using MATLAB code.
Salim
Salim am 26 Jul. 2013
I think he misunderstood your question. You can use Matlab function block under User-defined functions.

Melden Sie sich an, um zu kommentieren.


Kaustubha Govind
Kaustubha Govind am 27 Aug. 2012
You can use the Interpreted MATLAB Function block if your function has one input and one output, and you don't intend to generate code from your model. Otherwise, you can try the (Embedded) MATLAB Function block. If you're not using the subset of functions supported for code-generation, you will need to declare those using coder.extrinsic.

Kategorien

Mehr zu Programmatic Model Editing finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by