LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using spreadsheet function to convert string to 1d array

Solved!
Go to solution

 

Hi Anjella,

 

so you want an array of digits of a number given as string? That's not possible with SpreadsheetstringToArray, but may be solved like this:

check.png(I reverted the order of digits as usually this is suited better for further processing...)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 21 of 51
(4,003 Views)

Thank you!)) This is the most simple solution.

0 Kudos
Message 22 of 51
(4,000 Views)

Ok i am trying to take data from a text file that consists of text and put it into an array. Then i want to be able to use the data to set some system settings. For example i am creating a text program that will connect with an lcr meter and take 22 points of measurements from the device im testing. so what im trying to do is create a file that will contain the name of the lcr meters and which gpib addresses belong to that machine. so my text file looks like this. 

 

Handler, 5

LCR 1, 12

LCR 2, 13

LCR 3, 14

LCR 4, 15

 

What i want to do is load this info into the program and be able to set my settings based off the numbers. EX Handler uses address 5. Iam trying to use spreadsheet string to array to fill up an array with the data and its complaining about two different types of data. its saying that one is array of double and the other is array of string. How do i set it so the data from the file gets set as a string? 

0 Kudos
Message 23 of 51
(3,957 Views)

Hi Tod,

 

could you attach your VI?

In the meantime: read the context help, then change the datatype input from it's default 2D array of DBL to a 2D array of strings... Smiley Wink

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 24 of 51
(3,950 Views)

I dont have a VI built yet im in the process of converting it over to Lab View from Visual Basic. Where do i find the tags to change the datatype? even doing a google search on it i dont find much info on where and how to do this.

0 Kudos
Message 25 of 51
(3,931 Views)

Hi Tod,

 

did you read the context help for "Read from spreadsheet file"? The first paragraph mentions "You must manually select the polymorphic instance you want to use."...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 26 of 51
(3,931 Views)

Im sorry i just realized what i was doing wrong i was trying to use read from text file and converting it to a spreadsheet. I did not realize that i could just use the read from spreadsheet and it will take the date from my text file... i got it work now

0 Kudos
Message 27 of 51
(3,929 Views)

Hi Tod,

 

you weren't "doing wrong". You should have read the context help for "convert spreadsheet string to array" - here you also have an "array type" input!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 28 of 51
(3,926 Views)

Ok so i have another problem. How can i take the data thats in the file and use it as a control to set gpib address for my devices.

 

For ex.

 

Array (Data taken from text file)

Handler (Tab) 6

LCR 1 (Tab) 3

LCR 2 (Tab) 4

 

I have this inputing into a indicator array on the main screen but what i need to do with the data is use it as the address control for write/read GPIB

0 Kudos
Message 29 of 51
(3,925 Views)

Hi Tod,

 

you could use IndexArray to get the GPIB address from the spreadsheet "cells". Then you should use a function to convert the string to a number - there are a lot of them in the string palette...

 

Btw.: You should use VISA functions instead of those "old" GPIB functions...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 30 of 51
(3,922 Views)