Mercurial > hg > ishara
view general/fileutils/loadmat.m @ 61:eff6bddf82e3 tip
Finally implemented perceptual brightness thing.
author | samer |
---|---|
date | Sun, 11 Oct 2015 10:20:42 +0100 |
parents | 9e7be347b3a0 |
children |
line wrap: on
line source
function varargout=loadmat(file,varargin) % loadmat - hygienic loading from mat files % % The point of this function is to load certain named variables % from a Mat file without polluting the current environment with % other objects from the Mat file or having name clashes. % % loadmat :: text ~'filename', text~'variable name' -> object~'something'. % loadmat :: % text ~'filename', % {[N]->text} ~'list of variable names' % -> {[N]->object} ~'list of things'. % % Vararg form (not well typed) % % [X,Y,Z,...]=loadmat(Filename,var1,var2,var,...); % % NB. Matlab's load can now do this. load(file); for j=1:length(varargin) var=varargin{j}; if iscell(var), X__=cell(1,length(var)); for k=1:length(var) eval(sprintf('X__{%d}=%s;',k,var{k})); end varargout{j}=X__; else eval(['varargout{j}=' var ';']); end end