I would like the output of parsim to be saved to a file rather than to the workspace, as my simulation output is quite large and I need to run many iterations, all of which will occupy inordinate amounts of memory.
Currently, I have the following code:
for ii = 1:number_runs
inObj(ii) = Simulink.SimulationInput(mdl);
inObj(ii) = inObj(ii).setModelParameter(‘LoggingToFile’, ‘on’);
inObj(ii) = inObj(ii).setModelParameter(‘LoggingFileName’, ‘c:tmplogfilesrun’]);
inObj(ii) = inObj(ii).setVariable(‘some_variable’,randn(1));
end
parsim(inObj, …
‘ShowSimulationManager’, ‘off’, …
‘UseFastRestart’,’on’, …
‘TransferBaseWorkspaceVariables’, ‘on’);
The output of parsim appears in the default workspace variable ans as an array of SimulationOutput objects. I also see a set of files, c:tmplogfilesrun_1, etc. which contain simulation metadata, but not the simulation output that I want.
How do I cause the data that appears in ans to be written to a set of files instead?I would like the output of parsim to be saved to a file rather than to the workspace, as my simulation output is quite large and I need to run many iterations, all of which will occupy inordinate amounts of memory.
Currently, I have the following code:
for ii = 1:number_runs
inObj(ii) = Simulink.SimulationInput(mdl);
inObj(ii) = inObj(ii).setModelParameter(‘LoggingToFile’, ‘on’);
inObj(ii) = inObj(ii).setModelParameter(‘LoggingFileName’, ‘c:tmplogfilesrun’]);
inObj(ii) = inObj(ii).setVariable(‘some_variable’,randn(1));
end
parsim(inObj, …
‘ShowSimulationManager’, ‘off’, …
‘UseFastRestart’,’on’, …
‘TransferBaseWorkspaceVariables’, ‘on’);
The output of parsim appears in the default workspace variable ans as an array of SimulationOutput objects. I also see a set of files, c:tmplogfilesrun_1, etc. which contain simulation metadata, but not the simulation output that I want.
How do I cause the data that appears in ans to be written to a set of files instead? I would like the output of parsim to be saved to a file rather than to the workspace, as my simulation output is quite large and I need to run many iterations, all of which will occupy inordinate amounts of memory.
Currently, I have the following code:
for ii = 1:number_runs
inObj(ii) = Simulink.SimulationInput(mdl);
inObj(ii) = inObj(ii).setModelParameter(‘LoggingToFile’, ‘on’);
inObj(ii) = inObj(ii).setModelParameter(‘LoggingFileName’, ‘c:tmplogfilesrun’]);
inObj(ii) = inObj(ii).setVariable(‘some_variable’,randn(1));
end
parsim(inObj, …
‘ShowSimulationManager’, ‘off’, …
‘UseFastRestart’,’on’, …
‘TransferBaseWorkspaceVariables’, ‘on’);
The output of parsim appears in the default workspace variable ans as an array of SimulationOutput objects. I also see a set of files, c:tmplogfilesrun_1, etc. which contain simulation metadata, but not the simulation output that I want.
How do I cause the data that appears in ans to be written to a set of files instead? parsim MATLAB Answers — New Questions
