Execution Structures using MATLAB
Execution structures contain sections of graphical code and control how and when the code inside is run. Most common execution structures are While Loops, the For Loops also Case Structures which you can use to run the same section of code multiple times or to execute a different section of code based on some condition.
Similar to Do Loop, a Repeat-Until Loop in text-based programming languages, a While Loop, shown in Figure 1, executes the code it contains until a condition occurs.
1 LabVIEW While Loop
3 Pseudo Code
Figure 1 flowchart equivalent of the While Loop functionality, and a pseudo code example of the functionality of the While Loop.
Infinite loops are common programming mistake that involves a loop that never stops.
If the conditional terminal is Stop if True, you place the terminal of a Boolean control outside a While Loop, the control is FALSE when the loop starts, then you cause an infinite loop.
Figure 2. Boolean Control Outside of While Loop
Changing the value of the control does not stop the infinite loop because the value is only read once, before the loop starts. In order to use a control to stop a while loop you should place the control terminal inside the loop. If you want to stop an infinite loop, then you must abort the VI by clicking the Abort Execution button on the toolbar.
A Case structure has two or more subdiagrams, or cases.
Only one subdiagram is visible at a time, the structure executes only one case at a time. The input value determines which subdiagram executes. Case structure is similar to switch statements or if...then...else statements in the text-based programming languages.
The case selector label at the top of the Case structure contains the name of the selector value that corresponds to the case in the center and decrement and increment arrows on each side.
Click the decrement and increment arrows to scroll through the available cases. We also can click the down arrow next to the case name and select a case from the pull-down menu.
Wire an input value, or selector, to the selector terminal to determine which case executes.
You must wire an integer, Boolean value, the string, enumerated type value to the selector terminal. We can position the selector terminal anywhere on the left border of the Case structure. If the data type of the selector terminal is Boolean, the structure has a True case and a False case. If the selector terminal is an integer, string, or enumerated type value, the structure can have any number of cases.
LabVIEW has other, more advanced types of execution structures such as Event Structures (used to handle interrupt driven tasks like UI interaction) and sequence structures (used to force execution order) which are out of the scope of this introductory material.
Why we are best?
- 24/7 Availability
- No plagiarism
- Projects, assignments and homework solutions in deadline
- Reference style, Harvard, APA, AMA, MLA, IEEE
Assignmenthelptutors.com site, number one online tutoring service for Execution structures using labview, provides Execution structures using labview homework help, Execution structures using labview assignment help; Execution structures using labview quiz help, and Execution structures using labview project help. Our team has highly qualified tutors to help you with the most challenging assignments. With clear and accurate solutions, Assignmenthelptutors.com Site stands out as the number one Execution structures using labview assignment help and homework help services. Our Execution structures using labview assignment help tutors will provide you with detail explanation on how to complete the assignment on your own for learning purposes and for exam purposes.