[1729] | 1 | %Script assumes the OFDM PHY model is open and is the current model |
---|
| 2 | |
---|
| 3 | subsys = '/OFDM Rx MIMO/Equalizer & Packetizer/Packet_Constructor'; |
---|
| 4 | fec_dec = find_system([bdroot subsys], 'block_type', 'blackbox2'); |
---|
| 5 | fec_dec_h = get_param(fec_dec, 'Handle'); fec_dec_h = fec_dec_h{1}; |
---|
| 6 | orig_pos = get(fec_dec_h, 'Position'); |
---|
| 7 | orig_init = get(fec_dec_h, 'init_code'); |
---|
| 8 | orig_sim = get(fec_dec_h, 'sim_method'); |
---|
| 9 | |
---|
| 10 | oldind = str2double(fec_dec{1}(end)); |
---|
| 11 | |
---|
| 12 | %Adding then deleting will "fix" the problem |
---|
| 13 | fec_dec_new_h = add_block('xbsIndex_r4/Black Box', [bdroot subsys '/fec_decoder ' num2str(oldind+1)], 'init_code', orig_init); |
---|
| 14 | set(fec_dec_new_h, 'sim_method', orig_sim'); |
---|
| 15 | delete_block(fec_dec_h); |
---|
| 16 | |
---|
| 17 | %Deleting then adding will *not* fix it |
---|
| 18 | %delete_block(fec_dec_h); |
---|
| 19 | %fec_dec_new_h = add_block('xbsIndex_r4/Black Box', [bdroot subsys '/fec_decoder 2'], 'init_code', orig_init); |
---|
| 20 | %set(fec_dec_new_h, 'sim_method', orig_sim'); |
---|
| 21 | |
---|
| 22 | %Place the new block where the old one was, auto-connecting all ports |
---|
| 23 | set(fec_dec_new_h, 'position', orig_pos); |
---|
| 24 | |
---|
| 25 | save_system |
---|