LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set spreadsheet string format

Solved!
Go to solution

Hi all, I have what I hope is a simple question...  I am writing an array of data to a spreadsheet and I want the first number, which is from the clock (ms) to be written in decimal format, but the rest of the bytes to be written in hex.  I can't seem to come up with a format string that will do that.  Any ideas?

 

Thanks,

 

Jason

0 Kudos
Message 1 of 8
(5,185 Views)
It sounds like you have a numeric array that you are inputting. If that's the case, convert the array to a string type, format the specific elements the way you want, rebuild the array, and pass that to the Array to Spreadsheet String.
Message 2 of 8
(5,169 Views)
Thanks for the reply, but isn't the spreadsheet formatting string supposed to do that for me?
0 Kudos
Message 3 of 8
(5,161 Views)
No. The format string is applied to the entire array. It's no different than a front panel control/indicator. You can't set the display properties to different for individual elements.
Message 4 of 8
(5,150 Views)
Oh, OK, thanks.  Apparently, the format string works differently than in C.  In C, you can specify multiple formats, such as "%d, %x, %f" which would write an integer, hex number, and floating point number.  I actually thought I saw that in the NI help menu for formatting strings, but perhaps I misunderstood.
0 Kudos
Message 5 of 8
(5,145 Views)
It works the same in LabVIEW but that is for separate items such as with the Format Into String.
0 Kudos
Message 6 of 8
(5,137 Views)
OK, if it works the same as it does in C, why wouldn't I be able to specify the string format I want and then send multiple items to a spreadsheet?  I am using the "Write to Spreadsheet" VI.
0 Kudos
Message 7 of 8
(5,123 Views)
Solution
Accepted by topic author JasonWB
Because the Write to Spreadsheet uses the Array to Spreadsheet String and there is a single input type - the numeric array in your case. If you want to write your own Write to spreadsheet function, you can index each element of the array and use the Format Into String instead of the Array to Spreadsheet.
Message 8 of 8
(5,117 Views)