11-02-2009 04:05 PM - edited 11-02-2009 04:09 PM
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.
Solved! Go to Solution.
11-02-2009 04:44 PM
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
11-02-2009 05:28 PM - edited 11-02-2009 05:29 PM
good try
I had tried that before but without luck.
It was forcing all the data points into one column.
11-02-2009 05:36 PM - edited 11-02-2009 05:37 PM
here is a screen shot
11-02-2009 05:42 PM - edited 11-02-2009 05:43 PM
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.
11-02-2009 05:43 PM
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.
11-02-2009 05:51 PM
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?
11-02-2009 05:56 PM
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..
11-02-2009 06:03 PM
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.
11-02-2009 06:12 PM - edited 11-02-2009 06:14 PM
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...