Programatically parametrize and 'refresh' CAN Pack and Unpack blocks
3 次查看(过去 30 天)
显示 更早的评论
I am trying to automate some processes and programatically create a model that contains CAN Pack and Unpack blocks.
When I parametrize the mask parameters in the script, the output is as attached in the image (Message Name and dbc appear correctly, is there a way to -
- Emulate mask button press 'OK' or 'Apply' so the input ports are generated without human intervention? OR
- Pass the mask params to underlying S-func so it updates the block?
mdlname = 'Trial_VCCU';
new_system(mdlname);
open_system(mdlname);
x = 100;
y = 100;
msgname = 'VCVCCU_ChargeToVehicle';
file = 'C:\repos\VECU IO\EV_CAN.dbc';
canmsglib = 'canmsglib/';
unpack = [canmsglib 'CAN Unpack'];
pack = [canmsglib 'CAN Pack'];
msgpack_hndle = add_block(pack, [mdlname '/' msgname '_Pack']);
set_param(msgpack_hndle, 'Position',[x, y, x+1000, y+600],...
'DataFormat', 'CANdb specified signals', 'CANdbFile', file, 'MsgList', msgname);
Current ouput - A.
Preffered output - B.
Thanks in advance!
Have referred to this but would prefer another solution if it has been found-
https://www.mathworks.com/matlabcentral/answers/294355-how-can-i-click-on-ok-or-apply-button-programmatically
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!