LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pick rows from an array and create a new one (with case structure)

Solved!
Go to solution

I've got an array. I need to get from it first 8 rows which match the condition: the row must contain a given string (depending on the day of the week), starting from given X row number. The output is another array.

 

I tried to make it myself but I'm not sure how to make it work, so far it doesn't. And I don't know how the '-1' case should look like (when a string is not found it should do nothing, but I need to wire the tunnels with something). Anyway I'm attaching what I got - I used 'dni jazdy' 1d subarray of 'lista' (they got the same indexes), because search string function wouldn't work on 2d array.

 

0 Kudos
Message 1 of 5
(2,605 Views)

I am finding difficult to understand what you are trying to say. Please explain little bit more clear and also attach the VI you have tried so far.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 5
(2,544 Views)

You can connect an empty string (or anything else) to the output in the case structure for the -1 case (string not found). Additionally, you make your output on the for-loop conditional and wire the results of a "the only blue wire pon the diagram is not equal -1" to it to filter out your empty strings. A functional example withoput local variables may help all that are willing to help.

 

Cheers,

0 Kudos
Message 3 of 5
(2,520 Views)
Solution
Accepted by topic author ed8461c9@opayq.com

Dear ed8461c9@opayq…,

 

First of all, let me Welcome You to the Ni Forums.

For your issue, I would recommend you to take a look at the Conditional Indexing Terminal a For Loop can offer. By using it, you can link a condition (boolean) to the output, and only those matching the criteria would get added to the final array.

 

Snip.png

 

This little guy would take the array, index over it and at the output you have only the elements matching the condition. (Ones greater than 0,5)

You can activate the terminal by right clicking on the tunnel (output), Tunnel Mode --> Conditional.

I hope you can make it work with this - please get back to us if it was or was not of help.

Peter

Peter L.
National Instruments Hungary
Applications Engineer
0 Kudos
Message 4 of 5
(2,484 Views)

Conditional Indexing Terminal is what I was looking for. Thanks guys. Attaching the working VI's screenshot in case someone else ever needs help with similiar problem.

0 Kudos
Message 5 of 5
(2,475 Views)