Simulink 'To File' Dynamic File Names

I have an m-file that is executing a .mdl file in a nested for loop. Inside the mdl file I have my output being saved to a file using the 'To File' block. How do I get the filename in the 'To File' block to increment/change with the counters in the m-file?

 채택된 답변

TAB
TAB 2012년 4월 17일

4 개 추천

Try in this way
for x=1:n
% Change the file name
fname = ['file' num2str(x) '.mat'];
set_param('ToFile block path','Filename',fname);
% RUN the model
end

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Simulink에 대해 자세히 알아보기

질문:

2012년 4월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by