Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/08/2019 in all areas

  1. There are a bunch of objects in LabVIEW that aren't exposed in the default palettes, and are normally inaccessible except through scripting. I made a Quick Drop plugin that exposes all of these. Many of these are no longer supported, and others never were supported in the first place. Hidden ones are displayed with an "X" next to them to warn you: as I often say, be careful with these, and don't use them in any code you care about, as they can cause crashes, data corruption, and who knows what else! Download the LLB below and place it in your <LabVIEW install dir>\resource\dialog\QuickDrop\plugins folder. Then press Ctrl+Space, Ctrl+S to open this dialog. Select an item from the list and click OK, and there you go. There's some interesting/strange stuff in here! EDIT: Couple things I forgot to mention. The first time you open this (and whenever you rebuild the list) it uses two private properties on the app reference, to get the list of controls and indicators in the palette. Since this is just a property read, I'm sure the worst that could happen is a crash when you try to open the dialog, but I can't make any guarantees. Also there's some false positives for hidden items, mainly with front panel controls/indicators that come in different styles. Place by Style.llb
    6 points
  2. Its worth mentioning that LabVIEW should do this for you, its called loop invariant code motion, so don't worry about it for performance reasons.You should put the code wherever its more readable. In this case, I'd argue the most readable form is leaving the math where it is, but moving the source values (array size, iteration terminal, control) closer in. I'd also say use a local variable for the control -- the downside to this is that, in fact, using a local variable will stop the loop invariant code motion from happening 😕 In this particular case, I'd like to mention that you can make code more readable through various means -- one is code movement, another is labelling wires or using self-labelled elements like clusters. You can also add comments, but before you go adding comments I would always always look at the code and see if it can be changed to use a different tool to make the meaning more self-evident. To stick with the current section of code: personally, I find pretty much all iteration-based math to be incomprehensible. I sat here for like a full minute trying to figure out why on earth you were taking max(0, i-10) ...but stepping back for a second, it looks like it should probably just be a case structure with two cases, "..10" and "11..". There is always a case structure in this code, but in your version its hidden inside the max() function and if you use a case structure its explicit. Then you have the problem of "why 10?", but at least anyone reading the code is not stuck back at "why maximum?". Along these lines, one thing that might really help you is if you find yourself a buddy and try to explain the code to them (bit by bit, i mean, definitely not all at once). As logman said the application isn't really all that complicated, and I would bet that anyone with a semi-softwarish or logical background could follow along if you walked them through it. The purpose would be to rethink code like the above. If you're sitting there explaining to another human being "well I want the index of this listbox to be 0 up until iteration 10 and then I want it to start incrementing by 1, so what I did is I took the maximum of 0 and the iteration terminal and then built that into an array with 0 and used that as the index" you might start thinking to yourself "man I really need to make this easier to follow".
    1 point
  3. I've done this in the past by leveraging the PictureBox .NET component and VLC. Just have VLC installed which is the same bitness as LabVIEW. Drop a .NET PictureBox and then use some of the code found here, which calls into the VLC DLLs to open a stream and display it. Here is another example that I think works too.
    1 point
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.