Skip to content

Instantly share code, notes, and snippets.

@welch welch/extract.m
Last active Aug 27, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.