Skip to content

Instantly share code, notes, and snippets.

@Arth-ur
Last active May 22, 2017 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arth-ur/03f102fdf0ece129f83559eab621a988 to your computer and use it in GitHub Desktop.
Save Arth-ur/03f102fdf0ece129f83559eab621a988 to your computer and use it in GitHub Desktop.
function kvf2tex2( kvf, fout, rootkey)
%KVF2TEX2
if nargin > 1
rootkey = [rootkey '.'];
else
rootkey = '';
end
TEMPLATE = '\\@lookupPut{%s%s}{%s}\n';
hfout = fopen(fout, 'w+');
fprintf(hfout, '\\makeatletter\n');
fields = fieldnames(kvf);
for i=1:numel(fields)
fprintf(hfout, TEMPLATE, rootkey, fields{i}, kvf.(fields{i}));
end
fprintf(hfout, '\\makeatother\n');
fclose(hfout);
end
function kvfprint( kvf )
%KVFPRINT Print structure
fields = fieldnames(kvf);
for i=1:numel(fields)
fprintf('%s = %s\n', fields{i}, kvf.(fields{i}));
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment