08-19-2019 03:06 PM
Hello all,
I have been facing a slight issue while using search 1d array in my code.
I use a text file with multiple columns, I use one column to get the index of that row to send values from a different column. This works fine as long as the element that is being searched is not zero.
When the element is 0 then the index is sent out as -1 affecting the logic, need some help fixing that.
Thanks a lot.
08-19-2019 03:12 PM - edited 08-19-2019 03:13 PM
We cannot help unless you attach your VI and some data. How do you read the file (A string with multiple columns is not an array!) What are typical values of the elements, e.g. element 0? Could it be there are hidden characters (change string to \-codes display to check).
08-19-2019 03:18 PM
-1 means it wasn't found within the array. Is it in the array? to altenbach's point data really matters here. For example if its a string array containing "0.00" and you search for "0" it's not an exact match. and therefore says that it couldn't find what you're looking for.
08-19-2019 03:37 PM
I have added the snippets of the code and the file I use to search and send.
08-19-2019
03:42 PM
- last edited on
05-06-2025
06:02 PM
by
Content Cleaner
These are not snippets, just useless truncated pictures. Attach the VI and data file!
Why are there so many local variables? What's the value of "PLT" and where does it come from??
You are dealing with DBLs, not strings, so all limitations of doing equal comparisons on DBls apply, of course.
08-19-2019 04:00 PM
I have attached the VI, please find the attached.
08-19-2019 04:02 PM
We also need a datafile to read.
08-19-2019 04:03 PM
Data file used in the VI
08-19-2019 04:20 PM
We are also missing all your subVIs. What's the value coming out of "line sensor" cluster element.
Please boil down the problem to something simple, e.g. as follows: Make sure the string control has the exact value.
Also note that your file has a header row. Are you accounting for that?
08-19-2019 04:43 PM
This is based on some parsing using the serial data coming from the device I am using. I am trying to send the values runtime using some data coming from the device.
These are the two sub VI's. The Line sensor value coming from the cluster is parsed from a logline coming from the device.