LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How best to insert a sub-array (row) into a 2D array at the correct index which is depending on the value of the first column

Solved!
Go to solution

I'm sorry, would it be possible to modify the attached? sorry, I don't quite get it.

 

Thanks

 

Kas

0 Kudos
Message 11 of 22
(2,007 Views)

I went through your suggestion, but I still couldn't do it. However, I managed to get half of it working.

 

I now can rearrange and place the data where they should be based on "row", but I still can't rearrange it based on the "Column".

 

Attached is modified version.

 

Thanks

 

Kas

0 Kudos
Message 12 of 22
(1,987 Views)

I went through the suggestion again and payed little more attention. It worked just as you said. Thanks again for your replies.

Just incase, attached is the working example for anyone else reading this thread.

 

Thanks

 

Kas

0 Kudos
Message 13 of 22
(1,971 Views)

Hi Kas,

 

it wasn't that hard to get your program running? Smiley Wink

 

Well, I did some "enhancements" to your VI... No need for the first FOR loop!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 14 of 22
(1,956 Views)

Hi I have a  similar question for this topic,

I will like to insert data in a row by "n" times given on first column.

The data to be inserted corresponds to the data where the "n" number is located

Here's an example of my 2D array:

From:

3   0 0 0 1

1   1 1 1 0

2   0 0 1 1

 

To:

0 0 0 1

0 0 0 1

0 0 0 1

1 1 1 0

 

It doesn't matter if column 0 is also inserted i can delete after.

Thanks a lot in advance.

R

 

0 Kudos
Message 15 of 22
(1,818 Views)

I don't get it. are you saying that because you have a "3" in the first column, you are now insterting 3 rows of the same element afterwords?

 

i.e. 

From:

3   0 0 0 1

1   1 1 1 0

2   0 0 1 1

 

to:

0 0 0 1

0 0 0 1

0 0 0 1

0 0 0 1

1 1 1 0

0 0 1 1

0 Kudos
Message 16 of 22
(1,814 Views)

Yes, that's exactly right. The first column is given to me and as you pointed out it determines how many times the same element is repeated afterwords.

 

0 Kudos
Message 17 of 22
(1,804 Views)

 

It looks like this could work, I'll give it a try...Thanks a lot!

0 Kudos
Message 19 of 22
(1,792 Views)

 

Hi, it gave me some idea on how to approach it, in my case the elements are string. Here's a snapshot of what i'm looking for would look like:

 

 array.png

Thanks!

0 Kudos
Message 20 of 22
(1,782 Views)