sfunction builder function through command line
Show older comments
Is there a way to build from the sfunction builder via command line instead of opening the dialog box and pressing "build"?
Answers (4)
Kaustubha Govind
on 2 May 2012
Try this code since there seems to be an error in the code from the solution:
blkNames = find_system(bdroot,'lookundermasks','all','BlockType','S-Function');
for blkIdx = 1:numel(blkNames)
blkHandle = get_param(blkNames{blkIdx}, 'Handle');
appdata = sfunctionwizard(blkHandle,'GetApplicationData');
appdata = sfunctionwizard(blkHandle,'Build',appdata);
end
Also, make sure that the model is open when the code is run.
4 Comments
Pika
on 3 May 2012
Kaustubha Govind
on 3 May 2012
Strange, I have R2011b, and I do see the function. Do you have $matlabroot\toolbox\simulink\simulink\sfunctionwizard.p?
Pika
on 6 May 2012
Kaustubha Govind
on 7 May 2012
Not sure why the solution assumes that find_system returns a structure. It does indeed return a cell-array of block names as you have observed. Try the code I edited and posted in my answer.
arun kumar
on 20 Mar 2015
0 votes
can i also write this appdata back to the s-function block. or is there any other way i can modify the s-function inports and outports from the command line? ofcourse i can modify the appdata structure but then how do i feed this information back to the s-function?
1 Comment
giga
on 1 May 2016
Hi did anyone have an answer for this question? Thanks!
kiyoko
on 24 Jul 2018
0 votes
sfunctionwizard is undocumented and not officially supported. If you are looking for command-line s-function authoring functionality, then the legacy code tool is designed for this.
Sanket
on 15 Apr 2019
0 votes
appdata = sfunctionwizard(blkHandle,'GetApplicationData') is not working for 2017b, any alternate solution?
>> appdata = sfunctionwizard(gcb,'GetApplicationData')
No method 'setBlockHandle' with matching signature found for class
'com.mathworks.toolbox.simulink.sfunbuilder.SFunctionBuilder'.
Error in sfunctionwizard
Categories
Find more on Programmatic Model Editing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!