LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI removing space

Solved!
Go to solution

I'm trying to make VI that will remove every space from input (by user string ). After I run it and write any text into system string nothing happen.

0 Kudos
Message 1 of 8
(2,399 Views)

It is difficult for us to edit a picture.  Please attach your VI.

 

Look at the string function "Search and Replace Psttern VI".  Combine that with a While Loop, a Shift Register, and one other function and you have a simple solution.

 

Bob Schor

0 Kudos
Message 2 of 8
(2,384 Views)
0 Kudos
Message 3 of 8
(2,367 Views)

Your input terminal is outside the loop, so it will get read when the program starts and then never again. Similarly, your indicator will only get updated once the loop stops because it is after the main loop. (You need to understand the principles of dataflow! Start with some basic tutorials)

 

All you need is the following. Place it all inside a while loop, together with a stop control and a small wait.

 

altenbach_0-1586656950706.png

 

There is no need for the FOR loop, of course. Since "replace all" has a True wired to it, all spaces will be replaced with an empty string.

Message 4 of 8
(2,352 Views)

What am i doing wrong, that it still doesn't work as it should?

0 Kudos
Message 5 of 8
(2,300 Views)

Hi hearent,

 


@hearen123 wrote:

What am i doing wrong, that it still doesn't work as it should?


I don't know. Your VI works for me as it removes any SPACE chars from the input string…

 

(I just removed this silly WHILE loop running forever!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 8
(2,296 Views)

Thanks for response, help and dedicated time.

 

How do you run and check this program? By 'run continuously, writing output text and clicking enter?

0 Kudos
Message 7 of 8
(2,292 Views)
Solution
Accepted by topic author hearen123

@hearen123 wrote:

What am i doing wrong, that it still doesn't work as it should?


You need to tell us ...

  • exactly what you are doing step-by-step. Unless we know what you are doing, we cannot tell what you are doing wrong. Right?
  • exactly what you expect it "should"

Obviously there is a problem either with your action or your expectation. 😉

 

A loop with TRUE wired to the termination is useless and can be deleted with no change in functionality.

 

Not sure what you expect, but it will not remove spaces from the input control, but create an output that is identical to the input, but with all spaces removed. If you want to remove spaces from the input string control, remove the indicator and write to a local variable of the input instead.

 

If you would have a reasonable while loop*, It will also only process the string once you leave the string control and click elsewhere. This is as designed!

You should::

Configure the input to "update value while typing". Now it will process the string with each iteration.

Configure the input to "limit to single line". Now you can end the string input by hitting the enter button.

 

*or use run continuously, which is NOT recommended!.

0 Kudos
Message 8 of 8
(2,286 Views)