matlab function block Unable to call function?

I'm trying to write some custom matlab program in simulink via a matlab function block, and the function in the block calls another function ”logSensorSubFcn“, but I get Error "undefined function myFcn for " input arguments of type "uint8". I tried to pass all arguments in with type "double", but it still gives me a similar undefined error. Here is the diagram of my model and the corresponding block function. (run in R2022a)
function myfun(tout,img,loc,ori) % MATLAB Function block programs
coder.extrinsic("logSensorSubFcn");
logSensorSubFcn(tout,img,loc,ori)
end
function logSensorSubFcn(tout,img,loc,ori)
Omitted...
end

 채택된 답변

xingxingcui
xingxingcui 2022년 7월 10일
편집: xingxingcui 2022년 7월 10일

0 개 추천

The matlab function block in simulink has a "new feature syntax restriction" compared to the matlab general function. If there is another called function, the called function should be placed in a separate m-file in the current working directory or in a directory that matlab recognises.
By the way, the control of writing programs in simulink has many restrictions compared to matlab and is not free and easy to use. For example, the processing of time series in simulink still uses the "timeseries" object, which has not been updated to the new "timetable" object function of the main matlab module in recent years.

추가 답변 (0개)

카테고리

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

제품

릴리스

R2022a

질문:

2022년 7월 10일

편집:

2022년 7월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by