MATLAB: How to discern if the codeword being sent in the C code is correctable

codeword;Communications Toolboxrsdecoder

I have written a function in MATLAB that creates a comm.RSDecoder object. I generate C code for this function and want to find out if the codeword being sent in the C code is correctable. Also, which variable should I look at to get this information?

Best Answer

The step() method of "comm.RSDecoder" has an optional second output (please refer to the first link below), which returns the number of corrected errors. If there is a decoding failure, "-1" will be returned in this ERR output argument. A "-1" value of this output indicates that the codeword is not correctable. This is explained in the details of the "NumCorrectedErrorsOutputPort" property in both the links below:
You need to change your step() call and specify this second output. For example:
>> [msg, numErr] = step(dec,codeword);
Then generate the C code and track down the C variable that corresponds to the "numErr" MATLAB variable.