How to Change Axis Name of Graph Control in LabWindows/CVI
We can use the SetCtrlAttribute function to change an Axis name programmatically in LabWindows/CVI. Just set the ATTR_XNAME or ATTR_YNAME attribute to any name you’d like to use in this function.
For example, change the top X-Axis name of a graph, we can use the following code.
// Make the top x-axis the active one SetCtrlAttribute (panel, PANEL_GRAPH, ATTR_ACTIVE_XAXIS, VAL_TOP_XAXIS); // Set the name SetCtrlAttribute (panel, PANEL_GRAPH, ATTR_XNAME, "Axis Changed");
A Few Documents about Communication between Real-time and Host PC
I have to admit that NI’s support is very helpful. Because I need to make real-time machine to communicate with Windows based desktop PC in my recent project, I try to find a few tips in NI’s website, and I get everything I need about this problem.
The following are the documents about RT communication. Maybe I’ll need them later.
Real-Time VI to Host VI Communication Methods
Three Ways to Find SubVI in a LabVIEW Project
If we change a subVI’s connector after used it a lot in a huge LabVIEW project, it’ll be a nightmare to open every VI in this project one by one and find the subVI in the diagram by hand. In fact, there are ways to find this subVI easily as following.
First, use menu View then select vi_Hierarchy, we can see VIs’ relationship, and which VI in this chart calls this subVI, and double click the corresponding VI to open the calling VI and edit it.
Second, maybe the easiest way to do it. If the connector of the subVI is different from previous. We just open the top-level VI. The top-level VI will show a broken run arrow. Just click the broken run arrow, it will popup a list of broken VIs. And this list is the subVI we want to find, just click the list items one by one to edit VIs.
Third, open top-level VI and open the subVI. Right click the subVI’s icon on the right-top of the subVI’s front panel or diagram window, and select Find All Instances. A window will pop up with the list of this subVI’s locations. We can click the items in this list to edit corresponding VIs.
How to Change Waveform Charts’ Scales Programmatically In LabVIEW
First, disable auto-scaling property of the waveform chart by editing Chart Properties Scales->Y-Axis and the uncheck Autoscale ;
Then, in the VI’s diagram, use property Y Scale –> Range –> Maximum and Minimum. We can change these values in program and by this way, we can change waveform chart’s scales during runtime.
Change the Color of a Picture Control’s Border Programmatically in LabVIEW
In one of my project, there are about 24 pictures on the front panel. When the user selects one of these pictures, I want there is an interactive way to show which picture has been selected. And I think to change the picture control’s border color is a nice solution.
I can change the border color by using color tool in development mode, but there isn’t a property to change the border’s color programmatically. Finally, I found a way to work this around. Following is how to make this work:
Put a slightly bigger Boolean indicators or color boxes behind the picture indicators. When the picture is clicked or selected, we can change the color of the underlying Boolean indicators or the color boxes. By this way, the interactive effect is realized, and it looks great for me!
How to List Files within Subfolders in LabVIEW
In LabVIEW, we can list all the files in a folder using the list folder.vi function. But, if we want to list all files including files in subfolders, should we use this function on each subfolder?
In fact, we can use only one VI that shipped with LabVIEW since version 7.0 to get this job done. The VI is vi.lib\utility\libraryn.llb\Recursive File List.vi. And this VI has been added to the palettes since LabVIEW version 8.2.