Borrar filtros
Borrar filtros

I want to transmit an image using Simulink and USRP

2 visualizaciones (últimos 30 días)
Volkan
Volkan el 7 de Feb. de 2013
function msg = genMsg
%#codegen
persistent msgBinRows msgBinCols msgBin;
coder.extrinsic('imread');
% count;
if isempty(msgBin)
%count = 0;
imgmatRows = 256;
imgmatCols = 256;
imgmat = zeros(imgmatRows,imgmatCols);
imgmat = imread('cameraman.tif');
imgvec = reshape(imgmat, 1, imgmatRows * imgmatCols);
msgBin = de2bi(imgvec, 'left-msb');
[msgBinRows, msgBinCols] = size(msgBin);
end
msg = reshape(double(msgBin).', msgBinRows*msgBinCols, 1);
When I run this code it produces the following error
Data 'msg' (#24) is inferred as a variable size matrix, while its specified type is something else
How can I fix this problem?

Respuestas (1)

Walter Roberson
Walter Roberson el 7 de Feb. de 2013
At the beginning, initialize
msg = zeros(256*256*8, 1);
Warning your de2bi() call really should specify "n".

Categorías

Más información sobre Communications Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by