04-13-2018 07:38 AM
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?
Solved! Go to Solution.
04-13-2018 07:49 AM
FAIL_g
Remove 0I below 'g' and everything will run fine.
04-13-2018 07:49 AM
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.
04-13-2018 07:56 AM
Thanks for the help. I didn't think to expand the cell or display the \code. Feeling a little stupid now.
04-13-2018 08:02 AM
Hi,
These are the basics "Search element in an array". If its returning "-1" either there's no element or its your case.