LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Micro-Nuggets !!! ~~~~ Post 'em if you got 'em


@GuenterMueller wrote:

They shouldn't.  The wire just stops at the sequence local. The data is still on the wire and can be read without any allocation in another frame. 


 

No, if you look at the FSS, each "+1" operation needs to allocate a new buffer, because the input buffer cannot ber reused (it is needed again later). I think the same should apply for the SSS too. Where else would the intermediary results be kept?

 

Maybe I am missing something obvious. 😉

0 Kudos
Message 251 of 361
(2,555 Views)

@altenbach wrote:

@GuenterMueller wrote:

They shouldn't.  The wire just stops at the sequence local. The data is still on the wire and can be read without any allocation in another frame. 


 

No, if you look at the FSS, each "+1" operation needs to allocate a new buffer, because the input buffer cannot ber reused (it is needed again later). I think the same should apply for the SSS too. Where else would the intermediary results be kept?

 

Maybe I am missing something obvious. 😉


Right you are, Christian.  It seems to me as if LabVIEW allocates memory for each sequence local and thus no memory allocation dots appear.

0 Kudos
Message 252 of 361
(2,534 Views)

If everyone understood code optimization, readable code, and how to avoid abuse, then every function / structure within LabVIEW is great.

 

In real life, it is not the case...  Most (many?) people do not write readable code when using SSS.  As a matter of fact, it is highly abused with nested SSS. 

 

The State Machine may not perform as well, but it is much easier to maintain (read, debug, etc), and scales more gracefully.

 

That being said, a skilled LabVIEW programmer can write a good program using practically any architecture (use of structures).  Anyone can make a mess of a state machine..  It all depends what your ultimatye goal is.  There's no "wrong" answer.

 

I see less SSS in the code I inherit, so I am happy with the stand that I chose to take.  🙂 

😄

 

It would be an interesting challenge to request writing code but offer different criteria on what can and cannot be used to develop the code.  You would end up with n-versions..

0 Kudos
Message 253 of 361
(2,444 Views)

This should always be a cause for concern Smiley Wink

 

CauseForConcern.png


Regards,

Peter D

0 Kudos
Message 254 of 361
(2,423 Views)

@Pete.Dunc wrote:

This should always be a cause for concern Smiley Wink

 

CauseForConcern.png


I do that all the time, then select the frame and "edit...create subVI". Now I add real code to the subVI and remove the sequence frame from it.

(No need to create controls and indicators with the correct representation or connect the connector pane. :D).

Message 255 of 361
(2,411 Views)

You probably don't hide nasty code pointless code in it Smiley Happy

 

NastyCode.png


Regards,

Peter D

Message 256 of 361
(2,399 Views)

I just ran across another example where someone wanted a new sub-palatte (On the Functions Palettes this time)

 

You CAN add your own palettes!  

  1. Tools>>Advanced>>Edit Palette set...(drink Coffee--Its getting faster every year but still, do not bang on your mouse a dialog will open soon) 
  2. Ignore the dialog! your functions palettes opened somwhere likely nowhere near the floating dialog that captured your eyes
  3. on the Functions palette Right click an open palette position select Insert>>Subpalatte:  
  4. Check Link to a directory    (for this example that was the palette of interest.  There are other options feel free to explore them)
  5. Browse to <LabVIEW> \vi.lib\Utility\VariantDataType
  6. Select Save (on that floating window we ignored earlier)
  7. select Continue on the next floater)

Your new sub-palette is right there

Capture.PNG

 

You can also use the tool to change palette item locations, remove items, add other things and edit sub-palette icons.  Enjoy!

 

EDIT I forgot, You can also use the tool to change what happens when you select a vi.  The default is to drop the vi ther option is to drop the contents of the vi.  (Useful for things like "dropping" an event loop with Stop and error handling)


"Should be" isn't "Is" -Jay
Message 257 of 361
(2,131 Views)

I feel stupid, I wrote a function with a LV2-style global to do this:

 

If you need a numeric control to be only odd or even, set the minumum value to odd or even and increment to 2 in the properties dialog for the numeric!

 

coerce odd.PNG

_____________
Creator of the BundleMagic plugin for LabVIEW!
Message 258 of 361
(2,068 Views)

This post was not intended to be a Nugget but it seems to become a useful Nugget. I also shared it another Breakpoint thread but posting it here makes more sense.

 

Shortcut to jump up or down in an array

-----

The best solution is the one you find it by yourself
Message 259 of 361
(1,932 Views)

I've never noticed that, but Draw Unflattened Pixmap.vi is polymorphic:

DrawUnflattenedPixmapExample.png

By default it accepts U32 RGB array. In the picture above there is no coercion dot, which suggest that there is some polymorphism going on (but I've never noticed missing red dot). Also - always read the documentation, even on functions you use a lot 😉

BONUS: you can connect boolean array to draw binary images!

Message 260 of 361
(1,823 Views)