필터 지우기
필터 지우기

Avoid multiple simulink outputs overwriting

조회 수: 6 (최근 30일)
Antonio Tricarico
Antonio Tricarico 2021년 9월 27일
댓글: Mathieu NOE 2021년 9월 28일
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
Antonio Tricarico
Antonio Tricarico 2021년 9월 27일
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 2021년 9월 28일
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

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Schedule Model Components에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by