Programatically parametrize and 'refresh' CAN Pack and Unpack blocks
3 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!