フィルターのクリア

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 Center および File ExchangeSchedule Model Components についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by