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: 

overwrite an String

Solved!
Go to solution

is there any way to overwrite an String? I mean, like in any programming language when you do:

 

String data = "abc";

data = "zxc";

 

I'm trying to get substrings from a initial string like "123.456.789.432.567" separating them by the '.' character, and when at the first iteration I get "123" I don't know how to init the second iteration with "456.789.432.567" as I can't change the initial string the process gets.

 

Thanks

0 Kudos
Message 1 of 9
(2,782 Views)

I think you need a shift register in your loop to pass a value to the next iteration.  

 

And you also need this:

 

http://www.ni.com/academic/labview_training/

 

 

http://www.medicollector.com
Message 2 of 9
(2,768 Views)
You can certainly change the string or the offset with a shift register. You can also separate the string with a single Scan From String function.
Message 3 of 9
(2,767 Views)

How are you getting the first substring?  Search/Split String?  That function has an input to tell it where to start searching (offset).  It will also tell you where the match it found was.  Using those, you should be able to parse the data.

 

The way I would do it would be to use the Spreadsheet String To Array function with "." as the delimiter.  That will give you an array of the strings you want.  Use autoindexing tunnels or Index Array to get the one you want.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 9
(2,762 Views)

Please post what you have tried so far. It is much easier for us to help you learn by pointing out how to improve what you have than to just give you a solution.

 

Hint: Shift register and Match Pattern with after substring wired to the right shift register terminal will do most of what you want. There are several other ways which might be effective as well, depending on what else the program is doing with the data.  (Spreadsheet 
String to Array with period for delimiter for example).

 

Lynn

Message 5 of 9
(2,761 Views)
Solution
Accepted by topic author DiSCLAiMER

A quick detour through vi.llb\Advanced String\ might help a bit with this.

 

!00.png

but Crossrulz's method has merit too.

!00.png

That period can be a tricky delimiter! 

Spoiler
Kudos to anyone that explains why- Athough the LabVIEW Help file is helpfulSmiley Wink

 


"Should be" isn't "Is" -Jay
Message 6 of 9
(2,744 Views)

Regular Expressions wild cards.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
Message 7 of 9
(2,735 Views)

Jeff·Þ·Bohrer wrote:

but Crossrulz's method has merit too.


You don't need the Index Array in my solution if you actually wire a 1D Array of strings into the "array type" input of the Spreadsheet String To Array.

 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 9
(2,728 Views)

thank you guys, with all explained here I fixed the problem!

0 Kudos
Message 9 of 9
(2,681 Views)