11-09-2017 07:02 PM
The attached VI ( LV12) describes my problem.
Solved! Go to Solution.
11-09-2017 08:47 PM
It is unusual (but, I suppose, OK) to pose a problem in the VI, rather than in the post! But at least you included a VI.
For those who are interested, the problem involves parsing part of a long input string:
$Time:2.4652[h];ISO4um:23[-];ISO6um:22[-];ISO14um:18[-];ISO21um:15[-];SAE4um:12[-];SAE6um:12[-];SAE14um:12[-];SAE21um:12[-];NAS:12[-];GOST:17[-];Conc4um:53651.37[p/ml];Conc6um:35405.87[p/ml];Conc14um:1944.37[p/ml];Conc21um:245.25[p/ml];FIndex:242964[-];MTime:60[s];ERC1:0x0000;ERC2:0x0000;ERC3:0x0000;ERC4:0x0300;CRC:¼
The OP seemed to be able to isolate the substring "ISO4um:23[-];ISO6um:22[-];ISO14um:18[-];" and wanted a way to get the three values after the colons, here 23, 22, and 18, with the proviso that they would be numbers from 0 to 23. For this sub-problem (and for many other String Parsing problems), Scan from String is the function I prefer. Here I show how you can use Scan from String and its partner, Format into String, to take 3 values from 0 to 23, form an ISO string such as shown above, and then parse it into the three values again (allowing you to test that the function "does what you want" (it will almost always "do what you tell it to do", but that's not always "what you want" ...). Notice that the same Format string can create the ISO String and take it apart.
Bob Schor
11-09-2017 10:41 PM
Thanks Bob. Looks to be logical.
DId you attach the solution VI snippet ? I just see a back x mark indicating a broken link ... can you repost the snippet ?
11-10-2017 08:06 AM
OOPS! And, to make it worse, I did this last night on my laptop at home. But not to worry -- I'll get it back, and will post it as both a Snippet and as an attached VI. It appears to me that you might be using LabVIEW 2012, which I happen to have installed in my work machine here, so I'll even try to use that Version for you ... I'll be back shortly.
Bob Schor
11-10-2017 08:54 AM
@Bob_Schor wrote:
OOPS! And, to make it worse, I did this last night on my laptop at home. But not to worry -- I'll get it back, and will post it as both a Snippet and as an attached VI. It appears to me that you might be using LabVIEW 2012, which I happen to have installed in my work machine here, so I'll even try to use that Version for you ... I'll be back shortly.
Bob Schor
No issues.. so kind of you !! I am ok with LV2015 also if that helps ....
11-10-2017 09:23 AM
So embarrassing ... Here is a LabVIEW 2012 Snippet, along with the LabVIEW 2012 VI.
Recall this is a "Proof-of-concept" VI -- the left "Format Into String" takes three 0..23 values and formats it into the ISO string that you need to parse, while the second "Scan from String" parses that String and should return exactly the same values used to create it. And (fortunately), it does.
Bob Schor
11-10-2017 11:48 AM
@Bob_Schor wrote:
So embarrassing ... Here is a LabVIEW 2012 Snippet, along with the LabVIEW 2012 VI.
Recall this is a "Proof-of-concept" VI -- the left "Format Into String" takes three 0..23 values and formats it into the ISO string that you need to parse, while the second "Scan from String" parses that String and should return exactly the same values used to create it. And (fortunately), it does.
Bob Schor
Hey, Bob - don't forget that the forum destroys the magic in the snippet ever since the forum "upgrade" so you have to upload the png file if you want it to retain its magical properties.
11-10-2017 03:43 PM
@billko wrote:
Hey, Bob - don't forget that the forum destroys the magic in the snippet ever since the forum "upgrade" so you have to upload the png file if you want it to retain its magical properties.
Which is why I also attached it as a VI. But that is so annoying -- the whole point of the Snippet was to allow you to send a VI as an Image and include "magic" ... If the LabVIEW Forum can't get it right, why is the feature even there?
Bob Schor
11-10-2017 03:45 PM
@Bob_Schor wrote:
@billko wrote:
Hey, Bob - don't forget that the forum destroys the magic in the snippet ever since the forum "upgrade" so you have to upload the png file if you want it to retain its magical properties.Which is why I also attached it as a VI. But that is so annoying -- the whole point of the Snippet was to allow you to send a VI as an Image and include "magic" ... If the LabVIEW Forum can't get it right, why is the feature even there?
Bob Schor
I was so upset by this revoltin' development that I considered writing a strongly-worded letter to the moderator. 😉
11-11-2017 01:03 AM
Thanks Bob. Using the idea you provided I completed the required code to pull out the data I want from the long string. I can now make this into a Sub VI. Of course the way I have coded to strip out the required sub string from the raw data looks a bit odd, but does the job so will leave it ...
Attaching the final code.