Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

wavwrite (MathScript RT Module Function)

LabVIEW 2012 MathScript RT Module Help

Edition Date: June 2012

Part Number: 373123C-01

»View Product Info
Download Help (Windows Only)

Owning Class: audio

Requires: MathScript RT Module (Windows)


wavwrite(Y, file)

wavwrite(Y, fs, file)

wavwrite(Y, fs, NBITS, file)


Writes data to a Microsoft .wav file.




Name Description
Y Specifies the wave data you want to write to file. Each column of Y represents one channel. Specify two columns for stereo data. Y is a real matrix.
file Specifies the filename to which you want to write the wave data in Y. You can use an absolute path or a path relative to the current working directory. file is a string.
fs Specifies the sampling rate in Hz. fs is a real number. The default is 8000.
NBITS Specifies the number of bits to use to encode the wave data in Y. NBITS must be 8, 16, 24, or 32. The default is 16.


The file path that you specify can be relative to the working directory. Changes you make to the working directory using the cd function apply only to the current instance of the LabVIEW MathScript Window or the MathScript Node from which you call the function. Changes to the working directory for one MathScript Node do not apply to any other MathScript Nodes. LabVIEW resets the working directory to the default when you close the LabVIEW MathScript Window or when the MathScript Node stops executing. Use the MathScript: Search Paths page of the LabVIEW MathScript Properties dialog box to change the default working directory for the LabVIEW MathScript Window. Use the MathScript page of the Options dialog box to change the default working directory for MathScript Nodes in the main application instance.

The following table lists the support characteristics of this function.

Supported in the LabVIEW Run-Time Engine Yes
Supported on RT targets No


t = 0:0.01:10*pi;
z = sin(50*t.^2);
wavwrite(z, 'C:\chirp');
clear z;
z = wavread('C:\chirp');
plot(t, z)

Related Topics



Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit