# 2.1 Lab 2: labview mathscript and hybrid programming  (Page 3/6)

 Page 3 / 6

break;

end

end

LabVIEW MathScript supports the relational and logical operators listed below.

Relational Operators

 Symbol Meaning <= less than equal < less than >= greater than equal > greater than == equal ~= not equal

Logical Operators

 Symbol Meaning & AND $\mid$ OR ~ NOT

## Programming in the labview mathscript window

The MathScript feature allows one to include .m files, which can be created using any text editor. To activate the LabVIEW MathScript interactive window, select Tools MathScript Window from the main menu. To open the LabVIEW MathScript text editor, click the Script tab of the LabVIEW MathScript Window (see [link] ). After typing the .m file textual code, save it and click on the Run script button (green arrow) to run it.

For instance, to write a program to compute the average (mean) of a vector x, the program should use as its input the vector x and return the average value. To write this program, follow the steps outlined below.

Type the following in the empty script:

x=1:10

L=length(x);

sum=0;

for j=1:L

sum=sum+x(j);

end

y=sum/L % the average of x

From the Editor pull-down menu, go to File Save Script As and enter average.m for the file name. Then click on the Run script button to run the program. [link] shows the LabVIEW MathScript interactive window after running the program.

## Sound generation

Assuming the computer used has a sound card, one can use the function sound to play back speech or audio files through its speakers. That is, sound(y,FS) sends the signal in a vector y (with sample frequency FS) out to the speaker. Stereo sounds are played on platforms that support them, with y being an N-by-2 matrix.

Try the following code and listen to a 400 Hz tone:

>>t=0:1/8000:1;

>>x=cos(2*pi*400*t);

>>sound(x,8000);

Now generate a noise signal by typing:

>>noise=randn(1,8000); % generate 8000 samples of noise

>>sound(noise,8000);

The function randn generates Gaussian noise with zero mean and unit variance.

One can load or store data using the commands load and save. To save the vector x of the above code in the file data.mat , type:

>>save data x

Note that LabVIEW MathScript data files have the extension .mat. To retrieve the data saved, type:

>>load data

The vector x gets loaded in memory. To see memory contents, use the command whos ,

>>whos

Variable Dimension Type x   1x8000 double array

The command whos gives a list of all the variables currently in memory, along with their dimensions. In the above example, x contains 8000 samples.

To clear up memory after loading a file, type clear all when done. This is important because if one does not clear all the variables, one could experience conflicts with other programs using the same variables.

## Reading wave and image files

With LabVIEW MathScript, one can read data from different file types (such as .wav, .jpeg and .bmp) and load them in a vector.

To read an audio data file with .wav extension, use the following command:

>>[y Fs]=wavread(‘filename’)

This command reads a wave file specified by the string filename and returns the sampled data in y with the sampling rate of Fs (in hertz).

where we get a research paper on Nano chemistry....?
nanopartical of organic/inorganic / physical chemistry , pdf / thesis / review
Ali
what are the products of Nano chemistry?
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
hey
Giriraj
Preparation and Applications of Nanomaterial for Drug Delivery
revolt
da
Application of nanotechnology in medicine
what is variations in raman spectra for nanomaterials
I only see partial conversation and what's the question here!
what about nanotechnology for water purification
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Is there any normative that regulates the use of silver nanoparticles?
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
why we need to study biomolecules, molecular biology in nanotechnology?
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
why?
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
how did you get the value of 2000N.What calculations are needed to arrive at it
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!