10-29-2009 08:35 PM
HI
How can I convert the attach txt file to XL to 2D array. This is laser beam profile data from a CCD camera. Array size 640x480.
I want to read the third colum (value) only and conver into 2D array to display beam profile
Thanks
10-29-2009 09:15 PM
10-30-2009 01:35 AM
Try this!
Regards
Visuman
10-30-2009 03:59 AM - edited 10-30-2009 04:02 AM
Hi,
I have created this VI to read the data out the file a line at a time and poke the amplitude data into an array. The data is then plotted on an intensity graph.
Some of the data looks right, some of it doesn't but I will let you be the judge of that.
Does this help?
cheers
David
10-30-2009 04:27 AM
10-30-2009 09:14 AM
Regarding the solutions:
visuman solution
visuman, you posted your solution already, so you don't need to post it again. As far as the solution itself is concerned all of those array manipulations can be replaced with a single Array Subset. The one problem I see with this solution is that it's a heavy memory impact solution since it reads the whole file into memory. Tip: You can wire the file path directly to the Read From Text File function, allowing you to eliminate the Open File and Close File functions. Those operations will be automatically performed when wiring a path to the Read From Text File function.
David's solution
I like the top-half of this solution, but not the bottom-half. The top half employs the pre-allocate the memory and then just replace array elements technique. The bottom-half has the fundamental problem of performing an I/O operation for each line. For the file provided that's 307,203 file I/O reads. This will take forever. Literally. In this case I prefer the high memory impact solution. A better solution is to read the file in large chunks and process the chunks.
I think we need to step back and address the original question. Why does the poster want to convert it to Excel? Is it because the poster believes the Read From Spreadsheet File works with Excel workbooks? This is not correct, but an understandable assumption, given the lousy name of the function. Is the user trying to work with this data in Excel and manipulate the workbook in LabVIEW as a bigger project?
I think we need to get some more answers here.
10-30-2009 09:43 AM
Hello
David , visuman, thanks alot for the VI's
David's vi's works fine but I need to transpose the intensity array to display intensity profile correctly.
This data is a laser intensity profile from a CCD camera....
This camera doesn't have any option to see the 2D profile in a particular line or 3D intensity display.
Can anyone help to plot this intensity profile into a 3D plot
the array size is 640X480
and the size of each pixel in 8.3 micron in both direction.
thanks again
10-31-2009 07:55 AM - edited 10-31-2009 07:56 AM
Hi,
I work for a laser company myself and have done something simliar to what you are trying. I have added in some more functionality to the first VI I posted. I wanted to show you the steps that I have gone through to get it into a 3D graph and get the line profile at the peak. I might be mixing my columns and rows up but I am sure you can debug all that.
All that its left is for you to go away and work out your FWHM, 1/e or 1/e^2 spot size converting pixels to microns.
@smercurio_fc (Saverio, right?): I was concerned that the multiple space delimiter (8 space representation of a tab is my guess) wasn't constant because of field padding. So thats while I choose the read a line at time method. This was instead of reading in a 10meg file and manipulating it in a loop or using the spreadsheet to array functionality. At the same time I thought I would demonstrate to Kamalm2 that you can use file functions to get your data from the file while keeping the memory consumption down. Of course, you are absolutely right, it is slower. Visumans clocked in a ~3secs and my version was ~7 secs. To me thats not a big deal. I would not have posted the VI if the OP had to run my file and go a away and make a wee cup of tea and come back to it while it was loading.
Right, its Saturday afternoon and I am off to play Sins of a Solar Empire which I highly recommend.
Hope this helps you out
cheers
David
10-31-2009 08:05 AM
David Crawford wrote:
Visumans clocked in a ~3secs and my version was ~7 secs. To me thats not a big deal. I would not have posted the VI if the OP had to run my file and go a away and make a wee cup of tea and come back to it while it was loading.
When I tried it on my computer it was still going after one minute, and wasn't anywhere close to getting nearly done. While I do not have an old TI-99 computer, I also don't have a Cray supercomputer sitting on my desk. This has to be taken into account when designing a VI. And creating a VI that performs over 300,000 file I/O accesses is simply silly.
10-31-2009 11:06 AM
Hi David
Thank you very much for your time. Its really great, at this stage it works fine.
I want to do more modification, I want to connect this program with a CCD beam profiler.
I have Mellers Griot SpotOn CCD USB2 beam profiler
They have a LabVIEW interface (see the attach VI) but its call only their interface (see the SpotOn CCD.png) and give the cetroid. It doesn't give any intensity profile in LabVIEW interface. SpotOn CCD manual also attach
I want to operate the CCD with LabVIEW interface and intensity profile on LabVIEW interface.
Please help me
thanks