How to find a source block that goes through a goto/from block?

I am trying to write a script that will list out all elements on a bus that are consumed within a model. To do this, I used find_system to find all the bus selector blocks. I was able to get all the elements being selected. I am assuming buses are inputs to the model and aren't created and read from within the same model. To trace from the bus selector back to the input port, I was using:
portC= get_param(busSelectors(i),'PortConnectivity');
busSelSrc = portC{1}.SrcBlock;
However, 'From' blocks only appear to have DestBlock field filled in and source is empty. I'm not sure how to trace 'From' -> 'Goto' block from a script.
Here is an example output where CL_e2a_sl is model name. aiAD is bus name and signal impact_press_sel from that bus is getting read in that model.
****************************
Processing: CL_e2a_sl
aiAD.impact_press_sel
aiPF.body_lat_accel_compl_filt_e4
aiSM.along_track_accel_sel
aiSM.cross_track_accel_sel
******************
I am using Matlab2017a right now if that helps.

 Accepted Answer

I have a work around that I can get by with. I temporarily turn on signalPropagation and get the name from that.
lh = get_param(busSelectors(i),'LineHandles');
prevLH_state = get(lh{1}.Inport, 'signalPropagation');
set(lh{1}.Inport, 'signalPropagation', 'on');
name = get_param(busSelectors(i), 'InputSignalNames');
name = string(name);
name = erase(name, '<');
name = erase(name, '>');
set(lh{1}.Inport, 'signalPropagation', prevLH_state);

More Answers (0)

Categories

Products

Community Treasure Hunt

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

Start Hunting!