11-28-2009 02:49 PM
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
11-28-2009 03:46 PM
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?
11-28-2009 03:52 PM
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
11-28-2009 03:58 PM
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.
11-28-2009 04:03 PM
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?
11-28-2009 04:06 PM
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.
11-28-2009 04:06 PM
With humidity: N1 Batt 40 Temp 132 Humid 42 Light 20
w/o humidity: N1 Batt 40 Temp 132 Light 20
11-28-2009 04:43 PM - edited 11-28-2009 04:44 PM
You could simply do a case for each keyword, e.g. as follows. (The other cases are similar, one for each keyword).
11-29-2009 01:52 PM
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
11-29-2009 02:35 PM
omss wrote:
- 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?!