Generation of a simulink block/blockset by MATLAB editor

10 ビュー (過去 30 日間)
Marco
Marco 2013 年 1 月 8 日
コメント済み: matteo bartoloni 2018 年 11 月 12 日
Hi,
Where can I get some information about generation of a simulink block (with a matlab function inside) by matlab command ? I would like create a blockset at the end of my script with some of my functions inside.

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 1 月 8 日
編集済み: Azzi Abdelmalek 2013 年 1 月 8 日
Look at
new_system
open_system
add_block
set_param
add_line
%Example
%-------------------creating a model---------------------------------------
fic1='filname'
new_system(fic1)
open_system(fic1)
add_block('simulink/Sources/Step','filname/step1')
add_block('simulink/Continuous/Transfer Fcn','filname/syst1')
set_param('filname/step1','Position', [10 150 40 180 ] )
set_param('filname/syst1','Denominator','[1000 1]')
add_block('simulink/Sinks/To Workspace','filname/tw1')
set_param('filname/tw1','SaveFormat','array')
set_param('filname/tw1','VariableName','y')
add_line('filname','step1/1','syst1/1');
add_line('filname','syst1/1','tw1/1');
set_param('filname','StopTime','inf')
add_block('simulink/Sources/Clock','filname/tim')
add_block('simulink/Sinks/To Workspace','filname/tw2')
add_line('filname','tim/1','tw2/1');
set_param('filname/tw2','Position', [200 350 230 380 ] )
set_param('filname/tw2','SaveFormat','array')
set_param('filname/tw2','VariableName','t')
  2 件のコメント
Marco
Marco 2013 年 1 月 17 日
Thanks!!!!!
matteo bartoloni
matteo bartoloni 2018 年 11 月 12 日
hey!!! I have the same problem. I need to convert Simevents Block in M code. I've been able to do it only with "Enter Generator" and other 2 blocks, but with lucky. Exist a list with all Simevents blocks write in M code??

サインインしてコメントする。

その他の回答 (1 件)

Kaustubha Govind
Kaustubha Govind 2013 年 1 月 8 日
There are three different ways to bring a MATLAB function into Simulink. Please read the documentation to figure out which block is most appropriate for your situation.
  2 件のコメント
Marco
Marco 2013 年 1 月 8 日
Maybe I was not clear in the question:
I would like it is able to generate blocks automatically if it let me to set their properties in the matlab script.
Thanks
matteo bartoloni
matteo bartoloni 2018 年 11 月 12 日
編集済み: matteo bartoloni 2018 年 11 月 12 日
hey!!! i'd like to know if you have solved the problem. I have the same problematic, i need to convert SimEvents block to M code

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by