Saving data in Model Workspace

2 次查看(过去 30 天)
Deepak
Deepak 2012-2-10
Hello, I wish to save some variables in Model Workspace Programatically. I am currently using Matlab 2009b. Unfortunately the help files are not too clear on this subject. My problem is that I create several hundred parameters in the Matlab base workspace using a textread function. In order to avoid cluttering the base workspace I wish to execute function directly in the model when it is opened and load all the parameters directly in the Model Workspace. So for example currently I follow the following steps. 1. Run function ImportTextFile , this loads the parameters in Matlabworkspace. 2. Open Model and simulate. The problem is that the Simulink Model is standardised for several variants and the ImportTextFile is used only in some special cases. So I wish to change the model file programatically so that only in the special cases it will use ImportTextFile directly to load the parameters in ModelWorkspace. Could someone advice how this could be done. Any help will be appreciated. Thanks.

回答(1 个)

Kaustubha Govind
Kaustubha Govind 2012-2-10
See the Using MATLAB Commands to Change Workspace Data section. You should be able to set the Data Source to 'MATLAB File' or 'MATLAB Code' to load your parameters using ImportTextFile.

类别

Help CenterFile Exchange 中查找有关 Modeling 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by