How can I use a variable to set the file name using Simulink's "too file" block?
15 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I am using Matlab 2020a to create a model and place the pertaent data into a file. My plan is to automate running the model via Matlab. Each time the model is run via Matlab certain variables in the model are changed. This has worked perfectly thus far with the exception of changing the name of the data file writen via simulink's "too file" function. If I set the variable A="test.data" in matlab and set the file name field in "too file" to A (note the lack of quotes), the resulting file created will be called "A.data" rather than "test.data". I do not know how to fix this issue.
If this is a bug that is fixed in newer versions of Matlab please let me know as I do have access to the latest release but have not updated.
Thank you,
Ajay Mehta
0 件のコメント
回答 (1 件)
Fangjun Jiang
2022 年 9 月 14 日
As for as I know, what you imagined can not be done. In your MATLAB script, you have to modify the parameter of the "ToFile" block to change the file name. Including this in the loop of your script should be able to achive what you want.
set_param('ToFileBlockPath','FileName','A1.mat')
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Simulink Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!