Friday, March 24, 2017

[Matlab / Simulink] Initialize Simulink parameters

In the model properites of Simulink model, parameters defined in an m script can be loaded using pre-load function shown as below. 
In case paramter file is placed in the different folder where simulink model is not placed, path setting has to be changed.

* Model pre-load fuction
% Get a model path
[pathstr,~,~]=fileparts(get_param(gcs,'filename'));
% Create a parameter file path
path=sprintf('%s%s',pathstr,'\ParameterChanger');
cd(path);
% Load a parameter m script
testp;
cd ..


No comments:

Post a Comment