08-12-2009 07:48 AM
Hi,
i am in a stage of my program where i have to do numerical analysis on a set of data collected by an Optical spectrum analyser... the data has been saved in multiple spreadsheets... (each with a row for the wavelengths, x-values, and power, y-values)...i need to get the power values and put them all in 1 spreadsheet file, with the wavelngth values in the first row.
so multiple 2D spreadsheets: Wavelength: x1 x2 x3 .....
Power 1 : P1 P2 P3....
Wavelngth: x1 x2 x3...
Power 2 : p1 p2 p3...
Will turn to: Wavelength: x1 x2 x3...
Power1:P1 P2 P3...
Power2:p1 p2 p3...
attached below is my attempt at doing this, which doesnt seem to work. The loops are present so that 'read from spreadsheet' vi recalls all the spreadhseets...which it does do... but i don't know how to improve it so that all the files succesfully append into 1 2D array (as shown above).
Please can someone help me figure out how to do this (recall multiple spreadsheets and then save into 1). right now only the files being recalled in the last loop iteration are saved into the single spreadsheet.
the file paths of the spreadsheets are all dependent on the number (N) so the file paths are such that 00.txt,01.txt,02.txt,03.txt...0N.txt, 10.txt,11.txt...1N.txt,20.txt,21.txt... etc ...NN.txt and teh final file will be RESULTS.txt (as seen in the pic)
Any input will be greatly appreciated, it seems like an easy concept, but the answer totally evades me.
thanks a lot,
Asiri
08-12-2009 08:04 AM
like this?
08-12-2009 09:50 AM
ah, well, not quite..though very similar, i have the all the spreadsheets saved in a folder, so i want to recall them and append them all into 1 file much like what you have shown, however what i am having trouble with is recalling a N^2 number of files and appending them into 1.
in my attachment i have made a loop to recall the files, and they are indeed recalled, just not passed on through the loop into the 'append array' VI properly.
thank you.
08-12-2009 09:55 AM
08-12-2009 10:04 AM
😄 as you can see in the image, i have used the required VIs to recall and save the spreadsheets, what i am having problems with is appending ALL of the spreadsheets, my loops are not working properly, i only append a select number of spreadsheets/arrays together dependent on the loop iterations,
perhaps its something wrong with the way i got everything wired? i index at the outer loop, however this information gets lots in subsequent iterations... what i need ideally is some sort of VI which inserts sub arrays into consequative rows in an array though just one input (such as in my loops).
any suggestions are greatly appreciated.
thank you! 🙂
asiri
08-13-2009 06:36 AM
08-13-2009 07:14 AM
hi, managed to solve it, altho its not fully complete i've attached setup which appends the Power rows into just 1 spreadsheet.
thanks for alll the suggestions 🙂
08-13-2009 07:36 AM
I think that adding an "Transpose 2D array" between the loop and the "Insert Into Array" vi in your first code will solve your problem.
08-13-2009 08:15 AM
Sorry to mislead you Radioman but reading your other post makes me realize that you get a 3D array out of those loops!
Shame on me that I didn't realize that in the first place
So this is the code to handle your problem
Be sure to have the option "Concatenate Inputs" checked with the "Build Array" or you will again end up with a 3D array.
Hope this helped 🙂
08-13-2009 08:56 AM
thank you! 🙂
asiri