Question
I have a list of parameters that my Simulink model uses during simulation. I would like to export the parameters from the base workspace to an Excel sheet with the first column containing the parameter names and the second column containing the parameter values. What is a possible method for accomplishing this?
Expert Answer
Prashant Kumar
PhD Expert
Answered Aug 25, 2026
The "who" function can be used to get the current parameter names from the base workspace. The values of these parameters can be determined by evaluating each parameter string name in the base workspace. Finally, a cell array with the parameter names and values can be constructed and saved to an Excel spreadsheet via the "xlswrite" function.
To demonstrate a basic workflow, see the following example:
% Clear all variables to start fresh, for example
clear all; % If other variables are in the workspace, they should be removed
% Generate arbitrary parameters
Kp = 1;
Ki = 0.1;
Kd = 0.01;
% Get all variables in the workspace
varNames = who;
varNames = flipud(varNames); % The "who" function flips the order of parameters, "flipup" returns this order to default
for i = 1:numel(varNames),
cellToSave{i,1} = varNames{i}; % Add parameter names to first column of cell
cellToSave{i,2} = eval(varNames{i}); % Add parameters values to second column of cell
end
% Specify the file name
filename = 'Controller_Parameters.xlsx';
xlswrite(filename,cellToSave);
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related Simulink Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →