LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading characters and numbers

Hi,

 

I am doing a program where I have to make my vi read serial numbers, which includes both characters and numbers. And my numbers are very long.

ex:

INPUT:  A 000 132 23 21 PQR 001

OUTPUT: A 005 446 53 40

 

I use a Read from spreadsheet function to read my excel spreadsheet of expected input. It is connected to a Search 1D array where user inputs the element they want to search for. the output of this is connected to an Index Array function and another array (output from another Read from spreadsheet file function) is wired as input to this. This work for Double integers but does not for my number when it is long or long with charactors. 

 

When I ommit the charactors and input just the numbers (long), it outputs a fractional number with decimals because my output number starts with a bunch of zeros.

 

Any help would be really appreciated!

 

 

 

0 Kudos
Message 1 of 10
(3,197 Views)

Can you please attach your VI?

0 Kudos
Message 2 of 10
(3,195 Views)
0 Kudos
Message 3 of 10
(3,190 Views)

Hi yeshani,

 

now it would be nice to have those two CSV files too!

 

How should we debug your VI without data files?

 

- Did you select the correct delimiter char?

- Why do you read spreadsheet files, that contain text, as DBL files?

Best regards,
GerdW


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

Well, first of all the letters cannot be converted into numbers.

 

Can you have the Read Spreadsheet File output an array of strings and then search for the 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 5 of 10
(3,174 Views)

My first file (input) contains numbers similar to these:

A0001502780PQR001

 

A0001502780PQR002

    

A0001502780PQR003

 

Second file contains the same type of numbers.

 

If I read the files as text and string, the Index Array function doesn't let me read the element.

0 Kudos
Message 6 of 10
(3,161 Views)

When I do string instead of Double, the Search 1D array doesn't accept my element.

0 Kudos
Message 7 of 10
(3,160 Views)

Sorry it should be the Search 1D array that does not accept the element, not the Index Array.

0 Kudos
Message 8 of 10
(3,159 Views)

Then convert the number to a string before searching.

 

But the real question is why are there alphabetic characters in a spreadsheet that is supposed to be numbers?


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 9 of 10
(3,157 Views)

@crossrulz wrote:

Then convert the number to a string before searching.

 

But the real question is why are there alphabetic characters in a spreadsheet that is supposed to be numbers?



Might it not be more appropriate to use the "Read Lines From File" follwed by a "Spreadsheet String to Array?"

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 10
(3,144 Views)