MATLAB Answers

0

How can I modify the MATLAB function block within a Library block (with active link) from the command line? 

Asked by MathWorks Support Team on 23 Jun 2016
Latest activity Answered by Aaron
on 17 Oct 2017
How can I modify the MATLAB function block within a Library block (with active link) from the command line? 

Tags

No tags entered yet.

Products


Release

R2016a

2 Answers

Answer by MathWorks Support Team on 23 Jun 2016
 Accepted Answer

You can obtain a handle to the linked MATLAB function block using the following commands:  
 
root = sfroot;
model = getfullname(bdroot(BlockName));
SFMachine = root.find('-isa','Stateflow.Machine','-and','Name',model);
emlObj = SFMachine.find('-isa','Stateflow.LinkChart','-and','Path',BlockName);
where the variable 'BlockName' holds the name of the MATLAB function block you wish to modify. 
Once you obtain the emlObj, you can make the desired changes to the MATLAB function block from the command line.

  0 Comments

Sign in to comment.


Answer by Aaron
on 17 Oct 2017

This didn't seem to work with a self-modifying mask. Is there a way to modify the code under the mask?
When I get the emlObj, it is a Stateflow.LinkChart (which I couldn't find info on)
emlObj.get
Path: 'hdl_junk/Subsystem1/ufi to bool array param1/func'
Id: 4582
Machine: [1×1 Stateflow.Machine]
Name: 'func'

  0 Comments

Sign in to comment.