LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

decision statements from reading string

Hi, 

 

I am running Labview 7.1(student license on university campus). Right now I have it so that I can read a line from a .txt file, use the Scan from String.vi, apply the format the string is read, and strip individual scans to display them in the Front Panel. I was wondering if there was a way to individually read the information within the string. For example, if the battery status "Batt *number*" is not in the text file, I want to display a message based on that decision to the user saying that information is not available at this time. I will attach the VI and the text file.

 

Thanks in advance for the help.

 

-omss 

Download All
0 Kudos
Message 1 of 11
(3,096 Views)

You are reading an entire file, then clip out the first line, millions of times per second. I guess this is work in progress. 😉

 

Anyway, the string palette has plenty of tools to parse strings, match patterns, etc, so all you need to do is look for whatever you want and proceed accordingly, e.g. using a case structure. What exactly is giving you problems?

0 Kudos
Message 2 of 11
(3,076 Views)

First off, you are right, it is a work in progress. Secondly, all the information has to be updated constantly from the text file, because the text file will be changing. I guess i could slow it down for good coding... 

 

The problem that I am having is: say for example, one of the nodes contain information only on battery, temperature, but it has no humidity, I need to parse string based on that. So if there is no humidity, I need to let the user know that information on humidity is unavailable. What would be ideal is to not have the humidity indicator show up at all if information on it is unavailable. But once labview finds information on humidity from the text file, it would bring up the indicator showing what the humidity level is.

 

Cheers,

-omss 

0 Kudos
Message 3 of 11
(3,073 Views)

In your text file, you have 3 lines(I know this is just example), do you want the VI to automatically go from one line to the next line? or you want the user to be able to move from one line to the next

 

Also, if for example, there is no humidity, you want the humidity  indicator to vanish on the front panel, and a message to appear to the user , saying there is no humidiy. Then when it reads another line, and there is humidity, then the humidity indicator should come back.

 

Please clarify.

0 Kudos
Message 4 of 11
(3,066 Views)

omss wrote:

The problem that I am having is: say for example, one of the nodes contain information only on battery, temperature, but it has no humidity, I need to parse string based on that. So if there is no humidity, I need to let the user know that information on humidity is unavailable. What would be ideal is to not have the humidity indicator show up at all if information on it is unavailable. But once labview finds information on humidity from the text file, it would bring up the indicator showing what the humidity level is.


How does the line look like if there is no humidity? Is the keyword still there, but no number after it? Is the keyword absent? How tightly is the line structure maintained?

0 Kudos
Message 5 of 11
(3,063 Views)

Right now, I have a "Main" VI which contains a subpanel, the subpanel then calls the different nodes(a VI for each node) and displays information about those nodes.

 

If there is no humidity, I would like the humidity indicator to vanish on the front panel and/or a message to appear to the user that there is no humidity information available. Also, since labview is constantly reading the lines from the text file, if any information on the humidity comes available later, the humidity indicator would then reappear on the front panel and show the humidity level.

 

Let me know if more clarification is needed.  

0 Kudos
Message 6 of 11
(3,062 Views)

With humidity: N1 Batt 40 Temp 132 Humid 42 Light 20

w/o humidity: N1 Batt 40 Temp 132 Light 20 

0 Kudos
Message 7 of 11
(3,061 Views)

You could simply do a case for each keyword, e.g. as follows. (The other cases are similar, one for each keyword).

 

Message Edited by altenbach on 11-28-2009 02:44 PM
0 Kudos
Message 8 of 11
(3,055 Views)

altenbach,

 

thanks for your reply, however, I am not sure where I can find the following VI's:

 

the N1..Batt...Temp...Humid...Light string array type thing you have in the beginning

the VI that says "999"

the VI that says ?!Visible?!

 

sorry for such a dumb question, I have been looking on my palette's but i am not able to find these guys. If I knew them, I would be able to read more about how this is working.

 

Thanks 

0 Kudos
Message 9 of 11
(3,023 Views)

omss wrote:
  1. the N1..Batt...Temp...Humid...Light string array type thing you have in the beginning
  2. the VI that says "999"
  3. the VI that says ?!Visible?!

  1. It's an array diagram constant. Place an empty array container and drop a string constant. Resize and enter the values.
  2. "decimal string to number".
  3. This is a property node for the indicator. (Right-click the indicator...create...property node...visible)
0 Kudos
Message 10 of 11
(3,001 Views)