From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

element in array to time format

Hello i am trying to convert a element in array to time format to plug into a build waveform. I tried a few functions but no luck

the data is coming from uart. If the data coming in is for example in the format

2,4,6,8,10,126050.76.

and the last number is the the time from the serial data cant figure out how to convert to time format that waveform will accept and the format the time is first two digits of last element hour,then next two minute, then next two seconds. and after the decimal milliseconds. I have attached code snippet the second subarray goes into timestamp fo waveform. The time also is in that format exact no colon in the middle of each.

0 Kudos
Message 1 of 11
(4,702 Views)

Try this


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 11
(4,685 Views)

That won't work cause first I have to index out the time from the string of 

values I use spreadsheet string to array to get comma out and convert to array then from there I split the array to get time and from there the time is being presented at double so i need to send the time to a time stamp format and also note the time is coming continuously and changing for as long as it sampled. 

0 Kudos
Message 3 of 11
(4,669 Views)

That scan from string always gives error also 

0 Kudos
Message 4 of 11
(4,668 Views)

This works based on the example you gave


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 11
(4,663 Views)

I not able to test the vi cause on the "spread sheet string to array" the array type outputs 2d double instead of string like yours also the "delete from array" also expects input double instead of string like yours. See my code. i dont know how to change.

0 Kudos
Message 6 of 11
(4,645 Views)
It would work if you actually used the functions as in the example. There, the conversion is to a 1D string array. Nowhere is there a 2D array. Look at the constant.
0 Kudos
Message 7 of 11
(4,600 Views)

I am using the example as is but what im saying is that on the array type for the spreasheet function its default is double orange wire and on the example his is pink wire and i dont know how to change that to string pink wire.

0 Kudos
Message 8 of 11
(4,592 Views)
You are NOT using the example as is. You are using YOUR code. The example has a string array as the constant. You simply drop a string constant into an empty array container.
0 Kudos
Message 9 of 11
(4,578 Views)

@muscles05 wrote:

I am using the example as is but what im saying is that on the array type for the spreasheet function its default is double orange wire and on the example his is pink wire and i dont know how to change that to string pink wire.


orange = floating point number

pink = string

 

So you just change the data type inside of the array constant to a string.  This will tell the Spreadsheet String To Array to output a 1D Array of Strings.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 11
(4,567 Views)