From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Build and search a text array error log problem

Solved!
Go to solution

I have a serial controlled instrument that I can query for a status and error code.  There are maybe 10 possible error codes to look for.  I can parse the instrument text string using string subset to get the error code letter/symbol from the return string.  I created a text array and a used search 1D array to match the error library in the array.  The problem is the search array doesn't match the error code correctly for all searches.  In trying to figure it out I created a test VI to troubleshoot the problem without needing the instrument,  see attached.  The search seems to work for every array element except for element 4, "g".  I can't figure out the reason it doesn't match a search for the letter "g". 

 

I have two questions: first is this approach of building a error code table as a text array, then searching the array for a match a good way to go? Or is there a better approach to converting the instrument error string into a user alert error code?

 

Second, What did I do wrong where the array search for "g" doesn't match?

Danny
0 Kudos
Message 1 of 5
(2,570 Views)
Solution
Accepted by topic author dannyjhu

FAIL_gFAIL_g

Remove 0I below 'g' and everything will run fine. 

0 Kudos
Message 2 of 5
(2,567 Views)
Solution
Accepted by topic author dannyjhu

It's not a simple g. Right-click on any array element and select '\' Codes Display to view the real string.

Alternatively, expand the element vertically.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 3 of 5
(2,566 Views)

Thanks for the help.  I didn't think to expand the cell or display the \code.  Feeling a little stupid now.  

Danny
0 Kudos
Message 4 of 5
(2,557 Views)

Hi,

 

       These are the basics "Search element in an array". If its returning "-1" either there's no element or its your case.

0 Kudos
Message 5 of 5
(2,550 Views)