LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Not a number/path/refnum single Boolean?

Solved!
Go to solution

Is there an easy way for Not a Number/path/refnum to return a single Boolean to say if the input had NaN/<Not a Path>/<Not a Refnum> anywhere in its structure.

 

I have a cluster of clusters of references that I want to validate but I can't find an easy way to convert the structure into something I can get a single Boolean out of. If there was only one cluster I would convert the cluster into an array then Or the array elements to see if there were any invalid references.

 

Example.png

 

I did the Examples above with NaN because they are easier to show than references.

0 Kudos
Message 1 of 9
(3,043 Views)
Solution
Accepted by topic author fdinoff

If I'm not mistaken, the in-memory representation for the data of a cluster of clusters of booleans should be the same as that of a 1D array of booleans, so I think you should be able to type cast it to a 1D array of booleans, which you can then OR.


___________________
Try to take over the world!
Message 2 of 9
(3,039 Views)

Type Cast man to the rescue:

 

NotAReference.png

 

Edit: Too slow, at least I didn't foul it up.

Message 3 of 9
(3,031 Views)

@tst wrote:

If I'm not mistaken, the in-memory representation for the data of a cluster of clusters of booleans should be the same as that of a 1D array of booleans, so I think you should be able to type cast it to a 1D array of booleans, which you can then OR.


 

Thank you I did not know that about the internal representation of the cluster of cluster of booleans.

 

An addition to the original question. What happens if i have arrays in some of the clusters is their an easy way convert that?

0 Kudos
Message 4 of 9
(3,024 Views)

@Darin.K wrote:

Type Cast man to the rescue:

 

NotAReference.png

 

Edit: Too slow, at least I didn't foul it up.


 

I knew that ... well actually no I didn't.

 

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 9
(3,016 Views)

@fdinoff wrote:

 

An addition to the original question. What happens if i have arrays in some of the clusters is their an easy way convert that?


tst is probably typing the answer as we speak, Type Cast man found his Kryptonite and calls in his buddy "Flatten To String"

 

NotAReference2.png

0 Kudos
Message 6 of 9
(3,013 Views)

Turns out the Array Size gets shoved in there by the Flatten To String despite the setting on the function so my previous method fails for arrays inside clusters.   I'd wager the workarounds to handle that generic of a case would not be worth the trouble...

0 Kudos
Message 7 of 9
(3,003 Views)

@Darin.K wrote:

@fdinoff wrote:

 

An addition to the original question. What happens if i have arrays in some of the clusters is their an easy way convert that?


tst is probably typing the answer as we speak, Type Cast man found his Kryptonite and calls in his buddy "Flatten To String"

 

NotAReference2.png


This does not seem to work. I removed the 9 element Array to cluster because that created invalid references. So before the flatten to string the cluster had a false boolean and an array of one false boolean but the the unflatten from string returned true.

 

Edit: Darin Got there before me.

0 Kudos
Message 8 of 9
(3,001 Views)

It looks like if you change use the flatten to string in 4.x and convert in 4.x mode it gives the expected result. Can anyone confirm this?

0 Kudos
Message 9 of 9
(2,988 Views)