Learning LabVIEW (IV) - MATLAB script node

Publisher:shiwanyongbingLatest update time:2015-08-20 Source: eefocusKeywords:LabVIEW  MATLAB Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
    It is well known that LabVIEW can realize mixed programming of G language and MATLAB language through MATLAB script nodes in the program. Everyone likes it because it is not very convenient to drag and drop the operation nodes provided by LabVIEW in the block diagram for some complex formulas.
    After the MATLAB script node is inserted into the program block diagram, there will be a text editing area where you can write code, as shown in the figure below: This node actually corresponds to a MATLAB Automation Server, and the Command Window of the Server will also appear after running the program.  If a program module wants to play a role, it must have input and output ports. We can configure it through the right-click menu of the MATLAB script node, as shown in the figure below: After adding the port, you need to specify the name, which is used as a variable name in the MATLAB script, as shown in the figure below But this still cannot connect to the data flow of other nodes in LabVIEW. I am not sure how to classify graphical languages, but LabVIEW gives me the feeling of Static Type Language. If you want to connect the MATLAB script node to the data flow of the LabVIEW block diagram smoothly, you need to specify the type of input/output port. Right-click on the port and select the type, as shown in the figure below:  As an exercise, a program is written to calculate the n+1th element based on the nth element of the Look and Say sequence. What is a Look and Say sequence? The answer can be found at https://en.wikipedia.org/wiki/Look-and-say_sequence . The algorithm used in the code can be found in "Quickly Use the sort-diff-find Combination Technique" . The program flowchart is as follows: The program interface is as follows: It is worth noting that after adding an array control to the interface, a numerical control must be placed in the array control to indicate that this array is a numerical array. So the LabVIEW G language has a feeling of Static Type.  Take a look at the running effect: Since the MATLAB code in the MATLAB script node is executed in MATLAB's Automation Server, we can view the values ​​of each variable in the Command Window of the Server:
Learning LabVIEW (IV) - MATLAB script node

   
Learning LabVIEW (IV) - MATLAB script node


Learning LabVIEW (IV) - MATLAB script node

Learning LabVIEW (IV) - MATLAB script node

   
Learning LabVIEW (IV) - MATLAB script node

Learning LabVIEW (IV) - MATLAB script node


   
Learning LabVIEW (IV) - MATLAB script node


Learning LabVIEW (IV) - MATLAB script node
Keywords:LabVIEW  MATLAB Reference address:Learning LabVIEW (IV) - MATLAB script node

Previous article:Learning LabVIEW (V) - Feedback Nodes and Iterative Operations
Next article:Learning LabVIEW (Part 3) - A change in concepts

Recommended ReadingLatest update time:2024-11-23 19:02

Calculus of arrays in LabVIEW 8.2
  The calculus operation node for arrays in LabVIEW 8.2 is located in "Mathematics → Integral and Differential" on the function palette, as shown in the figure.     As shown in the figure, the integral and micromolecule selection nodes   The Integral & Micromolecules palette performs integration and differen
[Test Measurement]
Calculus of arrays in LabVIEW 8.2
Function Signal Generator Based on MATLAB
Purpose Function signal generator is a waveform generating instrument based on software and hardware. Various complex signals that need to be detected and analyzed in engineering practice can be decomposed into the sum of simple signals, and these simple signals can be simulated by function signal generators, so it ha
[Test Measurement]
Function Signal Generator Based on MATLAB
Near Infrared Measurement System Based on LabVIEW
The near-infrared spectrum (1) refers to a section of the electromagnetic spectrum between the visible spectrum and the mid-infrared spectrum, that is, the light region between 780-2526nm. Near-infrared spectroscopy (NIRS) can be divided into short-wavelength near-infrared band and long-wavelength near-infrared band,
[Test Measurement]
Near Infrared Measurement System Based on LabVIEW
Data Acquisition and Processing of Intelligent Switch Comprehensive Protection Device Based on LabVIEW
1 Introduction China's power industry is full of vitality and vigor, which has brought rare development opportunities and severe tests to the high-voltage switch manufacturing industry. The high-voltage switch manufacturing industry must continue to innovate technology and launch new products generation after ge
[Test Measurement]
Data Acquisition and Processing of Intelligent Switch Comprehensive Protection Device Based on LabVIEW
Design of Chaotic Weak Signal Detection System Based on LabVIEW
    The use of chaos theory for weak signal detection is a new research field. The methods reported so far for using chaos for weak signal detection mainly use the sensitivity of chaos to periodic signals and its strong immunity to noise signals to construct nonlinear systems in a chaotic state and achieve high-precis
[Test Measurement]
Design of Chaotic Weak Signal Detection System Based on LabVIEW
Oscilloscope control design based on labview
We know that the current digital oscilloscope can accurately capture various periodic signals and non-periodic signals. The digital oscilloscope has become one of the most important equipment for collecting, recording and analyzing various signals in scientific research experiments and engineering projects. In many ca
[Test Measurement]
Oscilloscope control design based on labview
Research on camera calibration application based on calibration toolbox in MATLAB
As people's requirements for visualization increase, computer vision, as an emerging high-tech discipline, is increasingly being used in areas such as online product quality monitoring, automatic inspection of microelectronic devices, measurement of various mold three-dimensional shapes, and positioning and aiming of r
[Industrial Control]
Research on camera calibration application based on calibration toolbox in MATLAB
USB interface application design based on NI-VISA and LabVIEW
USB (Universal Serial Bus) interface is a new interface technology used in the PC field in recent years. It is based on a single bus interface technology to meet the needs of various application fields; its plug-and-play, hot-swap support, easy expansion and other features greatly facilitate user use and have gradua
[Test Measurement]
USB interface application design based on NI-VISA and LabVIEW
Latest Test Measurement Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号