LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Taking 2 separate data sets and putting them in 1 spreadsheet

Hi,

 

I am sure this is a simple issue, but it does not seem to be coming together for me. I am currently attempting to take data from 2 different text files and put them together into 2 separate columns. The code I have attached manages to put them together into one long column, does anyone have any advice on writing out that second list to another column instead of just appending it to the first?

 

Thank you,

Michael

0 Kudos
Message 1 of 7
(2,703 Views)

I would suggest using the Read from Spreadsheet File VI. That will eliminate about a third of your code. You used the Write to Spreadsheet File, but you didn't use the Read one.

 

Can you please upload the source text files? There's some gymnastics that you're doing with arrays that I don't quite get. I know what they're doing, but I don't know why.

 

P.S. Did you know you have a breakpoint around your VI?

Message Edited by smercurio_fc on 05-01-2010 09:55 PM
0 Kudos
Message 2 of 7
(2,681 Views)

Hi again,

 

Thank you for your comment about the breakpoint, I removed it.

 

So I will attach everything I have, and maybe you can tell me where things can be tightened up.

 

I will summarize how things work. Michael.vi basically takes a measurement of frequency and amplitude and puts them in text files as so. Read_text.vi then opens up those text files and puts them together into one nice text file, which I will post in my next comment along with the latest version of Read_text, as I can only upload 3 things at a time. I would then like to plot this information in an X-Y plot on the screen, which I have been attempting to do by putting the points together in clusters to be plotted, but that has been miserably failing.

 

Thank you,

Michael

Download All
0 Kudos
Message 3 of 7
(2,661 Views)
Here are my other two things: my read_text.vi and also the text file output from read_text.vi
Download All
0 Kudos
Message 4 of 7
(2,660 Views)

Hello,

 

Many of the operations that you were going through were unnecessary. Simply using the Read and Write to Spreadhsheet file functions, you can easily achieve similar results to what you previously had. The attached example should give you a good starting point.

 

-Zach

0 Kudos
Message 5 of 7
(2,638 Views)

Hi,

 

Thank you for your very helpful response! So if I then want to take many of these runs and average the results, what is the easiest  way do you think? I have attempted to build an array of the y-values in a loop, but the mean function does not seem to like it very much. Knowing that I want to average every row, I assume that this will require another for loop, but the implementation is a little confusing. Can you think of an easy way to do this?

 

I can attach what I have so far (a slight mod to your example is the function called in the middle).

 

Michael

0 Kudos
Message 6 of 7
(2,632 Views)

Hello,

 

Averaging rows is very easy with an auto-indexed For Loop. If you build your array into rows, the example below will work. If you build them into columns, then you simply have to transpose the array before connecting it to the For Loop. The attached example does this two different ways and achieves the same result.

Average Rows.png

 

-Zach

0 Kudos
Message 7 of 7
(2,595 Views)