Home Questions How to flexibly display text messages on screen?

How to flexibly display text messages on screen?

DWQA QuestionsCategory: Custom Task DevelopmentHow to flexibly display text messages on screen?
Xin Li asked 5 years ago
I am making a task where I am tracking the subject's points based on performance, and I would like to display the total number of points after each set of reaches. I am trying to use a Show_Target_With_Label block to display this text, but I need to modify the VCODE based on the actual number of points. I have tried using an ASCII Encode Simulink block to try to convert the points (double) to ASCII, and then replacing columns 15:64 of the VCODE, but it's not working. Any tips on how to do this?
Koloman Varady Staff replied 5 years ago

Hi Xin Li,

A good trick to get the ASCII value of a character is to do: double(‘a’)

To get the ASCII value of a single digit number (say n), I do: double(‘0’) + n

I’d recommend checking out the data visualization sample task https://kinarm.com/download/robot-data-visualization-demo/ – I write a lot of dynamic numbers and a modify a lot of label vcodes in that task.

Cheers,
Koloman

1 Answers
Xin Li answered 5 years ago
Hi Koloman, Thanks for the tip! I was able to make it work! Xin