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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array Sort

Dear Friends;

I am stuck with the following problem.

I have an array as follows:


Array: {(1st row is Index, i.e. 1-6 or A-F); 2nd row is the corrospending value}

1      2    4      3    1    6    2    6
26    6    46    6    6    9    6    9
---------------------------------------------------------

 

I want to sort the avobe array as follows:
Desired Table: [6x7], {(1st col is Index, i.e. 1-6 or A-F); 2nd to 8th col are the corrospending value, missing one filled by 0}

1    6    26    0    0    0    0    0
2    6    6     0    0    0    0    0
3    6    0     0    0    0    0    0
4    46   0    0    0    0    0    0
5    0    0    0    0    0    0    0
6    9    9    0    0    0    0    0

 

Any help would be appreciable.

Regards-K

0 Kudos
Message 1 of 4
(2,528 Views)

Hi mamunk,

 

to appreciate your first post here you may start like this:

check.png

It's probably not the "best" solution, but it should work according to your description…

 

For the next time you should note we will not do your homework.

Attach your VIs and ask for specific problems - not just generic "I need something, can you create this for me!"

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(2,511 Views)

Hi mamunk2,

 

Do you have a vi related to this problem which you have worked on?

 

There is an example of the 2D sorter:

https://decibel.ni.com/content/docs/DOC-12264

https://decibel.ni.com/content/docs/DOC-17440

https://decibel.ni.com/content/docs/DOC-13719

http://www.ni.com/example/27502/en/

 

As for the missing one, you can create the 8x8 array using "Initialize Array" with the size value = 8 and the initial value = 0 which you fix. The final result of sorted array will replace the 8x8 array which you created using "Replace Array Subset".

 

Hope that helps,

 

Warmest regards,

Lennard.C 

Learning new things everyday...
0 Kudos
Message 3 of 4
(2,508 Views)

Thanks to both of you.

0 Kudos
Message 4 of 4
(2,439 Views)