ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

create excel file from 2D array

Solved!
Go to solution

Hello all,

 

can someone guide me if I'm on the right way or not I have problem with the excel file the data not in the same row??

 

thanks a lot 

Download All
0 Kudos
Message 1 of 16
(4,884 Views)

For work with real Excell you need report generation toolkit.
Without it you can use "Write Delimited Spreadsheet VI" and then convert this file into real xls format

0 Kudos
Message 2 of 16
(4,878 Views)

Hello Saed123,

 

Just remove the string constant "/n". The default separator is already a tabulation. That should work for your excel file.

 

Regards,

0 Kudos
Message 3 of 16
(4,870 Views)

@

Jean.L

Member Jean.L

can you explain more cause i don't understand what do you mean??

 

Thanks-

0 Kudos
Message 4 of 16
(4,854 Views)

Just remove the string constant.

 

Remove string.png

Regards,

0 Kudos
Message 5 of 16
(4,845 Views)

The file you attached, "backup_1.xls", is not an "Excel" file, despite having the (logically-incorrect) extension .xls.  If you examine it with a Text editor, you can see that it is all text, but with a very strange format:

  • The first line is in tab-delimited format:  "Freq<tab>phase<tab>Z<CR><LF>", where <tab> is the Tab character, 0x8, <CR> is Carriage Return, 0xD, and <LF> is Line Feed, 0xA.  The pair <CR><LF> is the usual PC "End-of-line" Ascii string.
  • The remaining lines of numeric data are just messed up.  They are almost in the same Tab-delimited format as the header, except each number as an extra <CR> after it.  So if the data were the numbers 1, 2 and 3, the line would read "1<CR><Tab>2<CR><Tab>3<CR><CR><LF>".

How did this code get written?  If it was written by LabVIEW, then someone wrote a bad "logging" routine (and put extra <CR> characters after the numbers).  Otherwise, you have the makings of a nice Tab-delimited "Spreadsheet" (not Excel) file that LabVIEW can easily read using Read Delimited Spreadsheet".  Note that this file format is closely related to the Comma-Separated Variables (or .csv) format, which Excel "appropriates" by forcing an Excel-like Icon for these files (and causing confusion in people such as yourself who think these text files are "Excel").

 

Bob Schor

0 Kudos
Message 6 of 16
(4,821 Views)

Jean.L 

 

i remove it but nothing happend 

 

regards

0 Kudos
Message 7 of 16
(4,805 Views)

Here is the vi I modified to make it work.

Could you confirme it's ok?

 

Regards,

0 Kudos
Message 8 of 16
(4,799 Views)

sorry Jean.L still no changing 


@Jean.L wrote:

Here is the vi I modified to make it work.

Could you confirme it's ok?

 

Regards,


 

0 Kudos
Message 9 of 16
(4,793 Views)

Hi Saed,

 

did you do any of the suggestions on your own?

 

Try this:

check.png

I don't claim to create "efficient" code, but that should work!

Note that subtle change of the filepath constant…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 16
(4,788 Views)