Code generation does not support changing types through assignment

72 views (last 30 days)
hello
i hope you all help me in this matter as am stuck for days now .
i have simulink file which have a matlab code that process received frames of data and rebuild the image that has been transferred. Once the appropriate number of frames has been retrieved, the image is then plotted in a figure for the user to observe.
  • the simulink file works perfectly in MATLAB 2014b, now i am using Matlab 2016a and shows me error!!!*
In that code, i think i have problem with one of the functions that call a file named bi2de.m.
the function is
it gives me this error "This assignment writes a 'uint16' value into a 'uint8' type. Code generation does not support changing types through assignment. Check preceding assignments or input type specifications for type mismatches." as seen here :
the MATLAB code is attached.
can anybody help me on this ?
regards

Answers (1)

Ethem
Ethem on 31 May 2016
If your input to bi2de is an integer type, it tried to adjust the output type to make sure the the results fits in. For example, if the input is uint8, and the binary conversion generates a decimal number that is greater than 255 (2^8-1), then the output data type becomes uint16 or unit32.
Make sure that the input data type to bi2de is big enough to hold the output numbers.

Categories

Find more on Communications Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!