Code generation does not support changing types through assignment
56 次查看(过去 30 天)
显示 更早的评论
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163124/image.png)
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 :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163126/image.png)
the MATLAB code is attached.
can anybody help me on this ?
regards
0 个评论
回答(1 个)
Ethem
2016-5-31
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Communications Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!