Skip to content

Instantly share code, notes, and snippets.

@welch
Last active August 27, 2015 23:03
Show Gist options
  • Save welch/2931132e66c0e2cdb364 to your computer and use it in GitHub Desktop.
Save welch/2931132e66c0e2cdb364 to your computer and use it in GitHub Desktop.
function pairs = readzmax(FileName)
fileID = fopen(FileName);
% read the file data
vals = fileread(FileName);
fclose(fileID);
% Convert to string
dstr = sprintf('%s',vals);
% keep only lens data
GLDstart = regexp(dstr, 'GENEARL LENS DATA:','end');
dstr = dstr(GLDstart+2:end);
Fieldstart = regexp(dstr, 'Fields','start');
dstr = dstr(1:Fieldstart-2);
lines = regexp(dstr, '\n', 'split');
% parse the lines into name/value
pairs = regexp(lines, '(?<name>[^:]*):\s*(?<value>\S*)', 'names');
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment