01-01-2023 08:47 AM
Hi. I'm stuck to find 1d array. Previously I have successfully created for searching string array, for this time I try to find it in by numeric. I attach a picture for search string array code that I've done before.
For the search numeric array, I try to do the same thing with search string array but now I'm stuck.
I'm sorry if my question is silly but I hope you guys can give me a suggestion and I can learn a new things for this part 😄
01-01-2023 09:42 AM - edited 01-01-2023 09:43 AM
Hi SofeaNur,
@SofeaNur wrote:
Hi. I'm stuck to find 1d array. Previously I have successfully created for searching string array, for this time I try to find it in by numeric. I attach a picture for search string array code that I've done before.
For the search numeric array, I try to do the same thing with search string array but now I'm stuck.
I'm sorry if my question is silly but I hope you guys can give me a suggestion and I can learn a new things for this part 😄
From your images I guess you want to search the array for elements which contain your search item - atleast that's what your string search does.
Now you want to implement the same for U32 values: find U32 values that contain a certain digit/number (in their decimal notation)?
Then this will do the trick:
Please do some more basic LabVIEW learning! Learn about using autoindexing in loops, learn about those different tunnel modes available since ~10 years, learn…
01-01-2023 10:51 AM - edited 01-01-2023 11:14 AM
Your blue code has no resemblance to your pink code, thus it will of course not work.
Creating an output array with all the same number seems a bit boring and redundant. More interesting would be the indices where the elements were found or even just the number of matches.
Here's what I would probably do. try it!
(Be aware that if the datatype is DBL, thing might become more tricky because equal comparisons are dangerous.)
Note that your old string code does NOT find elements that match the search string, but all elements that contain the search string. For example if you search for "cde" and one of the array elements is "abcdefg", it will be a match. Not sure if you really want that. Maybe as a first step you should exactly define what you are searching for in the numeric version. For example if one number is 12345 and you search for 45, should that be a match or not? If yes, uses Gerd's code.
A few more comments to your attached code:
General:
Front panel:
Diagram: