LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

csv data for excel getting concatenated to one column

Solved!
Go to solution

I have a 2D array, that i would like to put into a csv file so it can opened in excel.

The data which sould be the 2nd column, is being appened with the first.

Im not sure why this is happening, i have done this before without problems.

There must be a hidden character that is missing.

Anyone?

 

I am using build array two times.

the first takes a singular double value and appends it to a 1D array

There are two 1D arrays that are built for two differnet parameters.

Then, a 2nd build array combines the two 1D arrays and this is what should go to excel.

 

 

I tried the save to excel.vi that someone posted earlier.

I was not able to run it as there was open new worksheet.vi missing.

 

 

Untitled.jpg

Message Edited by jimmyinct3 on 11-02-2009 04:06 PM
Message Edited by jimmyinct3 on 11-02-2009 04:08 PM
Message Edited by jimmyinct3 on 11-02-2009 04:09 PM
0 Kudos
Message 1 of 19
(3,836 Views)

You don't write a 2D array.

RIght click on the  'Build array' before the write to file and deselect 'Concatenate inputs', this will store the data asa 2D array.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 19
(3,825 Views)

good try

I had tried that before but without luck.

It was forcing all the data points into one column.

Message Edited by jimmyinct3 on 11-02-2009 05:29 PM
0 Kudos
Message 3 of 19
(3,817 Views)

here is a screen shot

Untitled2.jpg

Message Edited by jimmyinct3 on 11-02-2009 05:37 PM
0 Kudos
Message 4 of 19
(3,813 Views)

thisis one from a month old revesion

it worked fine in that the data all got a seperate column

the only difference is that it had to be transposted at the end

it probably has to do with differenent delimieters for columns and rows

this data does not need to be transposed

the only difference really that i can see also is that the daq devices are different, this one is from a crio, the new one is a daq card. 

Untitled3.jpg

Message Edited by jimmyinct3 on 11-02-2009 05:43 PM
0 Kudos
Message 5 of 19
(3,810 Views)

You do NOT have a 2D array.  You are concatenating your 1D arrays, which will result in exactly what you are seeing -- a 1D array.  Then you are writing that 1D array to a csv file.   This is very clear from the picture you posted.

 

As the previous person who tried to help you said, right-click on your second "build array" and de-select "concatenate inputs".

 

You say you tried that.  Maybe you did, maybe you didn't...however, once you have de-selected "concatenate inputs" and your final array is indeed 2D, wire it to the "2D data" input of the "write to spreadsheet file" function.

 

A 2D array will be a double line...as shown in the attached picture.

0 Kudos
Message 6 of 19
(3,808 Views)

Ah...I note that your screenshot has changed from what you originally posted.  You now appear to have a 2D array, wired to the correct terminal of the function.

 

The next screen shot you posted, the one you say worked, has "append data to file" set to "F" and also has "transpose data?" set to "F".  I note that in your other screenshot you have both of those set to "T"...is that what you want?

0 Kudos
Message 7 of 19
(3,805 Views)

hello diane.

 

yes, within the while loop, you need to append data to the array or it will just rewirte the file.

The revision that does work just wrote the file after the loop ended.

maybe ill experiemnt with this  a little

 

sorry about the confusion, i had inserted the wrong image but fixed it like 2 seconds later..

 

 

0 Kudos
Message 8 of 19
(3,800 Views)

nope, that was not it

i copied in the vi segments from the working file and put them in this file.

it still is putting them in one column.

its just weird.

maybe if i break all the wires and rewrite is might see it right.

 

it is putting a period between what should be columns.

 

0 Kudos
Message 9 of 19
(3,798 Views)

 

 

i removed the inputs to the build array from the daq cards and replaced it with integers from the iteration count.

it works fine in that, the data each gets its own column.

i think its something about the DAQ card data that is causing this problem


this code was working until i got rid of the crio and shared varaibles and put in a daq card...

Message Edited by jimmyinct3 on 11-02-2009 06:14 PM
0 Kudos
Message 10 of 19
(3,796 Views)