필터 지우기
필터 지우기

how to fix matlab Function Block Issue ??

조회 수: 2 (최근 30일)
zubair younas
zubair younas 2019년 4월 8일
i am using MATLAB FUNTion Block as a rely for my model such as
function y = fcn(P,T)
if(T <= 12.0)
y=1;
else
if (P <= 4800000)
y=0;
else
y=1;
end
end
and it is working very well
but i want to use Mean of 5 Maximum peaks value for a specific interval
so i am using following code in my matlab function block
function y = fcn(P,T)
if(T <= 12.0)
y=1;
else
if ((mean(maxk(findpeaks(P((T >= 12) & (T <= 12.1))),5))) <= 4800000)
y=0;
else
y=1;
end
end
but where ever i put this command {(mean(maxk(findpeaks(P((T >= 12) & (T <= 12.1))),5)))} in matlab function error appear where as this command is working properly in command window
this is the error i am facing and i am unable to understand how i can fix it
Function 'maxk' is not supported for code generation. Consider adding coder.extrinsic('maxk') at the top of the function to bypass code generation

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by