Configure the Prelookup Block to Output Index and Fraction as a Bus

This example shows how to output a bus containing the index (k) and fraction (f) from the Prelookup block. The bus object can then be used as an input to the Interpolation Using Prelookup block. The example also shows how to get the same results without using a bus object.

Open and simulate the model.

ans = 

  Simulink.SimulationOutput:
                   tout: [11x1 double] 
                   yout: [1x1 Simulink.SimulationData.Dataset] 

     SimulationMetadata: [1x1 Simulink.SimulationMetadata] 
           ErrorMessage: [0x0 char] 

At the top of the model, open the dialog box for the Prelookup block. In the Main tab, note that Output selection is set to Index and fraction as bus. In the Data Types tab, note that Output is set to Bus: myBus. In the Simulink® Editor, select File>Model Properties and open the Callbacks tab. In the model's PreLoadFcn, the code defines the bus object myBus, which specifies the index as the first bus element and the fraction as the second element.

Open the dialog box for the Interpolation Using Prelookup block. In the Main tab, note that Require index and fraction as bus check box is selected. That option configures the block to use the bus output from the Prelookup block.