How can I read data from a histogram in SimEvents (simulink)?

1 view (last 30 days)
All the available data is in the form of histograms. Therefore, there is a necessity to read the histogram data and incorporate it into the simulation in the SimEvents package in Simulink. I would like to know if this is possible in SimEvents.

Answers (1)

Wilson A N
Wilson A N on 4 May 2018
If you have the histogram object, then you can easily retrieve the required data. For example,
hHist = histfit( rand(100,1), 3, 'normal' )
hHist(1).YData
Here hHist is the histogram object. You can obtain the y values by using hHist(1).YData.
Now the following code can be kept in a MATLAB function block. Let the output of the MATLAB function block be the hHist(1).YData which is fed into a Simulink function block. Once the data reaches a Simulink function block, you can retrieve the data from any of the callbacks present in the various SimEvents blocks.
To understand how to use Simulink function blocks with SimEvents blocks, you can check the following example:
seExampleSchedulerBasic

Categories

Find more on Discrete-Event Simulation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!