How to programatically update many CAN Pack blocks

1 view (last 30 days)
Hello, I'm currently using VNT with Matlab 2011b, I have an issue related with the CAN Pack block, similar to the issue related in this post:
I'm trying to apply the script apply_CAN_block(gcb) sequentially to update programatically different CAN Pack blocks, however, is not working as intended, when the scripts is called many times it fails to update all the different CAN Packs. It seems to be a problem with synchronization.
Below you can find the code I'm trying to use with the .p function
function name = configure(sys,i)
x = 30;
y = 30;
w = 300;
h = 300;
offset = 300;
BUS = 'HS1';
CAN_DBC_Path = 'C:\Users\edorant1\Documents\MATLAB\CAN_DBC\P552_R05\';
Msg = 'ABS_BrkBst_Data_HS1';
pos = [x y+h/4 x+w y+h*.75];
tic
name=strcat('/In',num2str(i));
add_block('MdlBuilderLib/CAN Pack',[sys name],'Position',pos);
set_param([sys name],'DataFormat','CANdb specified signals');
set_param([sys name],'CANdbFile',[CAN_DBC_Path,BUS,'.dbc']);
set_param([sys name],'MsgList',Msg);
apply_CAN_block([sys name]);
pause(0.01);
name = [sys name];
toc
end
cuenta.a = [];
cuenta.b = [];
cuenta.c = [];
cuenta.d = [];
cuenta.e = [];
cuenta.f = [];
cuenta.g = [];
cuenta.h = [];
cuenta.i = [];
cuenta.j = [];
cuenta.k = [];
cuenta.l = [];
cuenta.m = [];
cuenta.n = [];
cuenta.o = [];
cuenta.p = [];
cuenta.q = [];
cuenta.r = [];
cuenta.s = [];
cuenta.t = [];
cuenta.u = [];
name = cellfun(@(i) configure(sys,i),fieldnames(cuenta),'UniformOutput', false );
please let me know any idea to solve this problem .
Antonio Beltran

Answers (0)

Community Treasure Hunt

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

Start Hunting!