I have several Simulink models in different folders and I need to load all of them in the Matlab, one after the other. To this goal, I have used the following code.
addpath(genpath(strcat('\ConfigsSimulinkModels')));
init; %Initialize variables
for i=1:24
correctModel=strcat('ConfigsSimulinkModels/C0000',int2str(i),'/TanksModel0000',int2str(i));
load_system(correctModel);
set_param(correctModel,'StopTime',300);
close_system(correctModel);
end
When I run the code, it shows the following error.
Invalid Simulink object name: ConfigsSimulinkModels/C00001/TanksModel00001
I am pretty sure that it happens because the models are in the folders and subfolders. Is there any way to load a Simulink model into the memory in Matlab while the models are in other folders or subfolders? By the way, I cannot put the models in the same folder.