LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating an array from 1 2D array of numbers and 1 1D array of timestamp values

Solved!
Go to solution

Programming_beginner_0-1690796025885.png

Programming_beginner_1-1690796037448.png

How do you combine both  the array and the timevalues? Both have the same number of rows but I am not sure how to combine so that I can output a csv file. Thank you. (I transpose the 2D array so that it has 3 columns of y data points, with y number of timestamps)

 

0 Kudos
Message 1 of 6
(1,140 Views)
Solution
Accepted by Programming_beginner

Hi beginner,

 


@Programming_beginner wrote:

How do you combine both  the array and the timevalues? Both have the same number of rows but I am not sure how to combine so that I can output a csv file. Thank you. (I transpose the 2D array so that it has 3 columns of y data points, with y number of timestamps)


Simple solution: convert to timestamp array to a DBL array using the ToDBL function. Then prepend the additional row/column as discussed in your other thread(s)!

Warning: this result may not fit with your requirements as it converts the timestamp to the number of seconds since LabVIEW epoch.

 

So what are your requirements?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(1,137 Views)

will try that. Thank you.

0 Kudos
Message 3 of 6
(1,130 Views)

Programming_beginner_0-1690852013533.png

 

Programming_beginner_2-1690852040979.png

 

Here are my timestamp values. If I use a DBL function, it just outputs an array of constant numbers.

Programming_beginner_3-1690852199901.png

Programming_beginner_4-1690852237805.png

Is there any other way?

0 Kudos
Message 4 of 6
(1,079 Views)

Also, I would like to insert a column heading (1D array of strings), but the data type just doesn't match.

EDIT: Just decide to call multiple write to csv (one for string type, then the other with just numeric data with append set to True)

0 Kudos
Message 5 of 6
(1,075 Views)
Solution
Accepted by Programming_beginner

Hi Beginner,

 


@Programming_beginner wrote:

Here are my timestamp values. If I use a DBL function, it just outputs an array of constant numbers.


Did you read my previous message carefully?

I explained "Converting timestamps to DBL gives the number of seconds since LabVIEW epoch" - do you understand that sentence? Did you read the LabVIEW help on timestamps?

(And no: when the timestamps differ, then you will NOT get an array of constant numbers.)

 


@Programming_beginner wrote:

Is there any other way?


I asked for your requirements, but you didn't provide them!

You can also convert the timestamps to strings: I recommend to read ISO8601…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 6
(1,057 Views)