LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write to spreadsheet file formatting problem

I am saving data to a spreadsheet file as a 32-bit integer. For example, I can display the read-out from the hardware buffer as

01101110100101110011100001101011

but labview is somehow rounding it to, say,

01101110100101110011100001000000.

All of my data is being rounded like this...

Any suggestions?

--Sasha
0 Kudos
Message 1 of 6
(3,336 Views)
"Sasha" wrote in message
news:50650000000800000019560000-1027480788000@exchange.ni.com...
> I am saving data to a spreadsheet file as a 32-bit integer. For
> example, I can display the read-out from the hardware buffer as
>
> 01101110100101110011100001101011
>
> but labview is somehow rounding it to, say,
>
> 01101110100101110011100001000000.
>
> All of my data is being rounded like this...
>
> Any suggestions?

How are you doing it now? I tried what I think you are saying and labview
converted the binary displayed number to decimal format when writing to
file. OTOH when I had a number displayed as string and wrote that to file
it wrote correctly. Writing numbers as strings can give you problems though
if you are then reading the file using excel
. They will read correctly but
won't work in formulas till you convert them back to number format.
0 Kudos
Message 2 of 6
(3,336 Views)
I should explain further. I can see the data being diplayed correctly, but when I open the spreadsheet file to view the saved data I was displaying in real time, the data is cohersed or rounded to a larger 32-bit word or number. Labview is showing me a group of numbers, but saving those numbers differently...This is not good considering getting the data to save correctly is the whole point of my experiment.

--Sasha
0 Kudos
Message 3 of 6
(3,336 Views)
"Sasha" wrote in message
news:5065000000050000001E940000-1027480788000@exchange.ni.com...
> I should explain further. I can see the data being diplayed correctly,
> but when I open the spreadsheet file to view the saved data I was
> displaying in real time, the data is cohersed or rounded to a larger
> 32-bit word or number. Labview is showing me a group of numbers, but
> saving those numbers differently...This is not good considering
> getting the data to save correctly is the whole point of my
> experiment.

When I asked how you are doing it now I meant along the lines of the
following questions:
How are you displaying it? What is the representation of your indicator?
How are you saving it? What vi or vi's do you use to save?
Are you doing
any formatting beforehand? Is the data being displayed *exactly* the same
as the data you save?

I'm reading this on usenet so I can't see attachments, but if you want to
attach the vi there's others that will review it and offer help. Just be
sure to include all the subvis required in your zip file.
0 Kudos
Message 4 of 6
(3,336 Views)
The original data from the hardware is in a 32-bit word. The subvi 'VMEread' then displays the number on the control palette as a 32-bit binary word as shown in the previous note. The numbers are indexed and at the end of the read loop, I have the data being saved to a 'Save to Spreadsheet' vi. The formatting is '%32b' and I am transposing the data so I can import it to Excel. I need to eventually mask the data in order to save the necessary data. Is there an error in formatting a 32-bit binary word in this vi? Do I need to change something? Attached is the VI.

Thank you for all your help!

--Sasha
0 Kudos
Message 5 of 6
(3,336 Views)
Sasha,

the problem is 'Save to Spreadsheet.vi' that coerces the 32bit integer to a float32(single). Singles having a 22(?) bit mantissa can't hold large integer with more than 22 bits thus the rounding.

To workaround this use the "Array to Spreadsheet String" function to format the integer with %32b format and write this string to file. Or modify a copy of "Write to Spreadsheet File.vi" so it handles U32 or Doubles on input. Doubles have a 52 bit mantissa so they can store 32bit integers without rounding.


LabVIEW, C'est LabVIEW

0 Kudos
Message 6 of 6
(3,336 Views)