help for using simulink and usrp
이전 댓글 표시
I want transmit an image using Simulink and USRP. I have the following code
%if true
function msg = genMsg
persistent imgmatRows imgmatCols imgvec msgBin msgBinRows msgBinCols msgTmp;
coder.extrinsic('imread');
if isempty(imgvec)
imgmat = imread('cameraman.tif');
[imgmatRows, imgmatCols] = size(imgmat);
imgvec = reshape(imgmat, 1, imgmatRows * imgmatCols);
msgBin = de2bi(int8(imgvec), 7, 'left-msb');
[msgBinRows, msgBinCols] = size(msgBin);
msgTmp = reshape(double(msgBin).', msgBinRows*msgBinCols, 1);
end
msg = msgTmp;
When I run this code it produces the following error message:
"Function output 'msg' cannot be an mxArray in this context. Consider preinitializing the output variable with a known type."
How can I fix this problem?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Communications Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!