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?

 채택된 답변

Birdman
Birdman 2017년 10월 18일

0 개 추천

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

tsai kai shung
tsai kai shung 2017년 10월 19일
thanks your help
tsai kai shung
tsai kai shung 2017년 10월 19일
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 2017년 10월 19일
It should work just fine. Make sure that arrays are the same length
Walter Roberson
Walter Roberson 2017년 10월 19일
It looks to me like the inputs must be vectors?
Birdman
Birdman 2017년 10월 19일
The inputs are vectors.
tsai kai shung
tsai kai shung 2017년 10월 19일
my input is array!so how to change this function
Birdman
Birdman 2017년 10월 19일
Define nx1 array, which means vector.
tsai kai shung
tsai kai shung 2017년 10월 19일
how to define
tsai kai shung
tsai kai shung 2017년 10월 19일
편집: Walter Roberson 2017년 10월 19일
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 2017년 10월 19일
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 2017년 10월 20일
i use the BWimage input

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Simulink에 대해 자세히 알아보기

태그

질문:

2017년 10월 18일

댓글:

2017년 10월 20일

Community Treasure Hunt

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

Start Hunting!