フィルターのクリア

Relational Operator with Counter

3 ビュー (過去 30 日間)
Raghu Vamsi
Raghu Vamsi 2019 年 12 月 23 日
編集済み: Payas Bahade 2019 年 12 月 27 日
Hi,
I am using the following attached example in one of my model witha relational operator. I would like to count the result of the relational Operator. Since the output is boolean, i am unable to use cumulative sum, could someone help me to solve this problem.
All i want is whenever the result of the operator is True, I want the counter to start counting as 1. If the system result has reached or crossed 1 say like 10 times then i would like the counter to report the result as 10 (cumulation of no of time the relational operator is True).
Thank you
Regards
Raghu

採用された回答

Payas Bahade
Payas Bahade 2019 年 12 月 26 日
編集済み: Payas Bahade 2019 年 12 月 27 日
Hi Raghu,
As output of 'Relational operator' is boolean, it first needs to be converted to double before sending it to 'Cumulative sum block'. Conversion can be done using 'Data conversion block' in which you need to specify the required output data type. I have attached a sample model 'RelationalOperatorCounter_1' for your reference.
If you have any problem with this model, you can try 'RelationalOperatorCounter_2'. For more details on 'Cumulative sum block', refer this documentaion link.
Hope this helps!

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeModeling についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by