BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code


wiebe@CARYA wrote:

Probably a Monday morning ( 🌴😑 :palmface:) issue, but honestly I never use the output configuration.


It can be important for Boolean array to number. It defaults to a U32 output but at least the help documentation mentions that you can change the output type through that property window.

0 Kudos
Message 2621 of 2,632
(475 Views)

@Jacobson wrote:
It can be important for Boolean array to number. It defaults to a U32 output but at least the help documentation mentions that you can change the output type through that property window.

If you decide to configure the output, another complication is however the hard to find "sign extension mode" which is ONLY available in the right-click menu, but completely absent from the properties page (where it belongs!!!!!!!!). It defaults to "If output is signed" so if you e.g. convert a short array (e.g. T, F, T), you end up with a I32 of "-3"

So of you think you need an I32 output because you want to wire it to an array index without coercion dot, you will NOT get any existing array element unless you change the sign extension mode first

 

This actually belongs in this thread and I will also post i there. Don't forget to vote for this idea!

Message 2622 of 2,632
(454 Views)

wiebe@CARYA wrote:

@altenbach wrote:

Somebody just kudoed this old post here and it is probably important to mention that this method is only fully safe for integer arrays. For example if the input is DBL and contains NaN, they would remain NaN and could cause unexpected results downstream.


wiebeCARYA_0-1744635505327.png

This returns 0 regardless the input or numeric type.

 

Not sure what it does to performance. *0 might be slower that initialize array too though. Who knows without testing...

 

You'll loose the ability to inline the VI, for undisclosed reasons (probably "no priority").


24 years ago (when I first saw LabVIEW) my first two questions were:

  • How do I initialize an array?
  • Where does the semicolon go?

I might have learned some things. 😀


"Should be" isn't "Is" -Jay
0 Kudos
Message 2623 of 2,632
(387 Views)

wiebe@CARYA wrote:

@altenbach wrote:

 


I always forget about that output configuration...

 

You could argue that a To Unsigned Byte integer is clearer, but actually I don't even know how to get the output configuration working 🙄...

wiebeCARYA_0-1747646443459.png

The output stays a double or breaks the wire when connected to a Join Number:

wiebeCARYA_1-1747646636923.png

 

Probably a Monday morning ( 🌴😑 :palmface:) issue, but honestly I never use the output configuration.


I forgot about that output configuration ONCE!  "ALWAYS " seems like an excessive number of times to make the same mistake 😕


"Should be" isn't "Is" -Jay
0 Kudos
Message 2624 of 2,632
(380 Views)

@JÞB wrote:

wiebe@CARYA wrote:

@altenbach wrote:

 


I always forget about that output configuration...

 

You could argue that a To Unsigned Byte integer is clearer, but actually I don't even know how to get the output configuration working 🙄...

wiebeCARYA_0-1747646443459.png

The output stays a double or breaks the wire when connected to a Join Number:

wiebeCARYA_1-1747646636923.png

 

Probably a Monday morning ( 🌴😑 :palmface:) issue, but honestly I never use the output configuration.


I forgot about that output configuration ONCE!  "ALWAYS " seems like an excessive number of times to make the same mistake 😕


In my defense, outside the forum, I've only seen this being used a few times over the past decades.

0 Kudos
Message 2625 of 2,632
(336 Views)

wiebe@CARYA wrote:



In my defense, outside the forum, I've only seen this being used a few times over the past decades.


In some projects they were overly ambitious at avoiding coercion dots (like converting a U32 to an I32 before sending it to an Index array) so there i used it a few times to save some block diagram objects.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 2626 of 2,632
(212 Views)

@Yamaeda wrote:

wiebe@CARYA wrote:



In my defense, outside the forum, I've only seen this being used a few times over the past decades.


In some projects they were overly ambitious at avoiding coercion dots (like converting a U32 to an I32 before sending it to an Index array) so there i used it a few times to save some block diagram objects.


That is tricky stuff.

 

I usually choose I32s for counts and such, because I know array inputs are (and should be) I32s and I don't want coercion dots... But things like counts are clearly unsigned... I can live with it, but it is a compromise I'm not entirely happy with.

0 Kudos
Message 2627 of 2,632
(170 Views)

wiebe@CARYA wrote:

@Yamaeda wrote:

wiebe@CARYA wrote:



In my defense, outside the forum, I've only seen this being used a few times over the past decades.


In some projects they were overly ambitious at avoiding coercion dots (like converting a U32 to an I32 before sending it to an Index array) so there i used it a few times to save some block diagram objects.


That is tricky stuff.

 

I usually choose I32s for counts and such, because I know array inputs are (and should be) I32s and I don't want coercion dots... But things like counts are clearly unsigned... I can live with it, but it is a compromise I'm not entirely happy with.


If you add a U8 to a I32, to you explicitly convert the U8 first? 😉 I mean, the code is more correct, but the extra blocks makes it a little harder to read, since i always think "why are they doing this explicit conversion?"

I have the same reaction when people add a 0 constant to Index array, it's the same as not having it connected, but it makes me think and wonder why they index.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2628 of 2,632
(153 Views)

@altenbach wrote:

Look ma, I finally found all the "variables"!!! 😮

 

(Seen here)

 

Look at the navigation windows for the scale of it all. Yes, the main code only contains local variables (for write) and value properties (for read). Not sure why there are two sequence frames. 😄

 

altenbach_0-1749838828429.png

 


Try makespace without the inherent grouping the FSS provides.  😉


"Should be" isn't "Is" -Jay
0 Kudos
Message 2629 of 2,632
(107 Views)

@Yamaeda wrote:
If you add a U8 to a I32, to you explicitly convert the U8 first? 😉 I mean, the code is more correct, but the extra blocks makes it a little harder to read, since i always think "why are they doing this explicit conversion?".

In addition, an explicit conversion is sometimes more expensive. (Example, but you would think the compiler should create identical code. I have not tested in recent version)

 

CoercionIsFaster.png

0 Kudos
Message 2630 of 2,632
(49 Views)