From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
01-04-2023 07:30 PM
Hi all,
I have a 2D array, and I would like to split this array into sub-arrays following 1st collum condition,
For example, the array is:
[1 a]
[2 b]
[1 c]
[2 a]
[2 e]
[3 h]
[5 t]
and we will need to split into 4 arrays below:
1st array:
[1 a]
[1 c]
2nd array:
[2 b]
[2 a]
[2 e]
3rd array:
[3 h]
4th array:
[5 t]
and so on,...
Please see the picture,
Thanks for your help,
Solved! Go to Solution.
01-05-2023 01:40 AM
Sort by the 1st column and then cut when the 1st column change value.
01-05-2023 01:40 AM
Hi,
There are multiple ways to achieve, please find the one quick approach.
01-05-2023 09:56 PM
Hi, Yamaeda,
Thanks for your suggestion,
I have finished it following your recommendation,
01-05-2023 09:57 PM
Thanks for your prompt reply,
However, If I follow that, I still cannot split the array,
Anyway, thank for your advice.
01-06-2023 01:04 AM - edited 01-06-2023 01:05 AM
Hi tnn,
@tnn wrote:
However, If I follow that, I still cannot split the array,
It always helps to simplify a VI:
01-06-2023 01:11 AM - edited 01-06-2023 01:12 AM
01-06-2023 12:44 PM - edited 01-06-2023 12:48 PM
Here's what I would do (you can skip the sort if you want the output sorted by first appearance of the key):
To get each of the three grouped arrays, just index into the output and unbundle.
01-06-2023 09:56 PM
Thank you all for your help,
I'm very appreciative of your suggestion,
This topic can be closed!