LabVIEW Idea Exchange

About LabVIEW Idea Exchange

Have a LabVIEW Idea?

  1. Browse by label or search in the LabVIEW Idea Exchange to see if your idea has previously been submitted. If your idea exists be sure to vote for the idea by giving it kudos to indicate your approval!
  2. If your idea has not been submitted click Post New Idea to submit a product idea to the LabVIEW Idea Exchange. Be sure to submit a separate post for each idea.
  3. Watch as the community gives your idea kudos and adds their input.
  4. As NI R&D considers the idea, they will change the idea status.
  5. Give kudos to other ideas that you would like to see in a future version of LabVIEW!
cancel
Showing results for 
Search instead for 
Did you mean: 

Separate Format String for each index of Array to Spreadsheet String

Status: New

The ability to specify a Format String for each index in the Array to Spreadsheet String would let individually saved data columns have different numbers of digits of precision or significant digits.

I use the Array to Spreadsheet String to save 2D column data consisting of Time (X) and one or more Data (Y) columns.  Sometimes the columns have different inherent resolutions yet the Format String needs to be set to allow the largest number of digits for all columns.  This can result in :

0.0000000 -0.0000003
0.2500000 -0.0000035
0.5000000 -0.0000030
0.7500000 -0.0000020
1.0000000 -0.0000013

 

If a different Format String could be used for each index, then the result would be :

0.00 -0.0000003
0.25 -0.0000035
0.50 -0.0000030
0.75 -0.0000020
1.00 -0.0000013

 

If nothing else, it saves on file size.  The Array to Spreadsheet String function could check whether an array of Format Strings was wired into it or not to decide what to do (make it polymorphic).  Thus existing code could still be used.

 

2 Comments
Knight of NI

This is useful because it will save a lot of code. I've programmed around this in the past.

 

Of course the behavior needs to be defined for cases where the number of columns in the array does not match the number of elements in the format array. If the format array is longer, it would get truncated, but what should happen if the format array is too short? Should (A) the format be padded with the last format element in the array? Should (B) extra columns get the default format for the datatype?

 

I would probably prefer (A). For example, if we had a numeric DBL array of

 

1 11.11 22.11 33.11

2 11.22 22.22 33.22

3 11.33 22.33 33.33 

...

 

A format array with two elements [%d, %.2f] should be sufficient and equivalent to [%d, %.2f, %.2f, %.2f]


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Member

What about (C): The longer of the arrays is truncated, the shorter array 'wins'?

 

This is exactly the behaviour of all other polymorphic primitives in LV.