title: Clever way to assign multiple fields at once?
body: <p>Due to legacy function calls I'm sometimes forced to write ugly wrappers like this</p>
  
  <pre><code>function return = someWrapper(someField)
  
  a = someField.a;
  b = someField.b;
  % and so on, realistically it's more like ten variables that
  % could actually be grouped in a struct
  
  save('params.mat', 'a', 'b'); %etc.
  
  % then, on another machine, a function loads params.mat, does the calculations
  % and saves the result in result.mat containing the variables c,d,...
  
  load('result.mat', 'c', 'd');
  return.c = c;
  return.d = d;
  % again, it's more than just two return values
  </code></pre>
  
  <p>So the basic idea is to create variables with the same names as <code>someField</code>'s fieldnames, run a function and create a <code>return</code> structure using <code>someFunction</code>'s return variable's names as fieldnames.</p>
  
  <p>Is there some way simplify this using some loop e.g. over <code>fieldnames(someField)</code>?</p>
  
  <hr>
  
  <p>Or should I  actually use some different approach? Since some further processing is done with <code>someField</code> and <code>result</code> I'd like to keep using structs, but maybe a second question would be</p>
  
  <p>Can <code>save</code> and <code>load</code> redirect varibale names? I.e. could e.g. the variable <code>a</code> in params.mat be stored using <code>someField.a</code> as value instead of having to assign <code>a = someField.a</code> first?</p>