how to load this function into simulink

1 visualización (últimos 30 días)
arsal javed
arsal javed el 10 de Jul. de 2022
Comentada: Paul el 10 de Jul. de 2022
here us code for the machine learning function
function y = predictActivity(u)%#codegen
persistent n;
if isempty(n)
n = loadLearnerForCoder('EnsembleModel.mat');
end
y = predict(n,u);
end
i am suppossed to give it a 1X5 matrix by which it will predict the output
when i do it in command line it works but when i do it in simulink i get errrors
making value is function that makes a 1X5 matrix
it is given by
function y=making_values_input(a,b,c,d,e)
y=[a,b,c,d,e]
end
when i run the simulation i get the following errrors
plz tell me what im doing wrong i have been stuck on it for 5 weeks help me on this
thanks

Respuestas (1)

Paul
Paul el 10 de Jul. de 2022
Hi arsal
Though not required, you can replace the function making_values_input with a Mux block.
Double click on predictActivity. In the editor, under the Function tab click on Edit Data. In the pane that opens you can click on y and u and explicitly specify the dimensions of each. relevant doc page
Maybe that will do the trick.
You also might need to declare the function predict() as extrinsic doc page
  3 comentarios
arsal javed
arsal javed el 10 de Jul. de 2022
i sepcified the dimmensions now im getting these errors
Paul
Paul el 10 de Jul. de 2022
Try to declare loadLearnerForCoder as extrinsic. Doc page in comment above.

Iniciar sesión para comentar.

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by