フィルターのクリア

How to check if a key is pressed in each iteration in simulink?

2 ビュー (過去 30 日間)
Ehsan Asadi
Ehsan Asadi 2011 年 10 月 1 日
Hi, I am controlling a system using simulink (analog input and output of real time toolbox) in which at each iteration I need to check if a key (for example "L" is pressed) and if the is key is pressed then the system do some extra things, For example I can create an embedded block and use an "if" statement to check if the "L" key is pressed. BUT I DO NOT know how to have access to key variable. by the way, "input" command is of NO use because it cease the simulation. Please help me out.

採用された回答

Kaustubha Govind
Kaustubha Govind 2011 年 10 月 3 日
I don't think this functionality is available in MATLAB, but you should be able to find an OS-specific API in C/C++ that lets you query this. For example, see Windows API Reference.
Once you have found the appropriate function, you can write a simple S-function to call into the API during simulation, or use the coder.ceval (formerly eml.ceval) directives to generate code that calls into the appropriate function from an (Embedded) MATLAB Function block.

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by