07-05-2012 06:53 AM
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.
Solved! Go to Solution.
07-05-2012 06:57 AM
07-05-2012 07:02 AM
Hi
You can use spread sheet function to save data in Excel. File extension should be .xls like test.xls
07-05-2012 07:02 AM
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.
07-05-2012 07:05 AM
Thanks.
I have done as you suggested using local variables
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.
07-05-2012 07:07 AM
Thanks.
you made my day.
puffffffff.
THANKS!!!
07-05-2012 07:15 AM
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?
07-05-2012 07:16 AM
If query resolved close the thread and give kudos............
07-05-2012 07:17 AM
@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.
07-05-2012 07:20 AM
@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.