Borrar filtros
Borrar filtros

Size mismatch for MATLAB expression 'unique'. Expected = 1x1 Actual = 8x1

32 visualizaciones (últimos 30 días)
kajal shah
kajal shah el 6 de Feb. de 2017
Respondida: cr el 6 de Feb. de 2017
I am working on embedded function matlab (simulink), I want to find unique values of matrix pbatt_const_Pb_filter. The body of my code is
coder.extrinsic('unique');
A=pbatt_const_Pb_filter';
pbatt_filt=unique(A(:,1));
and have declared variable as below
Pbatt_filtered_int=zeros(1,100); coder.varsize('Pbatt_filtered_int'); pbatt_filt=Pbatt_filtered_int;
Everytime the error comes'Size mismatch for MATLAB expression 'unique'. Expected = 1x1 Actual = 8x1 "
and when I flip the declaration of variable to Pbatt_filtered_int=zeros(100,1; the error is Call to MATLAB function aborted: A variable-size array input to FIND in MATLAB Code Generation must not reduce to a row vector at run time.
Please suggest

Respuestas (1)

cr
cr el 6 de Feb. de 2017
Size mismatch error is a result of unmatched dimensions in signals. The block being driven by embedded function block is expecting a scalar input but the unique function is producing a vector possibly because there a multiple unique elements in the input matrix.

Categorías

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

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by