LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can't see decimal numbers in array

Hi,

I am working on a project-reading data from gaussmeter. I can read the data, but when I am trying to write it back I get the numbers without decimals. I have to put my data in an array, because later I will write the position of the object in the same array...

Data is written with ˝dots˝ and read with ˝commas˝. Maybe there is a problem, I tried to fix this but I wasn't really successful.

 

Any idea?

 

Thanx to all!

 

 

Download All
0 Kudos
Message 1 of 7
(3,092 Views)

Hi zwax,

 

writing strings with a format string of "%.6f" is rather senseless.

 

Reading them with a format string of "%.;%f" could be the solution. (Btw. they aren't read with a decimal delimiter of ",", they are only displayed and expected using the ","!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 7
(3,069 Views)

Hi,

i tried few different formats, and this is not the solution. What about there where I use ˝Search 1D Array˝ for ˝.˝ and Replace Array Subset with ˝,˝-is this correct?

0 Kudos
Message 3 of 7
(3,063 Views)

Your VI doesn't make much sense. You're taking the "RX buffer", which I assume is some string you're reading from an instrument and converting that to an array. Why? The output of the Build Array will be an array of 1 element. You're then searching that ... 1 element array ... for an empty string. Which doesn't exist. Thus, the rest of the array gymnastics don't make much sense.

 

What does your original string (i.e., the contents of "RX buffer") look like?

 

Also:

  • DO NOT HARD-CODE PATHS. You are hard-coding paths, which means the VI may not run properly on another operating system. Worse, you're hard-coding them to YOUR user account.
  • Why are you writing the data and then reading it back from file to work with it? I can see why you'd want to write the data for posterity's sake, but why are you reading it from disk later? Just convert the data directly in LabVIEW to a numeric format instead of jumping out to an expensive file I/O operation.
  • Why do you have a 1 second delay between the write and read? Are you letting the hard drive settle down?
0 Kudos
Message 4 of 7
(3,036 Views)

I am converting this to an array, because i will have to simulate magnetic field on a 3d surface of my object-cylinder. Later I will get position of a probe-x,y,z and my rx buffer-value of magnetic field there. I will build a 4d array and i will try to draw this... That 's my mission 🙂

Rx buffer is just a string read from serial port.

And a 1 sec delay is just a simulation of moving the probe-for now.

This vi will run on this computer and this os.

I am writing my data, beacause i will need them later... I also tried to write it directly to an array, but every string that came from gaussmeter overwrote the previous one...

 

 

I hope this explanes a few things 🙂

0 Kudos
Message 5 of 7
(3,024 Views)

I don't think you understood what I had said. You are converting a string to an array of ONE element. The remaining array operations consequently make no sense. Why search an array of ONE element for an empty string? It won't be there unless the initial string is empty. And it if is, why do you need to convert it to an array to check it? It seems to me that you were intending to do what the Spreadsheet String to Array function does - it converts a delimited string to an array.

0 Kudos
Message 6 of 7
(3,004 Views)

Maybe the OP wants to develop Rube Goldberg Code.  

 

0 Kudos
Message 7 of 7
(2,976 Views)