Communications Toolbox | ![]() ![]() |
Encode an ASCII file using Reed-Solomon code
Syntax
Description
rsencof(file_in,file_out)
encodes the ASCII file file_in
using (127, 117) Reed-Solomon code. The error-correction capability of this code is 5 for each block of 127 codeword characters. This function writes the encoded text to the file file_out
. Both file_in
and file_out
are string variables.
rsencof(file_in,file_out,err_cor)
is the same as the first syntax, except that err_cor
specifies the error-correction capability for each block of 127 codeword characters. The message length is 127 - 2 * err_cor
.
Note
If the number of characters in file_in is not an integer multiple of 127 - 2 * err_cor , then the function appends char(4) symbols to file_out .
|
Examples
The file matlabroot
/toolbox/comm/comm/oct2dec.m
contains text help for the oct2dec
function in this toolbox. The commands below encode the file using rsencof
and then decode it using rsdecof
.
file_in = [matlabroot '/toolbox/comm/comm/oct2dec.m']; file_out = 'encodedfile'; % Or use another filename rsencof(file_in,file_out) % Encode the file. file_in = file_out; file_out = 'decodedfile'; % Or use another filename rsdecof(file_in,file_out) % Decode the file.
To see the original file and the decoded file in the MATLAB workspace, use the commands below (or similar ones if you modified the filenames above).
See Also
rsdecof
![]() | rsenc | rsgenpoly | ![]() |