how to fix matlab Function Block Issue ??
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!