11-13-2013 07:31 PM
The following was got from the standard output window of the 'calling system exec' vi. My question is how to separate the 'actual read value' numbers (in bold) from the whole output and output them separately.
37- Result=OK, line=0x5D,RW,0x21,, #Read VOUT_COMMAND value
Actual Read Value:0x3000
38- Result=OK, line=0x5D,WW,0x21,0x3000, #Write VOUT_COMMAND to '1.5 V'
39- Result=OK, line=0x5D,WB,0x00,0x01,# write PAGE to 1
40- Result=OK, line=0x5D,RW,0x8B,, #Read READ_VOUT value
Actual Read Value:0x3002
41- Result=OK, line=0x5D,RW,0x8C,, #Read READ_IOUT value
Actual Read Value:0xBBB4
42- Result=OK, line=0x5D,RW,0x96,, #Read READ_POUT value
Actual Read Value:0xC2C7
Thank you very much.
Solved! Go to Solution.
11-13-2013 10:48 PM
Search the string for "Value:" and take the number after it up to the linefeed character.
11-13-2013 10:54 PM - edited 11-13-2013 10:55 PM
Here is a way to do it with regex. This assumes all values will be hex in the 0x... format.
Disclaimer: I am not a regex pro and there could be an easier way to do this, possibly without the while loop.
11-14-2013 10:37 AM
@for(imstuck) wrote:
Here is a way to do it with regex.
Disclaimer: I am not a regex pro and there could be an easier way to do this, possibly without the while loop.
Right on! You're at least 80% of the way there with this solution, but as you mention the regex could be improved a bit to be more robust. But the structure of the code (including the While Loop, autoindexing w/ conditional concat) is spot-on. (Only code structure i would change is not wiring the "multiline (F)?" input on the Match node, but rather, specifying this in the regex itself if necessary -- most of that is preference, not correctness -- and in this case, we don't need multiline since we're shifting the start index)
Have a go with this regex: (?<=Actual Read Value:)0x[0-9A-Fa-f]{4}(?=(?:\s|\z))
Read it like:
11-14-2013 10:41 AM
JackDunaway wrote:
Have a go with this regex: (?<=Actual Read Value:)0x[0-9A-Fa-f]{4}(?=(?:\s|\z))
Oh fiddlesticks. This is what happens when forum software doesn't correctly construct regexes for smiley replacements 😞
Copy this one:
(?<=Actual Read Value:)0x[0-9A-Fa-f]{4}(?=(?:\s|\z))
11-14-2013 11:59 AM
Thanks a lot for the help! It works now
11-14-2013 12:16 PM
@ZCY4444 wrote:
Thanks a lot for the help! It works now
right on! for(imstuck) did the heavy lifting here 🙂
11-14-2013 01:12 PM
Thank you very much.