Avoid multiple simulink outputs overwriting
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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
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
Respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!