Download Help (Windows Only) 
Owning Class: filter implementation
Requires: MathScript RT Module
y = quantencode(x, n)
y = quantencode(x, n, r)
y = quantencode(x, n, r, s)
Legacy Name: uencode
Uses quantization to convert floatingpoint inputs to integer outputs. Quantization transforms real floatingpoint numbers into integers. You can use quantencode to solve overflow problems.
Name  Description  

x  Specifies the real or complex numbers to encode. The elements of x must fall in the range [r, r]. LabVIEW treats the elements outside of this range as overflows and saturates the overflows.  
n  Specifies the level of quantization. n is a positive integer between 2 and 32. If n is in the range [2, 8], the output data type is int8/uint8. If n is in the range [9, 16], the output data type is int16/uint16. If n is in the range [17, 32], the output data type is int32/uint32.  
r  Specifies the range of x. r is a positive number. The default is 1.  
s  Specifies the data type of the outputs. s accepts the following values.

Name  Description 

y  Returns the quantized integers. 
quantencode does not accept complex inputs. To encode and decode a complex x, use quantencode and quantdecode separately on the real and imaginary parts of x and then combine the results, as shown in the following example.
X = real(input) %get the real part of the input
Y = imag(input) %get the imaginary part of the input
X = quantencode(X, 4, 1, 'unsigned') %encode X
Y = quantencode(Y, 4, 1, 'unsigned') %encode Y
X = quantdecode(X, 4, 1, 'wrap') %decode X
Y = quantdecode(Y, 4, 1, 'wrap') %decode Y
output = complex(X, Y) %combine the real and imaginary parts
The following table lists the support characteristics of this function.
Supported in the LabVIEW RunTime Engine  Yes 
Supported on RT targets  Yes 
Suitable for bounded execution times on RT  Not characterized 
X = 1:0.01:1;
Y = quantencode(X, 4, 1, 'signed');
X1 = quantdecode(Y, 4, 1);
plot(X, X1)