LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

split 1d array in 2d

Solved!
Go to solution

Hi,

 

I want to split a 1d array of paths in an 2d array. Enclosed I have a copy of my 1d path-array. The aim should be that all filenames without extensions are in in one row. E.g.: 1st row:  00124241--.bst, 00124241--.dat,00124241--.par 2nd row: 00124244--.dat, 00124244--.par - and so on. My static solution for that can't handle a missing file type because of the modulo function of the file types.

 

Has anybody an idea?

 

Kind Regards,

 

--
Joachim

Download All
0 Kudos
Message 1 of 6
(3,443 Views)

Since you have an odd number of element, you need to decide how you should pad for missing elements

 

Are the names always alternating?

 

In this case you could do a "decimate" followed by a "built array". You could also "reshape" to a 2D array with 1/3 the rows and three columns.

Are the file names with identical parts always adjacent?
Message Edited by altenbach on 01-07-2009 08:44 AM
Message 2 of 6
(3,434 Views)

Hi,

 

no I havn't always an odd number of elements. If I have a file pattern with 3 types (*.par, *.dat, *.bst) and one order the *.bst file is missing the funtion should also give me a row with 2 elements. The filename without extension is the criteria for the elements in a row.

 

Yes the file names are adjacent because I do a 1d array sort before.

 

A decimate array can't help me in this case, isn't it?

 

Kind Regards,

 

--
Joachim

0 Kudos
Message 3 of 6
(3,402 Views)

Joachim082 wrote:

no I havn't always an odd number of elements. If I have a file pattern with 3 types (*.par, *.dat, *.bst) and one order the *.bst file is missing the funtion should also give me a row with 2 elements. The filename without extension is the criteria for the elements in a row.


In a 2D array, all rows must have the same number of elements, a solution would be to use an array of clusters, each conttaining a 1D array for each row.

 

Can you attach a simple VI containing a typical path array as a diagram constant so I don't need to start from scratch? Thanks!

Message 4 of 6
(3,389 Views)

yes - when I use a 2D array I can decimate in every 1d loop-iteration the empty elements.

 

I've attached a simple vi with a an path array.

0 Kudos
Message 5 of 6
(3,384 Views)
Solution
Accepted by topic author Joachim082

Try something like this. Modify as needed. 🙂

 

Message Edited by altenbach on 01-07-2009 01:21 PM
Download All
Message 6 of 6
(3,372 Views)