How to save to mat file sequentially using a loop and simout?

4 次查看(过去 30 天)
Hi everyone!
I'm getting stuck on a simple part of my code. I have a simulink simulation that exports to Workspace two outputs: Fault and Ir. I'm trying to do a loop to automatically run my simulation and save these outputs. Here's the code:
for i = 1:100
simOut(i) = sim('mymodel');
filename1(i) = 'Fault.mat(i)';
save(filename1)
filename2(i) = 'Ir.mat(i)';
save(filename2)
end
But I'm getting:
Unable to perform assignment because the indices on the left side are not compatible with the size of the right.
How to solve this?
Thank you in advance!

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Environment Customization 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by