File Exchange Pick of the Week

Our best user submissions

Simulink Keyboard Input v2

Will's pick this week is Simulink Keyboard Input v2 by Emanuele Ruffaldi.

I have streamed data into Simulink models from webcams, microphones, and other hardware sensors. But until I came across Emanuele's File Exchange submission, I had never typed a message to Simulink. This package provides a Level-2 MATLAB S-function and example model demonstrating how to incorporate it into Simulink. When the model is started, a figure window opens. If the figure is your active window, then whatever you type gets converted to a Simulink signal.

The data are received as scalar doubles that correspond to the ASCII code for the character entered. The model was developed prior to the Simulink Strings in 2018. I added a Data Conversion and ASCII to String block to the example model, which enabled me to work directly with characters entered. The Scope (which shows the numeric values with respect to simulated time) may be difficult to decipher, but Simulation Data Inspector displays the string values. Note that I wrapped the text to reduce the width of the image.

I'd love to see this submission elaborated upon. Is there a way to eliminate the figure window, possibly with use of a C S-function? Could it be modified to support variable-sized arrays such that it captures everything the user enters before a sufficient pause in input or a carriage return? Some interesting ideas to think about, but a wonderful contribution in its present form!

Let us know what you think here or leave a comment for Emanuele.
  • print


要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。