필터 지우기
필터 지우기

Automate SFunction generation - Simulink workflow

조회 수: 1 (최근 30일)
James
James 2011년 9월 15일
Hi,
I've got a subsystem block that I'm generating an SFunction of, which I'm then using in a model.
How do I automate the generation of the SFunction so that when the subsystem changes the SFunction is regenerated, so I can be sure I have the latest version? Any script I can write to do this will be called when the library file containing the subsystem changes, but I don't know what to put in the script.
As far as I can see, if the SFunction is regenerated it will replace all the code files - so it isn't necessary to make any changes to the model that uses it. Please correct me if I'm wrong in this assumption. (This is assuming I can treat the block as a black box and the inputs/outputs won't be changing).
Many thanks,
  댓글 수: 1
James
James 2011년 9월 15일
I want to write a script that is the equivalent of: Right-clicking on a model block, selecting RealTimeWorkshop, then Generate Code, then clicking Build on the dialogue that pops up.
I've been told anything that can be done in the Simulink GUI can be done via the command line. I just don't know how.

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

채택된 답변

Kaustubha Govind
Kaustubha Govind 2011년 9월 15일
Try the following:
set_param('subsystem_model', 'SystemTargetFile', 'rtwsfcn.tlc');
set_param('subsystem_model', 'CreateModel', 'off');
rtwbuild('subsystem_model/subsystem_name');

추가 답변 (1개)

TAB
TAB 2011년 9월 15일
You can trace the change in your library file containing subsystem by its 'ModifiedDate'.
Write a script to find the modified date as
% Load model library & get its handle
h=load_system('subsystem_library_model');
% Get object from handle
ho=get_param(h,'object');
% Get last modified date & time
LastMdfd=ho.ModifiedDate;
Output will be in the formate 'Thu Sep 15 16:19:06 2011'
You can save the ModifiedDate in a text file and compare the current obtaind date with saved date .
  댓글 수: 2
James
James 2011년 9월 15일
Thanks Tabrez, but it's not that I'm trying to do.
I want to write a script that is the equivalent of:
Right-clicking on a model block, selecting RealTimeWorkshop, then Generate Code, then clicking Build on the dialogue that pops up.
I need it done a lot so a script to do this will save a lot of time.
James
James 2011년 9월 15일
Well, I am doing that (the script will fire when versioncontrol software sees a change) but that's not the point of the problem.

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

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by