Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

i want to transform binary data in string

Hello

I want to convert a binary array of 10 Ai channel into a n array of double in order to be converted in spreadsheet files. I have try everything i could have understood with the LV Help and the NI site but anything is working right . So i have put you my code if you can take a look and tell me why when i simulte a sinus wave and save it in binary file i ca nfind the same wave after transformation in spreadsheet file.
There is to code ( one with one AI channel and another with just an array ) both are save in binary data and after you use the tird VI to converts the files in spreadsheet format .

Thank you if you could help . I f it possible answer me quickly because i'm in hurry but any answer will be he
lpful so thank you !
0 Kudos
Message 1 of 6
(2,502 Views)
Hi Romain.

In your DAQ vi, you are writing file essai.dat as
1D array of I16 (1 array per scan)
When reading it, you try to read data as DBL, and that is not correct.
There are different choices. The easiest one: use high level vi to read I16 data as 2D array.
I tested for 5 channels and it works.
Don´t know your Lv version, so see attached doc.
Hope it helps

Alipio
---------------------------------------------------------
"Qod natura non dat, Salmantica non praestat"
---------------------------------------------------------
Message 2 of 6
(2,502 Views)
Sorry, there is a mistake

Transpose 2D array only for display. The input to Spreadsheet is direct from reading vi.

Alipio
---------------------------------------------------------
"Qod natura non dat, Salmantica non praestat"
---------------------------------------------------------
0 Kudos
Message 3 of 6
(2,502 Views)
Thank you for your help . It's quite better but it's still not really that . I want to save my array in binary data not in integer so for a numeric value i save in file the binary code of the data. Then i want to convert the binary data into spreadsheet file( I'm to read it with excel ). So the real problem it's that i don't know how to be sure that what i save in the binary file is the right thing i want to transform then . Because everytime i want to read the binary file i don't have the same axis on th e chart ( different value ) So if you have an idea i would be glad to hear it !
And thank you for your help
Romain
0 Kudos
Message 4 of 6
(2,502 Views)
Hi again
When you read binary data from DAQ card,the format is I16 ( for a 16 bits card) and this is the binary representation of values. Your program does it now.


Now, there is a vi ( write to spreadsheet file.vi)that will save your data as spreadsheet directly while adquiring, and you can tell it to save your 1D arrays as rows, as the same time you save in binary.

When reading the binary file, bear in mind you recorded arrays of data, so you must read and decimate data as necessary.
Hope it helps.

Alipio
---------------------------------------------------------
"Qod natura non dat, Salmantica non praestat"
---------------------------------------------------------
0 Kudos
Message 5 of 6
(2,502 Views)
Hi All,

I followed your discussion and I agree with all that Alipio said.
In more of the example of Alipio, I would like to recall the existence of several VIs of data conversions : "Functions>>Numeric>>Conversions".
Romain, did you manage to solve your problem?
Which is your version of LabIVEW to send examples to you?

Sanaa T
National Instruments
0 Kudos
Message 6 of 6
(2,502 Views)