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

조회 수: 3 (최근 30일)
Kanwal Aslam
Kanwal Aslam 2012년 8월 25일
i have created my m file in matlab is there any way to create a simulation block without using s function

답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2012년 8월 25일
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
Kaustubha Govind
Kaustubha Govind 2012년 8월 27일
Azzi: I think Kanwal's question is about calling his MATLAB code from Simulink, not about constructing a model using MATLAB code.
Salim
Salim 2013년 7월 26일
I think he misunderstood your question. You can use Matlab function block under User-defined functions.

댓글을 달려면 로그인하십시오.


Kaustubha Govind
Kaustubha Govind 2012년 8월 27일
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.

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by