03-19-2019 10:39 AM
Hello guys,
I want to ask about a method to create it:
I have this problem:
I have this files:
TTRT_1001#1_1_T10.txt
TTRT_1001#1_2_T10.txt
TTRT_1001#1_1_T200.txt
TTRT_1001#1_2_T200.txt
TTRT_1001#1_1_T35.txt
TTRT_1001#1_2_T35.txt
And I will have different numbers after T and I want to sort them by that number?
I uploaded my Vi. First sorting is for TTRT ( dont mind about it )
Thanks
03-19-2019 10:41 AM
I want ot sort them in different arrays for example one array for T10 other for T35 and etc..
03-19-2019 10:57 AM - edited 03-19-2019 11:06 AM
When attaching an example, make sure that the control contains a list if typical filenames as default data so we don't need to tediously type something ourselves. It makes it more likely that somebody will help.
(You use LabVIEW 2018, so learn about the conditional tunnels. You don't need to build anything in the upper shift register if you never use the output. Of you only want the file starting with TTRT, you can enter that as a pattern for "list folder" so you won't get anything else.)
@Attrt wrote:
I want ot sort them in different arrays for example one array for T10 other for T35 and etc..
Do you have a small finite list of possibilities or is the number of different "T" values unknown? How should the output look like? One possibility would be a 1D array of clusters, each containing a different "T" array sorted by the key value.
Do you just want to group the files by T-values or should each subset also be sorted by other keys?
03-19-2019 10:58 AM
Extrace decimal number from the string with offset 5 and sort by that.
/Y
03-19-2019 11:33 AM - edited 03-19-2019 11:33 AM
Unfortunately, I don't have LV 2018 on my current machine, but I think the main activity here is the parsing of the filename and then the sorting comes into play. You could've already figured out a good way to this in your VI, but like I said I can't open it. I've attached my crack at the parsing and although it may not be the fastest or most elegant, it should work for all cases you encounter providing the structure of the filename doesn't change vastly.
03-19-2019 01:17 PM
It's very unclear to me what your ideal output would be.
Bob Schor
03-19-2019 01:56 PM
While the specifications are not very clear, here are two potential solutions that can hopefully give you some ideas (I took some shortcuts, so modify as needed to fit your requirements):