MATLAB: How can i save the output in simulink

datainputoutputsavesimulink

Hi there,
Is that possible to save multi-output in Simulink? I do have 100 different input. Each input will have different output, and I want to keep all those outputs resulted from 100 different input in a one mat file. Is that possible?
thanks

Best Answer

I think that the best way to accomplish this is set up the Simulink model so that is saves the output to the Matlab workspace using a "To Workspace" block. Then, make a script file that will run the Simulink model, providing the desired inputs. In the script file, after the simulink model has run, put the output into a Matlab structure (you can put the inputs in the structure too). Use a loop in the script file to execute all of the model runs, saving the inputs and outputs each iteration in the data structure. This way, you can hold 100 sets of data (inputs and outputs) in a single structure. When done, save the data structure to a .mat file using the Matlab "save" command.