Matlab how to iterate through all objects in a workspace?

You can get the list of all the variables as string using who.

You can get the list of all the variables as string using who: myvars = who; then if you want to do something with the content of the variables (who gives variable names only), you can do something like this: for i=1:length(myvars) myfunction(eval(myvars(i))) end.

I agree with @Simon's answer, however if all you are interested in are variables that are loaded from a single . Mat file, you may be better off using the struct-assignment form of load: S = load('myfile. Mat') Now instead of getting 'x', 'y', 'z' in your workspace, you have S.

X, S. Y and S.z. You can then iterate all the fields of the struct with: for f = fieldnames(S)' disp('Field named: ' f{1} ); disp('Has value ') disp(S.(f{1})); end.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions