LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Populate input array with spreadsheet values

Solved!
Go to solution
Is it possible to populate an input array with values from a text or spreadsheet file? If so, how is it done?
0 Kudos
Message 1 of 13
(4,416 Views)
In the 'String' palette, you can find the function : Spreadsheet string to array
Message 2 of 13
(4,415 Views)
To be more exact, I need to populate an array control with values from a file.
0 Kudos
Message 3 of 13
(4,394 Views)

Hi Joseph,

 

"to be more exact":

load the [text] file and use "spreadsheet string to array" (older LV versions) or use "read spreadsheet file" (LV8+) Smiley Wink

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 13
(4,371 Views)

If there are several types in your file unit element and you want to use 'Spreadsheet string to array', the easiest way is to reformat your data as 2D String array and to work after line by line (or column). For example,

 

SpeadSheetStringToArray.png

0 Kudos
Message 5 of 13
(4,363 Views)
An array control has an output but no input so "Read from spreadsheet file" will not work. When I use a property node (Array Element.Value) to populate the array control it fails and returns the error message "LabVIEW:  The data type of the variant is not compatible with the data type wired to the type input."
0 Kudos
Message 6 of 13
(4,360 Views)

Hi Joseph,

 

what about using a local of the array control? Show code...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 13
(4,356 Views)
Solution
Accepted by Joe_V
Many thanks to GerdW and all who replied. Populating an array control using a local variable with "Read from spreadsheet file" as it's input works perfectly.
0 Kudos
Message 8 of 13
(4,338 Views)

Hi Joseph,

 

I don't want to be picky, but marking your answer as solution doesn't feel right Smiley Wink

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 13
(4,317 Views)

Hi Gerd,

 

Please forgive my mistake. You deserve credit for the solution to my post.  Your pickyness has improved my forum etiquette.

 

Thanks Again,

Joe

0 Kudos
Message 10 of 13
(4,291 Views)