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

1 回表示 (過去 30 日間)
Abeshek Ram Natarajan
Abeshek Ram Natarajan 2018 年 3 月 21 日
回答済み: Wilson A N 2018 年 5 月 4 日
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.

回答 (1 件)

Wilson A N
Wilson A N 2018 年 5 月 4 日
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

カテゴリ

Help Center および File ExchangeDiscrete-Event Simulation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by