Borrar filtros
Borrar filtros

Avoid multiple simulink outputs overwriting

6 visualizaciones (últimos 30 días)
Antonio Tricarico
Antonio Tricarico el 27 de Sept. de 2021
Comentada: Mathieu NOE el 28 de Sept. de 2021
Good morning everybody,
I need a tip for my code: I'm running a simulink model from a matlab script whose inputs depend on several switch commands. I'd like to save the model outputs in one cell for each iteration (I mean for each switch case). I've tried with the code below: a and b are my inputs, which depend on 4 cases op_point and 11 cases i, so at the end I should get 4x11 cells for each output (States, States1, Outputs, Und_par, PLA_out). But I do not obtain any cell, only a matrix, as if each iteration overwrites the previous results. How can I retain all past iterations in cells?
Thanks
try sim('mymodel')
for t=1:size((States),1)
a{op_point,i}(t,:)=inp2{1,op_point};
b{op_point,i}(t,:)=Inp{1,i};
c{op_point,i}(t,:)=[States{op_point,i}(:,:)];
d{op_point,i}(t,:)=[States1{op_point,i}(:,:)];
e{op_point,i}(t,:)=[Outputs{op_point,i}(:,:)];
f{op_point,i}(t,:)=[Und_par{op_point,i}(:,:)];
g{op_point,i}(t,:)=[PLA_out{op_point,i}(:,:)];
end
end
  3 comentarios
Antonio Tricarico
Antonio Tricarico el 27 de Sept. de 2021
I have already done the for loop to switch parameters, in fact if I open a scope from the model I can see that outputs actually change at each iteration. The problem is how to save all of them for each case, since they become always overwritten and not stored in cells as I wish.
Mathieu NOE
Mathieu NOE el 28 de Sept. de 2021
hello again
so could you save the full simulink output along with the iteration index
then it should be easy from matlab to split the data into piece based on what "iteration" is (from the record

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Schedule Model Components 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