Reputation: 1571
i used for loops :
for i=1:length(thetas)
theta = thetas(i); % Utility function
for j=1:length(rhos)
rho = rhos(j);
for ii=1:length(gammas)
gamma = gammas(ii);
[kss]=equilibirum(debt)wherein
end
end
end
where in each step I essentially change some parameter values to get different values for the column vector kss
(size: 10000x1)
e.g the vector of parameters I am looping over are:
thetas = [1, 1.5];
rhos = [0, 0.99, 2];
gammas = [-1,0,0.76, 0.9, 1] ;
I want to remember (or store) for which combination of parameters i get the values for `kss'.
How can I do this Matlab in some easy to understand and easy to export (e.g. in Excel) way? An ideal solution, will make my result look like a data frame object as in python(pandas) or R
Upvotes: 0
Views: 41
Reputation: 321
You can use tables in MATLAB to describe what you wish to accomplish.
kss_table = table;
counter = 1;
for i=1:length(thetas)
theta = thetas(i); % Utility function
for j=1:length(rhos)
rho = rhos(j);
for ii=1:length(gammas)
gamma = gammas(ii);
kss = equilibirum(debt)wherein
kss_table.Theta(counter) = theta;
kss_table.Rho(counter) = rho;
kss_table.Gamma(counter) = gamma;
counter = counter + 1;
end
end
end
Upvotes: 1