LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I need to save two 1D arrays to excel in version 8.2

Solved!
Go to solution

Hello,

 

I can't find good examples for labview 8.2.

I have two 1D arrays of 1024 elements. I need to save each of them in a different column of an excel file.

 

How can I do that?

 

Thanks.

0 Kudos
Message 1 of 20
(6,563 Views)

Hi educob,

 

two basic functions: BuildArray and WriteToSpreadsheetFile. That' all needed:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 20
(6,559 Views)
Solution
Accepted by topic author educob

Hi

 

You can use spread sheet function to save data in Excel. File extension should be .xls like test.xls

Thanks and Regards
Himanshu Goyal | LabVIEW Engineer- Power System Automation
Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
It Only gets BETTER!!!
Message 3 of 20
(6,551 Views)

Turn your two 1d arrays in a 2d arrays with "buid array" function and uses the following subvi: Write 2D Array Into File.vi

 

can be found here: http://forums.ni.com/t5/LabVIEW/how-to-write-read-2D-array-of-Sting-in-Excel-sheet-using-labview/td-...

 

Thanks to Viru.

0 Kudos
Message 4 of 20
(6,551 Views)

Thanks.

 

I have done as you suggested using local variables saving_to_excel.jpg

But it saves only part of the 1024 elements and they are all saved to a single cell in excel.

I have named the file test.csv.

Maybe the extension should be different.

0 Kudos
Message 5 of 20
(6,547 Views)

Thanks.

 

you made my day.

 

puffffffff.

 

THANKS!!!

0 Kudos
Message 6 of 20
(6,546 Views)

If I want to save another to pair of values in columnes 3 & 4 then again in column 5 & 6, etc how can I do it?

0 Kudos
Message 7 of 20
(6,540 Views)

If query resolved close the thread and give kudos............Smiley Happy

Thanks and Regards
Himanshu Goyal | LabVIEW Engineer- Power System Automation
Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
It Only gets BETTER!!!
0 Kudos
Message 8 of 20
(6,539 Views)

@educob wrote:

Thanks.

 

I have done as you suggested using local variables 


And where did it say to use local variables? Local variables are prone to abuse and misuse by newbies, which is clearly your situation. They easily create race condition. Don't believe me? http://forums.ni.com/t5/BreakPoint/Why-some-people-say-Local-Variables-are-bad/td-p/711239

 


But it saves only part of the 1024 elements and they are all saved to a single cell in excel.

I have named the file test.csv.

Maybe the extension should be different.


The file that is created is a text file. By default tabs are used to separate columns. A CSV file is a text file, but it conventionally uses commas to separate columns. Thus, when you opened the file in Excel, it saw the .csv extension, expected commas, but saw tabs, and hence put everything in one cell. If you want to use .csv, change the delimeter - it's one of the inputs to the Write to Spreadsheet File.

0 Kudos
Message 9 of 20
(6,538 Views)

@Himanshu Goyal wrote:

Hi

 

You can use spread sheet function to save data in Excel. File extension should be .xls like test.xls


This is a bad recommendation. When I see .xls I expect an Excel workbook, not a text file. I am still livid over the fact that the engineers here at work insisted that the Exec Shell I wrote save its data files with the .xls extension, even though they are text files. Why? Because they wanted to be able to double-click on them and have them open in Excel "automagically". I'll show them. In the next version I'm changing it to .txt.

Message 10 of 20
(6,537 Views)