Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

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?

Asked by Volkan on 5 Feb 2013

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."

Volkan

Products

No products are associated with this question.

0 Answers

Contact us