I have a simulink model that have the outputs x and y. When i run the simulation they give me 500x1 double values. x values are reference values and y values are the outputs that i want to converge them to x. I used genetic algoirthm to optimize output y. There are 5 parameters to optimize outputs y. I want to get x and y values to calculate error(MSE, MAPE , ITAE vs.) for cost function of genetic algorithm. Is there any method to get these output values from simulink to .m file(genetic algorithm runninng in this file)when simulation is running . From .m file to simulink i can adjust the 5 parameters simultaneously by 'set_params' but i can not find for the exact opposite situation.
I solved the problem. I used to matfile from the sinks library and created the subsystem for this block. Then i masked the subsystem asparameter -- Inherit: Same as output Parameter name must be the same with output name . In my genetic algorithm .m file i used
y = get_param('my_model/y','y') %y is also subsystem name
it works. After running the simulation i get the y values each iteration to send ga .m file for optimization.