From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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

Continued from here  ... Post whatever you learned today, or any morsel of LabVIEW knowledge no matter how small. It's all good! 

 

 

MicroNug.png

Richard






Message 1 of 361
(18,545 Views)

Here's something I just found out the hard way: The panel background images supplied with NI will make your EXE size shoot way up. A recent "weather widget" I made went from 83KB to 329KB Smiley Surprised just from using the supplied "Clouds" background. So, I captured a small section of the background image (no larger than my panel size) and saved it. Using that new background, I'm down to a reasonable 98K.

Richard






Message 2 of 361
(18,460 Views)

Parsing information out of web pages is fun and easy. Check out the attached "Weather Widget" which you can dock on your desktop (make an EXE first).

 

When you first run it, click the check mark. It is set to Chicago. Go to the website shown in the string constant (you'll find it) and find your city. For some cities, you'll need to parse differently.

 

 

ww.png

 

Richard






Message 3 of 361
(18,386 Views)

When wanting to use a user made Run button, we all set the VI to run when opened, then usually wait in a while loop, polling the run button.  Darrin gave this tip about using an event structure without a while loop.  The event structure will wait for an event before exiting the structure.  No while loop needed, no polling needed.  Found here.

- tbob

Inventor of the WORM Global
Message 4 of 361
(18,354 Views)

When using sub-panels, if you do not want the scrollbars to appear, you need to remove them from the vi that appears in the sub-panel.

In LabVIEW 2009, the way to remove the scrollbars is to right-click on the scrollbar and select Horizontal and choose Always OFF.  Repeat the same for Vertical Scrollbar.

Message 5 of 361
(18,319 Views)

If you are developing code that will soon be built as an executable, but wish to exclude part of the code while you are developing it, you can use a Conditional Disable Structure and Edit Condition for This Subdiagram.  Select RUN_TIME_ENGINE == True and that portion of code will only be executed as part of you build, and not during development.

Message 6 of 361
(18,318 Views)

Thanks Ray, I never thought of doing that with the Conditional Disable.

 

Another method is to use a Property Node:

 

Class = VI Server > Application

Property = Application > Kind

 

With this node, you can also set conditions for things like Student Edition, Evaluation version, and more. 

Richard






Message 7 of 361
(18,290 Views)

Today I stumbled of this behaviour of the Threshold function using tuples (points).

Threashold VI with array of points.png

I still need to let this settle to capture it in words, because I wanted the threshold (index) of the first element in the cluster.

 

Felix

Message 8 of 361
(18,238 Views)

Did you ever want to read or write a file encoded in UTF-8? There is no need for any operating system calls. There is a built-in function for converting to text and vice versa. They are not in a palette, but they are appended to this post.

 

Would you like them to be in the palette? Then vote for the idea. (I try to write a plug-in which does this, but I always get an error.)

 

Warning: As long as the text is proper UTF-8 and the characters exist in the current font page everything works. But when it is not the behavior is OS dependent (at least for LabVIEW 8.6 and 2009):

Windows XP: Non convertible characters are skipped. When the last character is invalid an error is returned.

Windows Vista + 7: Non convertible characters are replaced with a normal question mark. "?"

When you want to know it the conversion succeeded check if there are characters >=128 before AND after the conversion.

 

Greetings,

shb

Message 9 of 361
(18,189 Views)

Those are some nice tags you have added!

 

Thank you for the effort. I had told myself I should go through and tag all of these micro-Nuggets (which I should still do since it will help withe searches and statistics) but you have beat me to it.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 10 of 361
(18,150 Views)