Hi, I want to transmit an image using Simulink and USRP. I have the following code. But when I run this code, MATLAB produces following error. How can ı fix this problem?
1 次查看(过去 30 天)
显示 更早的评论
function msg = genMsg %#codegen persistent imgmatRows imgmatCols imgvec msgBin msgBinRows msgBinCols msgTmp;
coder.extrinsic('imread'); % count; if isempty(imgvec) %count = 0; 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; Error message: "Function output 'y' cannot be an mxArray in this context. Consider preinitializing the output variable with a known type."
回答(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!