How do I use the ADD_LINE command with SimMechanics blocks?
    5 ビュー (過去 30 日間)
  
       古いコメントを表示
    
    MathWorks Support Team
    
 2009 年 6 月 27 日
  
    
    
    
    
    回答済み: Steve Miller
    
 2018 年 2 月 1 日
            The ADD_LINE command can be used to connect Simulink blocks from the command line. However, this command basically assumes that there are 'output' ports and 'input' ports. In SimMechanics this is not the case, and specifying connections in the normal way does not work.
採用された回答
  MathWorks Support Team
    
 2016 年 11 月 18 日
        SimMechanics models can be created from the MATLAB Command Line, but a special syntax is used to represent the ports. The ports should be described as 'LConn<number>' and 'RConn<number>', where 'number' indicates the position on the block. The following example creates a small sample model with two connected blocks:
new_system
open_system(gcs)
add_block('mblibv1/Joints/Revolute',[gcs,'/Revolute'])
add_block('mblibv1/Joints/Revolute',[gcs,'/Revolute1'])
set_param(gcb,'Position',(get_param(gcb,'Position')+[0 60 0 60]))
add_line(gcs,'Revolute/RConn1','Revolute1/LConn1')
0 件のコメント
その他の回答 (1 件)
  Steve Miller
    
 2018 年 2 月 1 日
        We have posted an example on the MATLAB Central File Exchange that shows how to use MATLAB commands to add Simscape blocks and connect them.
To connect a block to an existing line, simply use add_line() to connect the new block to any of the ports that are already connected to that line. The above example connects the Solver Configuration block to two other blocks which are already connected.
Thanks,
--Steve
0 件のコメント
参考
カテゴリ
				Help Center および File Exchange で Programmatic Model Editing についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

