필터 지우기
필터 지우기

sfunction builder function through command line

조회 수: 9 (최근 30일)
Pika
Pika 2012년 5월 2일
답변: Sanket 2019년 4월 15일
Is there a way to build from the sfunction builder via command line instead of opening the dialog box and pressing "build"?

답변 (4개)

Kaustubha Govind
Kaustubha Govind 2012년 5월 2일
See this solution for the command-line API.
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
Pika
Pika 2012년 5월 6일
yes i do. the error i get is out of the second command line listed. It says Attempt to reference field of non-structure array.
I know how to create a structure array with dot notation but why was blkHandle not automatically created as a structure array when first command line is used? mine apppears to be as a cell array
Kaustubha Govind
Kaustubha Govind 2012년 5월 7일
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
arun kumar 2015년 3월 20일
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
giga
giga 2016년 5월 1일
Hi did anyone have an answer for this question? Thanks!

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


kiyoko
kiyoko 2018년 7월 24일
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
Sanket 2019년 4월 15일
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

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by