I found an answer by myself. The *_make_rtw_hook.m shall have the TARGET name and NOT the MODEL name. That is, MyModel_make_rtw_hook.m will not work, MyTarget_make_rtw_hook.m will work.
Hook functions for RTW
16 views (last 30 days)
Show older comments
Hi all, I followed the guide for specifying a RTW hook function (namely I copied the ert_make_rtw_hook.m in my path and edited it at my convenience). All I want to do is to move MyModel.trc from my current folder to C:\FolderB at the end of the building process. Therefore, edited the part of code related to the 'exit' phase. What happens at the end of the building process is... nothing. How can I solve it?
Here is how my MyModel_make_rtw_hook.m
function MyModel_make_rtw_hook(hookMethod,modelName,rtwroot,templateMakefile,buildOpts,buildArgs)
switch hookMethod
case 'error'
msg = DAStudio.message('RTW:makertw:buildAborted', modelName);
disp(msg);
case 'entry'
msg = DAStudio.message('RTW:makertw:enterRTWBuild', modelName);
disp(msg);
option = LocalParseArgList(buildArgs);
if ~strcmp(option,'none')
ert_unspecified_hardware(modelName);
cs = getActiveConfigSet(modelName);
cscopy = cs.copy;
ert_auto_configuration(modelName,option);
locReportDifference(cscopy, cs);
end
case 'before_tlc'
case 'after_tlc'
case 'before_make'
case 'after_make'
case 'exit'
if strcmp(get_param(modelName,'GenCodeOnly'),'off')
msgID = 'RTW:makertw:exitRTWBuild';
else
msgID = 'RTW:makertw:exitRTWGenCodeOnly';
end
msg = DAStudio.message(msgID,modelName);
disp(msg);
% Move MyModel.trc into C:\FolderB
movefile MyModel.trc 'C:\FolderB'
end
% Simple parse function to find:
% optimized_fixed_point=1
% optimized_floating_point=1
function option = LocalParseArgList(args)
if strfind(args,'optimized_fixed_point=1')
option = 'optimized_fixed_point';
elseif strfind(args,'optimized_floating_point=1')
option = 'optimized_floating_point';
else
option = 'none';
end
% local function: report difference between the configuration set settings
% before and after running auto-configuration script.
function locReportDifference(cs1, cs2)
[iseq, diffs] = slprivate('diff_config_sets', cs1, cs2, 'string');
if ~iseq
msg = DAStudio.message('RTW:makertw:incompatibleParamsUpdated', diffs);
summary = DAStudio.message('RTW:makertw:autoconfigSummary');
rtwprivate('rtw_disp_info',...
get_param(cs2.getModel, 'Name'),...
summary,...
msg);
end
Answers (1)
MATLAB_atian
on 16 Nov 2017
Hi can you give me your guide editing the hook function
2 Comments
Laszlo Dombai
on 16 Jan 2020
Search for the next text in Matlab Help:
"Customize Build Process with STF_make_rtw_hook File"
See Also
Categories
Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!