Automate SFunction generation - Simulink workflow
Show older comments
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,
Accepted Answer
More Answers (1)
TAB
on 15 Sep 2011
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 .
Categories
Find more on Simulink Coder 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!