LoadParams.m 544 B

12345678910111213141516171819
  1. % function LoadParams:
  2. % load parameters from a file. Each parameter has a name at the left of the equal sign
  3. % and a value at the right. Also all the parameters are converted to lower case
  4. %
  5. % input:
  6. % paramfile - file containg the parameters
  7. %
  8. % output:
  9. % params - a struct that has the parameter names as fields
  10. function params = LoadParams(paramfile)
  11. % load data
  12. input = importdata(paramfile,'=');
  13. % populate params
  14. for i=1:size(input.data,1);
  15. params.(input.textdata{i,1}) = input.data(i);
  16. end
  17. end