04-24-2025 08:06 AM
Hi guys, I have been struggling trying to combine rows with a single like element in them...... for instance an Array that is like:
[A, B, C, D],
[E, F, G, H],
[I, J, K, L],
[M, N, O, D]
Should then become:
[A, B, C, D, M, N, O, D],
[E, F, G, H, , , , ],
[I, J, K, L, , , , ]
04-24-2025 08:25 AM
Hi HSG,
@HSG16 wrote:
Hi guys, I have been struggling trying to combine rows with a single like element in them......
What have you tried and where are you stuck?
@HSG16 wrote:
Array that is like:
[A, B, C, D],
[E, F, G, H],
[I, J, K, L],
[M, N, O, D]
Should then become:
[A, B, C, D, M, N, O, D],
[E, F, G, H, , , , ],
[I, J, K, L, , , , ]
Done.
04-24-2025 08:44 AM
Hello @GerdW
I have made a few attempts all leading to failure over the course of a week and I wish I had something to show for them but they have all been try and delete and retry and delete. I think the problem comes in where the goal is to make this dynamic so regardless of Array Size and regardless of how many duplicates are in the array, each item appears on one row. I have gone the route where I ended up with 4 nested For loops and at that point, I had to stop.
04-24-2025 08:57 AM - edited 04-24-2025 08:59 AM
Hi HSG,
@HSG16 wrote:
I think the problem comes in where the goal is to make this dynamic so regardless of Array Size and regardless of how many duplicates are in the array, each item appears on one row.
You didn't mention this requirement in your first message.
Describing a problem correctly really helps to solve the problem…
@HSG16 wrote:
I have gone the route where I ended up with 4 nested For loops and at that point, I had to stop.
From my quick description it seems you need just two stacked loops…
Is this just homework to learn (array handling in) LabVIEW or is there a real-world problem to solve?
04-24-2025 09:27 AM
@HSG16 wrote:
Hi guys, I have been struggling trying to combine rows with a single like element in them...... for instance an Array that is like:
@HSG16 wrote:
I have made a few attempts all leading to failure over the course of a week and I wish I had something to show for them but they have all been try and delete and retry and delete. I think the problem comes in where the goal is to make this dynamic so regardless of Array Size and regardless of how many duplicates are in the array, each item appears on one row.
Do you have more detailed requirements? What should happen if there is more than a single like element?
Arrays are always rectangular, so you need to pad short rows. What's the padding element?
What are possible "elements"? All single uppercase letters or can there be longer words?
What should happen if an element occurs in more than two rows?
What should happen if multiple elements in one row match with element in several other rows?
What determines the order of appending?
Does the order of elements in each row need to be maintained?
What is an Item? (single element?, original row?)