09-13-2012 08:12 AM
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!
09-13-2012 08:22 AM
Can you please attach your VI?
09-13-2012 08:27 AM
Here is my vi.
09-13-2012 08:29 AM - edited 09-13-2012 08:30 AM
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?
09-13-2012 08:35 AM
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?
09-13-2012 09:13 AM
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.
09-13-2012 09:15 AM
When I do string instead of Double, the Search 1D array doesn't accept my element.
09-13-2012 09:16 AM
Sorry it should be the Search 1D array that does not accept the element, not the Index Array.
09-13-2012 09:28 AM
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?
09-13-2012 10:29 AM
@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?"