function [U,w] = read_uw(fname) if strcmp(inputname(1),'fstr') % this is why i love matlab so much fstr = fname; else fstr = file2str(fname); end ee = text2cell_adv(fstr,'',[char(13) char(10)]); U = {}; w = []; for i=1:length(ee) e = ee{i}; % ignore entries not containing '=' b = 1; b = b & ~isempty(findstr(e,'=')); b = b & ~isempty(findstr(e,'[')); if b cc = text2cell_adv(e,'','[]',1); u = cc{2}; u = strrep(u,' ',''); U{end+1} = u; cc = text2cell_adv(e,'','='); w(end+1) = str2num(cc{end}); end end U=U(:); w=w(:); return