LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fastest way to format an array of numbers

I am collecting 2D array of DBLs to be later processed by other Vis.

 

The process worked fine when I saved the array to a file (standard %.3f, write to spreadsheet) formatting, then later have a separate VI to open the file and process it.

The same process did not work when I tried to process the 2D array on the fly, without saving/opening to file.

 

After debugging, I found out what was holding me back. Yep you guessed it, the formatting. Without save to spreadsheet, instead of “0.000”, the value is not 2.803E-42 (I need to to be 0.000). What is the most efficient way to format the numbers to “.3f”,  on the fly (without saving to file)?

Best,

 

Santiago

0 Kudos
Message 1 of 3
(2,886 Views)
BTW...My current solution is to covert array to spreadsheet string...then convert the string back to an array....
Message 2 of 3
(2,885 Views)

.3f is the same as a precision of 3 input to the number to fractional string vi (which can handle arrays automatically)

 

 To keep only a precision of 3 you can also do it numerically by multiplying by 1000, rounding then dividing by 1000. 

 

Here is a screenshot of the code using the two different methods. The numeric method should be fastest.

 

 

_______________________________________
Systems Test Engineer
Certified LabVIEW Architect (CLA)
Message 3 of 3
(2,869 Views)