Can't save Simulink simulation results after changing parameter

조회 수: 2 (최근 30일)
Tomtom
Tomtom 2016년 3월 26일
댓글: Tomtom 2016년 3월 28일
Hey everybody,
so I have a Simulink simulation where I vary a parameter
for i=1:length(parameter)
Input_var=parameter(i)
sim(modelname)
simout_store(:,i)=simout(:,1) %simout is a "to workbench" output in the simulation
end
But all I get is this error "Subscripted assignment dimension mismatch." How can I fix this? I just want to save the results after every simulation before it gets overridden

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 3월 27일
Use a cell array
simout_store{i}=simout(:,1)
  댓글 수: 3
Azzi Abdelmalek
Azzi Abdelmalek 2016년 3월 28일
If the step time is not fixed, you can get any number of samples
Tomtom
Tomtom 2016년 3월 28일
Jepp that will be the problem...
set_param(modelname,'SolverType','Variable-Step');
set_param(modelname,'maxstep','0.0015');
set_param(modelname,'minstep','auto');
set_param(modelname,'Solver','ode23s');
set_param(modelname,'StartTime','0');
set_param(modelname,'StopTime','10');
What would be better settings? If I want to:
plot(simout_time,simout_store{1,1})
I still get an error because simout_time is 1 shorter than simout_store.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Configure and View Diagnostics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by