取消
显示结果 
搜索替代 
您的意思是: 

sort data

已解决!
转到解答

Hello,

 

I am attempting to make the case structure dynamic (or if there is another method), whereby if the entries in the first column change, that I can get the correct array output.  In the attached VI, the case structure is hardcoded with the first column data.

 

In essence, I am trying to sort the array based on the entries in the first column.   Is there a dynamic solution for this?

 

Thanks,

hiNi.

下载全部
0 项奖励
1 条消息(共 8 条)
3,677 次查看
Turn each row of the 2d array into a cluster, resulting in a 1d array of clusters. Sort this array using the 1d sort node, then turn result back into a 2d array. Use loop parallelization when converting to/from cluster.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 项奖励
2 条消息(共 8 条)
3,673 次查看

@mikeporter wrote:
Turn each row of the 2d array into a cluster, resulting in a 1d array of clusters. Sort this array using the 1d sort node, then turn result back into a 2d array. Use loop parallelization when converting to/from cluster.

Mike...

Something like this...



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
3 条消息(共 8 条)
3,662 次查看
Yes, and if all the OP will ever need is sort by the first column it could get even simpler. Auto index the 2d array to get rows, use the array to cluster to convert it into a cluster. The 1d sort node, sorts the array by items in the cluster. Item 0 is the first sort term, item 1 the second and so on.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 项奖励
4 条消息(共 8 条)
3,644 次查看

Hello Mike,

 

I am trying to implent your last solution but I am not getting the right output.  The "Array" does not match the "Current Array",i.e. Item 0 should be 136, item 1 should be 174 and so on...The "Array" is not the same as "Current Array"sort array.PNG

 

Thanks,

hiNi.

下载全部
0 项奖励
5 条消息(共 8 条)
3,624 次查看

You're trying to hard. This is what I meant:

 

Another sort.png

 

Like the note says, the conversion to the cluster defaults to 9 elements. So you may need to reset that. The conversion from cluster to array, doesn't care how may items are in the cluster.

 

Mike...

 

PS: If yiou want the first row to be handled differently, strip it off before you do this...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 项奖励
6 条消息(共 8 条)
3,615 次查看

Hello Mike,

 

If I change the index on the "Current Array", you can see that the array is indexed correctly...Index 0 starts with 136, index 1 starts with 174 and so on...with your solutions, "Array" does not change till I index the array to 39, i.e. index 39 = start 174.

 

I am trying to get the data in a format such that I can select the relevant index and get the corresponding number...i.e. index 0 = 136, index 1 = 174 and so on.  I would like to use this array (just like "Current Array") for data manulipation later on.  Your solution is not allowing me to index the array correctly.

 

Thanks,

hiNi.

0 项奖励
7 条消息(共 8 条)
3,607 次查看
解答
已被主题作者 hiNI 接受

Maybe with a little help from Variant Attributes...



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
8 条消息(共 8 条)
3,576 次查看