corr2 on simulink don't code genaration

The function 'corr2' is not supported for standalone code generation. See the documentation for coder.extrinsic to learn how you can use this function in simulation.
what function can replace this function on the simulink simulation?

 Respuesta aceptada

Birdman
Birdman el 18 de Oct. de 2017

0 votos

There is the necessary function and its embedded model in a MATLAB Function in Simulink. Hope this helps. You need to have the m file and the model at the same directory.

11 comentarios

tsai kai shung
tsai kai shung el 19 de Oct. de 2017
thanks your help
tsai kai shung
tsai kai shung el 19 de Oct. de 2017
sorry i use this function run on the matlab show the error message: Error using * Inner matrix dimensions must agree.
Error in Corr3 (line 5) rNum(i)=((A(i)-A_0)*(B(i)-B_0));
Error in OCR (line 55) sem=Corr3(templates(1:42,n:n+23),img_r);
Birdman
Birdman el 19 de Oct. de 2017
It should work just fine. Make sure that arrays are the same length
Walter Roberson
Walter Roberson el 19 de Oct. de 2017
It looks to me like the inputs must be vectors?
Birdman
Birdman el 19 de Oct. de 2017
The inputs are vectors.
tsai kai shung
tsai kai shung el 19 de Oct. de 2017
my input is array!so how to change this function
Birdman
Birdman el 19 de Oct. de 2017
Define nx1 array, which means vector.
tsai kai shung
tsai kai shung el 19 de Oct. de 2017
how to define
tsai kai shung
tsai kai shung el 19 de Oct. de 2017
Editada: Walter Roberson el 19 de Oct. de 2017
function r = Corr2(A,B)
A = A - mean2(A);
B = B - mean2(B);
r = sum(sum(A.*B))/sqrt(sum(sum(A.*A))*sum(sum(B.*B)));
end
i use this can normal run
Birdman
Birdman el 19 de Oct. de 2017
A=[1 2 3 4] and B=[3 4 5 6]. In constant block in simulink, just type the array, don't write A=[1 2 3 4]. Write [1 2 3 4] only.
tsai kai shung
tsai kai shung el 20 de Oct. de 2017
i use the BWimage input

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Simulink en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 18 de Oct. de 2017

Comentada:

el 20 de Oct. de 2017

Community Treasure Hunt

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

Start Hunting!