LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
PJM_JKI

Conditional Indexing to optionally output the false condition (along with the true one)

Status: New

I find myself writing this type of code more and more recently.

 

ci current 2019-08-13_13-53-21.png

 

It would be nice to have an easier way of achieving this (for instance either of these below could work):

 

ci new v2 2019-08-13_13-53-33.png ci new 2019-08-13_13-53-33.png

 

Showing the false terminal could be done with the right click menu

 

ci new menu 2019-08-13_14-15-43.png

 

 

 

 



  


vipm.io | jki.net

33 Comments
wiebe@CARYA
Knight of NI

>>Snippets don't work without the sub vi(m)s, but the idea is clear...

>yeah I noticed there is no place to upload snippets, so I just drag it into the "insert photos"

 

No worries. The content shouldn't be too hard to recreate.

 

I might try it. I haven't needed it too often, but somehow for some libraries\modules I need it all the time.

cy...
Active Participant

@wiebe: now you have piqued my curiosity, can you share some use cases that you need it all the time?

 

the vim BD
Cond.Split.BD.png

CY (expired CLAD)
wiebe@CARYA
Knight of NI

Ah, the irony.

 

I'm working on a query tool for LabVIEW code (treating VIs and Projects as a graph database).

 

So this means filtering, splitting arrays into 'criterium true'\'criterium false'. That's exactly what this node would do.

 

Now why is this ironic? If the tool was finished, I could use it to find these situation in my code. 😁

 

"All the time" probably turns out to be a few times 🙄.

 

I'd probably make the vim also accept scalars, so it can be used like this:

Reverse Selector.png

In this example, your version would be more applicable, but in other situations it seems wasteful to build an array of Booleans and split after the fact. Also, why not?

 

There's a third situation where the element is an array and the Boolean is a scalar:

Reverse Selector 2.png

EDIT: You can use a Swap Values for that, but again, why not?