Accessing simulink blocks in Matlab scripts

조회 수: 12 (최근 30일)
John
John 2012년 11월 29일
Is there a way to call or access a simulink block in matlab without opening the graphical simulink environment or opening a predefined model (mdl) file?
Essentially, the goal is to write a matlab script which defines a simulink model within the script utilizing simulink blocks already present in the Simulink library (Rician noise generators, signal generators, and the like). This way, all adjustable parameters can be kept in "code" and not in graphical "forms" (cleaner development environment).
We are using Matlab R2012a. The necessary simulink toolkits as well as the simulink environment have already been licensed and installed.
  댓글 수: 1
Muruganandham Subramanian
Muruganandham Subramanian 2012년 11월 29일
Have u tried by, for e.g. if you want to access unitdelay block, simulink.unitdelay in command window

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

답변 (2개)

Michelle Hirsch
Michelle Hirsch 2012년 11월 29일
Depending on the nature of the models you'd like to build, an alternative to using MATLAB to construct a Simulink model might be to use System objects. System objects are designed to be used either as Simulink blocks or in MATLAB code. When used in MATLAB code, there is no underlying Simulink model.
System objects come with System Toolboxes (DSP System Toolbox, Computer System Toolbox, etc). This page explains them way better than I could: System Objects for Stream Processing in MATLAB

Vishal Rane
Vishal Rane 2012년 11월 29일
You could use load_system command to load the model into memory without the simulink editor.
Then use find_system command to programmaticallly access the model and/or its blocks.
Refer the examples given in the documentation for better understanding.

카테고리

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