LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Match specific string (Hex 2E2E)

Solved!
Go to solution

I have a file I need to process, a nice simple function to create.

Read in file, find part of file with certain data string in it, create data array output in expanded format and save to spreadsheet file (e.g. csv will do)

 

Here is the problem, the data is in the format:

 #PS0,#PS1,#PS3,#c3..31,#c34..126

 

(I can remove the # and , no probs. The bit that's killing me is that I need to expand the array from c3 to c31. A match pattern will never find ".." beacuse "." is a special character in both match pattern and match regular expression -  Thanks NI.)

 

I can sort of locate it using the split string function, but this wont do what I want very efficiently, so has anyone got any ideas for a more efficient way around this problem?

 

Cheers

 

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 1 of 8
(3,693 Views)
Solution
Accepted by topic author James_W

Hi James,

 

try this:

FindDots.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 8
(3,685 Views)

Genius!!!

 

I learn something new everyday.

 

Danke

 

James

 

...now if I could just work out how to open snippets in LV2009...

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 3 of 8
(3,673 Views)

James,

 

I see you have a solution already, but here's a VI I already made.

Just in case you're not already way past this point.

Also attached is one subVI from my user.lib it calls.

Yes, I was a little bored this AM.

 

 

James

 

 

LabVIEW 5.0 seems so long ago...
Download All
0 Kudos
Message 4 of 8
(3,662 Views)

Thanks for the feedback James,

 

Nice method  

I have attached a snippet of my implementation to show you how I went about it.

Generate_array.png 

 

Personally I prefer to avoid the string functions which can generate errors when I can as they can occasionally cause unexpected behaviour, so you will see a bit more overhead in this approach I have done, but this is not a problem.

 

2 points I notice: -

1) you have a massive overhead compared to my VI (if you were going for efficiency) with the way you implemented the case structure,

2) in case you have missed it, there is a single finction on the comparisson pallete that does the "Empty string" comparisson - might make your subVI more compact if you ever wanted it.Smiley Wink

 

Cheers

James

 

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
Message 5 of 8
(3,654 Views)

James,

 

That's a nice solution.

From your code, I see you've already eliminated and don't need the # characters.

Also, I see that prefixes with numeric ranges are limited to a single prefix character.

I thought, from the example, prefixes might contain variable length alpha characters (i.e. #PS1).

 

1) Is it "Scan From String" that adds massive overhead?  Or is it something else?

 side-by-side.png

 

2) *giggle* Yes, that subVI looks bad...  I hadn't opened that diagram in many years (created in '01).  I've created 100s of user.lib VIs over the last 10 years ago and haven't reviewed them.  My user.lib looks similar to the OpenG library, but different functions and none green.  Some of those that I created as a LV beginner obviously need some review & cleanup!!

 

Thanks for sharing your solution and the feedback on mine.

 

James

 

LabVIEW 5.0 seems so long ago...
Message 6 of 8
(3,644 Views)

Hi James, 

 

It's the case structure's and it's undefined cases...

I have only 2 possible cases T & F

you have -1 and 1,(default) - the numeric in the case structure will never be handled as fast as a boolean input as it has to determin which case to go to if the numeris is not one of the defined cases, you also have a potential I32 cases instead of 2 to search through.

 

James

 

Edit : yup i forgot/didn't bother to mention that I didn't need to handle the alpha chars PSn and every other one will be Xnn

Message Edited by James W on 05-05-2010 01:58 PM
CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 7 of 8
(3,619 Views)

James,

 

Thanks for the feedback.

I did not realize this would be a big performance hit; just hadn't given it a lot of thought. 

At first, it seems as there are only two choices with my logic as well (-1 or default).

But, that must not be the way LabVIEW handles it? 

In the future I'll remember to drop in the >0 so my cases are just T/F.

 

Thanks again,

 

James

LabVIEW 5.0 seems so long ago...
0 Kudos
Message 8 of 8
(3,610 Views)