05-01-2010 02:50 PM
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?
05-01-2010 09:51 PM - edited 05-01-2010 09:55 PM
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?
05-02-2010 11:21 AM
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.
05-03-2010 12:35 PM
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.
05-03-2010 01:04 PM
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).
05-04-2010 10:08 AM
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.