LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Search for a string

Hello!
It´s me again...
I´ve created a VI that outputs a sting with a filepath if an error has
occured. This is to be displayed on the screen when the measurement is
stopped.
So, this VI is located in a FOR loop. Enable indexing is active. I have
wired it to a SEARCH 1D ARRAY VI. I want to scan the Array/String for the
occurances of " 😕 " If 😕 occures, my intention is to display the full path
on the screen.
My question now is, what shall I type in my ELEMENT constant to the VI? The
path might be, for example, C:\NISSE\TEMP. I am only interested in the
occurance of 😕 because I don´t know the path they want to run this VI to...
TIA,
Peter Jansson,
Teracom Malmö
0 Kudos
Message 1 of 3
(1,619 Views)
Peter Jansson, Teracom Malmoe wrote:
> Hello!
> It´s me again...
> I´ve created a VI that outputs a sting with a filepath if an error has
> occured. This is to be displayed on the screen when the measurement is
> stopped.
> So, this VI is located in a FOR loop. Enable indexing is active. I have
> wired it to a SEARCH 1D ARRAY VI. I want to scan the Array/String for the
> occurances of " 😕 " If 😕 occures, my intention is to display the full path
> on the screen.
> My question now is, what shall I type in my ELEMENT constant to the VI? The
> path might be, for example, C:\NISSE\TEMP. I am only interested in the
> occurance of 😕 because I don´t know the path they want to run this VI to...
> TIA,
> Peter Jansson,
> Teracom Malmö

The short answer is that you can't do
it that way - search 1D array
will only match a whole element. You need to check for the error
inside the for loop. I would do this by using match pattern, checking
to see if the index is greater than or equal to zero, and outputing
that as a boolean array from the for loop. You can then OR all the
elements of the boolean array to determine if an error occurred, and
if it did, search in the boolean array for the first true value to
find the index of the corresponding string.
--
******************************************************************************
Gavin Burnell Dept. Materials Science and Metallurgy
Device Materials Group University of Cambridge, UK
******************************************************************************
--
Gavin Burnell
Condensed Matter Physics Group, University of Leeds, UK
http://www.stoner.leeds.ac.uk/
0 Kudos
Message 2 of 3
(1,619 Views)
Hi,

Just create a VI, that reimplements the Search-1D-Array in general. But: instead
of comparing two strings using LabVIEW, you should use a Call-Library-Function
to use the sandard
char *strstr(char *str1, char *str2)
function. It's avaliable in e.g. Msvcrtd.dll and Msvcrt.dll (Windows) or libc
(Unix)...
This new VI will work for any string that should NOT be interpreted as regular
expression. For regular expressions '\' is already a special character...

Jens-Achim

"Peter Jansson, Teracom Malmoe" schrieb:

> Hello!
> It´s me again...
> I´ve created a VI that outputs a sting with a filepath if an error has
> occured. This is to be displayed on the screen when the measurement is
> stopped.
> So, this VI is located in a FOR loop. Enable indexing is active
. I have
> wired it to a SEARCH 1D ARRAY VI. I want to scan the Array/String for the
> occurances of " 😕 " If 😕 occures, my intention is to display the full path
> on the screen.
> My question now is, what shall I type in my ELEMENT constant to the VI? The
> path might be, for example, C:\NISSE\TEMP. I am only interested in the
> occurance of 😕 because I don´t know the path they want to run this VI to...
> TIA,
> Peter Jansson,
> Teracom Malmö
0 Kudos
Message 3 of 3
(1,619 Views)