03-31-2011 12:19 PM
Hello -
I'm currently using an NI program to open multiple files (http://zone.ni.com/devzone/cda/epd/p/id/818). As a side note, I have noticed the files are automatically organized by name after the files are returned from the sub-VI. The files I am loading will be named BxCy where x is a one digit and y is a two digit number (e.g., B2C34) and within each file I load is a 1D array which I extract.
What I would like to do is organize the output so it has the structure of
Page C1
Row B1 [(1D array)]
Row B2 [(1D array)]
...
Row Bn [(1D array)]
Page C2
Row B1 [(1D array)]
Row B2 [(1D array)]
...
Row Bn [(1D array)]
and so on.
My first issue is I am not 100% sure that the file names will be organized by name in the multi-file read VI so is there anyone who can verify this? Secondly Even with this I would like to know if there are any efficient methods for doing this. Should I just use two index arrays to file them in according to their B anc C numbers? This seems slow and I've seen on other posts that the reshape array function might quicken the process but am unsure of how to proceed. I also do not have access to inplace structures (I don't know if I just forgot to install this module or if it was not included in my LabVIEW subscription).
The program I attached is in LabVIEW 2009 SP1 and I'm on Windows 7 64-bit machine.
Thank you in advance!
J
Solved! Go to Solution.
03-31-2011 02:06 PM
04-01-2011 08:06 AM
Sorry about not including the sub VI, should have but there are a half dozen SubVI's and I'd probably have to include a few data sets. I was just hoping someone would be able to point me in the right direction, which you did.
I modified the sub-VI's to take in a path instead of a string so I avoid converting and only use the strip path when I am looking for the "B*C**" numbers.
I do have the program working now using using two systems, organizing the data or organizing the filenames. I have attached these along with a dummy subVI if you have any additional comments/improvements to offer me but I plan on using the filename organization system.
As for the "list files" function, I tried it out and it could be very helpful for what I'm doing but have not had a chance to incorporate it into the code, thanks for pointing this out though!
Thanks again,
J
04-01-2011 10:37 AM
Do you have a simple list of typical filenames for testing? For example create an indicator after the first subVI and run your VI to populate it. Now disconnect the new indicator and right-click "change to constant". Save the VI and attach it once more.
Especially in the lower part you are seriously thrashing memory using delete from array followed by insert into array. A simple "replace array subset" would operate in place and would not cause constant reallocations. (You could even use the in place element" structure). Also the upper code could probably be significantly simplfied. Seems overly complicated.
04-01-2011 12:44 PM
I know my method for structuing the array isn't the best method, but I wasn't sure how to go about appending new values or using the replace array subset to build up the array when I only have the cam number to keep track of just the rows but nothing for the columns. I can see how you can use a shift register to either build each cam array or keep tabs on the last column index but I thought this would add comlications to the code vs wasting memory when, at most, this array will be a few hundred filenames large.
I have attached my code with a set of a few example filenames set into the control. Hope the rest of my reply makes sense.