formatting strings

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Submitted by pdickens on Mon, 02/27/2012 - 04:06 

Is there any way to format strings in VisSim? Specifically, I would like to take the output from the timeOfDay block (i.e. integers representing the year/month/day/hour...) and produce a formatted string from the integers to represent the time (e.g. 10:34:21 am). The timeStamp block can output a string, but I need to process and/or store the values before display, so timeStamp won't work.

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2020

    Submitted by a_a on Mon, 02/27/2012 - 22:28.

    Try to convert the values into strings and then use the summingJunction to make the representation you need. The attached diagram will give you the hint.

    Unable to find an attachment - read this blog

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by pdickens on Mon, 03/12/2012 - 08:35.

    Thanks a_a, I hadn't thought of using the summing block to concatenate strings - but it makes sense. Just had to add some logic to pad with zeros when the h, m or s variable is less than 10.