LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding 2 arrays to a Spreadsheet file Help!!

I'm trying to write to a spreadsheet file and I want the date and time in one column and the data from my channels in another. I'm running the problem that my time is in a string format and my channels are in a number format. Attached is what my program currently looks like.

Any help would be great..
Thanks,
Pier
0 Kudos
Message 1 of 19
(3,663 Views)
Hi, You have to modify the write to Spreadsheet to accept string arrays,

Look at annex.

Hope it helps,
Paulo
Message 2 of 19
(3,636 Views)
Paulo,

Greatly appreciate your help, but I need some more help. When I write to the excel file the first data values are concatenated within the column for some reason. And also the rows are not in the proper place. Can you give me some suggestions. I have attached the program.

Thanks,
Pier
0 Kudos
Message 3 of 19
(3,620 Views)
Here is the file output attachment
0 Kudos
Message 4 of 19
(3,616 Views)
Hello,

You have your file wrong formatted, because, the first time you write to it, you write as a normal text file, and that will be how excel will interpret it. You have to replace the "Write characters to file.vi" by the "Write to Spreadsheet file string" that I sent you.

If you allow me, I would like to make some extra comments on your code:
1 - When you connect an array to a for loop, there is a property of the tunnel (the point where the array goes in the loop) that is auto-indexing. Right click it and select it. This replace all those index array that you have inside your for loops and the array size wired to the N input of the loop. This will automatically index the array and the loop will automatically run n times where n is the number of elements of the array.

2 - I'm not sure about this, because I didn't run your program, because I don't have a DAQ board installed in this PC, but I think that the secont For loops that you have (the little one) is doing nothing there.

3- try to keep your code more clean, you have it spread for a very big area with a lot of empty spaces and apparentl~y there is no flow from left to right in your code that makes it more difficult to understant it.

Hope this helps,
Paulo
Message 5 of 19
(3,602 Views)
Paulo,

I dont understand what you mean about putting the write to spreadsheet in. Do you mean putting it in twice would solve this or not? I'm looking for a top header to be as follows:


Time/Date | Channel 1 name | Channel 2 name | etc....



Could you possibly show me what you mean with the previous example I sent you.




Thanks,
Piero

Hello,

You have your file wrong formatted, because, the first time you write to it, you write as a normal text file, and that will be how excel will interpret it. You have to replace the "Write characters to file.vi" by the "Write to Spreadsheet file string" that I sent you.

If you allow me, I would like to make some extra comments on your code:
1 - When you connect an array to a for loop, there is a property of the tunnel (the point where the array goes in the loop) that is auto-indexing. Right click it and select it. This replace all those index array that you have inside your for loops and the array size wired to the N input of the loop. This will automatically index the array and the loop will automatically run n times where n is the number of elements of the array.

2 - I'm not sure about this, because I didn't run your program, because I don't have a DAQ board installed in this PC, but I think that the secont For loops that you have (the little one) is doing nothing there.

3- try to keep your code more clean, you have it spread for a very big area with a lot of empty spaces and apparentl~y there is no flow from left to right in your code that makes it more difficult to understant it.

Hope this helps,
Paulo
0 Kudos
Message 6 of 19
(3,593 Views)
Hi,

Here it is:
Also with the resulting file.
Message 7 of 19
(3,564 Views)
Sorry, I forgot to save the file before sending it to you...
Replace the main.vi by this one.
Message 8 of 19
(3,561 Views)
The code looks great but the data thats reported on my graph and control display is not reporting correctly. To be more specific even though I change my channel name to a different name it still gathers the same value. And if I change all the channels to have the same channel name I just get one channel value and the other 2 are blank for some reason. Any Help would greatly appreciated since I just started using labview..




Side Note:
Overall my intent of this vi was to gather some data from some channels and then save them to a file. Then I used an array to gather the names of the channels so that it is always correct and corresponds to the channel. So if I change the channel name it will change in the excel file that I created. Maybe I'm doing this wrong any suggestions would help...
0 Kudos
Message 9 of 19
(3,540 Views)
The code looks great but the data thats reported on my graph and control display is not reporting correctly. To be more specific even though I change my channel name to a different name it still gathers the same value. And if I change all the channels to have the same channel name I just get one channel value and the other 2 are blank for some reason. Any Help would greatly appreciated since I just started using labview..




Side Note:
Overall my intent of this vi was to gather some data from some channels and then save them to a file. Then I used an array to gather the names of the channels so that it is always correct and corresponds to the channel. So if I change the channel name it will change in the excel file that I created. Maybe I'm doing this wrong any suggestions would help...
0 Kudos
Message 10 of 19
(3,541 Views)