LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String with values well formated.

Solved!
Go to solution

Hi

 

I would like to ask for helping me to store nicely results from power meter. What I get from digital meter is string of values into one line like below bold text:

234.19E+00,0.0809E+00,-18.95E+00,-0.9997E+00,0.00E+00,0.0000E+00,-0.00E+00,9.91E+37,9.91E+37,9.91E+37,50.013E+00

So after I will get info from meter I need to save all values into .txt file. Also I would like to add for each measured value a unit letter [V], [A]... 

I prepared the program but i feel that is to complicated and more advanced LabView user can do this much more easier. Please for some advise 🙂 Thanks in advance > Dawid

 

Attachments:

gpib.vi - LabView 2020 32bit

results to save - printscreen ov vi above

Download All
0 Kudos
Message 1 of 10
(1,584 Views)

@mrspock wrote: 

I prepared the program but i feel that is to complicated and more advanced LabView user can do this much more easier. Please for some advise 🙂 Thanks in advance > Dawid


That seems to be as simple as possible, given it's not finished.  What you have is the way to go.

 

What you have now can be simplified, but to finish it will need to be this 'complicated'.

 

I'd recommend changing the format string ("%s"), as this is wrong. You're reading numbers, and you'd want to format them as numbers:"%f". This will fail on a computer that has commas as decimal separator. The text will be formatted with ",", like "2,5". Probably not what you want. So, to be safe always use "%.;%f".

 

Any specific problems with finishing?

0 Kudos
Message 2 of 10
(1,568 Views)

Way too many remaining questions to give a definite answer.

 

  • As has been said, your format (%s) is wrong and LabVIEW will silently substitute %f instead, which is not desirable, because your "9.91E+37" will turn into a "99100000000000005200000000000000000000.000000", which is unreadable. Nobody will take a magnifying glass and count all these digits to make sure what it is. You need to decide on a reasonable better format!
  • Do you ever need the numeric array at all? If not, all you need is replace all commas with e.g. "[V}<\n>" No need for the expensive detour over anything orange. (see picture)
  • It is not clear how you decide between unit letters [V], [A], etc. Does each field have dedicated units or are all units the same for each reading?
  • Never attach code that has random other invisible code. We get a failed file IO when running it because there is some extra stray code below what we see, outside the visible window..

 

altenbach_0-1633429808182.png

 


@mrspock wrote:

I prepared the program but i feel that is to complicated and more advanced LabView user can do this much more easier.


Once you learn how to spell LabVIEW with the correct letter case ("LabVIEW", not "LabView"), you'll graduate to be a slightly more "advanced" user automatically. 😄

 

0 Kudos
Message 3 of 10
(1,550 Views)

Hello

 

Thanks for the answer. On screenshot I am showing what kind of results I want to achieve and what kind way of working to avoid. I hope this is clear view of my way of thinking.

 

Dawid

Download All
0 Kudos
Message 4 of 10
(1,546 Views)

"%.4" is NOT a valid format!

0 Kudos
Message 5 of 10
(1,535 Views)
Solution
Accepted by topic author mrspock
Message 6 of 10
(1,532 Views)
Solution
Accepted by topic author mrspock

@mrspock wrote:

Hello

 

Thanks for the answer. On screenshot I am showing what kind of results I want to achieve and what kind way of working to avoid. I hope this is clear view of my way of thinking.

 

Dawid


Here, have a look at the attached example.

"Good judgment comes from experience; experience comes from bad judgment." Frederick Brooks
Message 7 of 10
(1,530 Views)
Solution
Accepted by topic author mrspock

If you really only need the first four values, here's another alternative. No need to parse all these extra characters.

 

altenbach_0-1633433552925.png

 

Message 8 of 10
(1,522 Views)

altenbach, Dobrinov - Thanks! This is what I am looking for. Now I will check how it works. Thanks once again 🙂

 

Dawid

0 Kudos
Message 9 of 10
(1,511 Views)

I'd go for:

GIPB To Text.png

 

Note that these solutions are not simpler per se that your original post.

 

They are maybe (doubtfully, Spreadsheet String To Array is blazingly fast) a bit faster, but they leave out half the problem (storing to file).

 

0 Kudos
Message 10 of 10
(1,482 Views)