%Script assumes the OFDM PHY model is open and is the current model subsys = '/OFDM Rx MIMO/Equalizer & Packetizer/Packet_Constructor'; fec_dec = find_system([bdroot subsys], 'block_type', 'blackbox2'); fec_dec_h = get_param(fec_dec, 'Handle'); fec_dec_h = fec_dec_h{1}; orig_pos = get(fec_dec_h, 'Position'); orig_init = get(fec_dec_h, 'init_code'); orig_sim = get(fec_dec_h, 'sim_method'); oldind = str2double(fec_dec{1}(end)); %Adding then deleting will "fix" the problem fec_dec_new_h = add_block('xbsIndex_r4/Black Box', [bdroot subsys '/fec_decoder ' num2str(oldind+1)], 'init_code', orig_init); set(fec_dec_new_h, 'sim_method', orig_sim'); delete_block(fec_dec_h); %Deleting then adding will *not* fix it %delete_block(fec_dec_h); %fec_dec_new_h = add_block('xbsIndex_r4/Black Box', [bdroot subsys '/fec_decoder 2'], 'init_code', orig_init); %set(fec_dec_new_h, 'sim_method', orig_sim'); %Place the new block where the old one was, auto-connecting all ports set(fec_dec_new_h, 'position', orig_pos); save_system