06-28-2011 02:09 PM
Hi all,
Can anyone help me with the attached VI? The "Search 1-D Array" does not seem to be searching. The output is always -1, when I know that my data from my excel sheet that I am reading from contains the number 193.3359. I intend to find how many rows in my excel data contains the number 193.3359, and I would like an output array to copy each row & all it's info. (example: if there were 6 rows that contain the number 193.3359, i would like all 6 rows show up in the output array).
Thank you for your help. I do not have a sample of my data, but it's about 2,000 rows and 10 columns. They contain numbers & words. Here I am just searching for a number.
06-28-2011 02:24 PM
Can you attach a shortened version of your data file?
06-28-2011 02:26 PM
I'm guessing that you have a precision issue.
Are you sure that the number is coming back as 193.3359 and not 193.335899999?
06-28-2011 02:29 PM
Also, for code simplifictions you should...
06-28-2011 02:30 PM
Yes I can. Here is something similar to it. (a few more columns and many more rows of data) In my previous post I was searching for 193.3359 under the T(sec) column, so let's say for this sample of my data I am searching for T(sec) = 6.1924.
Thank you!
06-28-2011 02:31 PM
Well the vi you uploaded worked with test data I used, though there are a couple issues. The reason -1 keeps showing up is that when you run the vi essentially what you are seeing is the result for the last search you did, in which case, if the last row does not contain that value then you will see the -1, which indicates no index. That numerical value also only indicates the index where the value was found, so unless you need to know that information, you don't need it. Also, I had to remove the comma as the delimiter for my data as mine is tab delimited, but idk if you're data is in the form of csv or tab delimited but that could be an issue.
06-28-2011 02:32 PM
You are running into rounding errors (most likely) This might work better
06-28-2011 02:33 PM
@Taki1999 wrote:
I'm guessing that you have a precision issue.
Are you sure that the number is coming back as 193.3359 and not 193.335899999?
No, he's searching for raw strings so this cannot be it. This would be an issues with e.g. DBLs
Some other guesses:
06-28-2011 02:36 PM
That's an Excel file. Read From Spreadsheet does not read Excel - only plain text.
06-28-2011 02:37 PM
Hmm, I was told it does, but they could be wrong, what would I use to read data from excel?