Skip to content
Snippets Groups Projects
Commit 00bc77c8 authored by Laura Nervo's avatar Laura Nervo
Browse files

print_structure : added ' = ' string next to the structure name


Signed-off-by: default avatarLaura Nervo <laura.nervo@esrf.fr>
parent 5624d9ad
No related branches found
No related tags found
No related merge requests found
function print_structure(structure, structurename, save, debug)
% print_structure(structure,structurename, save, debug)
% -----------------------------------------------------
% print_structure(structure, structurename, save, debug)
% ------------------------------------------------------
% Prints on screen and on a file (if wanted) the content of a structure
% variable, with depth = 5.
%
% Creates [structurename]_struct.txt with list of stuctures inside 'structure'
% Creates [structurename].txt with output from the printing of
% 'structure'
% and [structurename].txt with output from the printing of
% 'structure' if 'save' is true
%
% INPUT:
% structure = structure to be printed <struct>
......@@ -12,7 +15,7 @@ function print_structure(structure, structurename, save, debug)
% debug = {true}
if ~exist('structurename','var') || isempty(structurename)
structurename='parameters';
structurename = 'parameters';
end
if ~exist('save','var') || isempty(save)
save = false;
......@@ -65,7 +68,7 @@ for ii=1:length(names)
end
end % level 5
if ~isin
out.odisp([structurename '.' names{ii} '.' subnames{jj} '.' subsubnames{kk} '.' subsubsubnames{ll}])
out.odisp([structurename '.' names{ii} '.' subnames{jj} '.' subsubnames{kk} '.' subsubsubnames{ll} ' ='])
out.odisp(structure.(names{ii}).(subnames{jj}).(subsubnames{kk}).(subsubsubnames{ll}))
end
else
......@@ -73,7 +76,7 @@ for ii=1:length(names)
end
end % level 4
if ~isin
out.odisp([structurename '.' names{ii} '.' subnames{jj} '.' subsubnames{kk}])
out.odisp([structurename '.' names{ii} '.' subnames{jj} '.' subsubnames{kk} ' ='])
out.odisp(structure.(names{ii}).(subnames{jj}).(subsubnames{kk}))
end
else
......@@ -81,7 +84,7 @@ for ii=1:length(names)
end
end % level 3
if ~isin
out.odisp([structurename '.' names{ii} '.' subnames{jj}])
out.odisp([structurename '.' names{ii} '.' subnames{jj} ' ='])
out.odisp(structure.(names{ii}).(subnames{jj}))
end
else
......@@ -89,7 +92,7 @@ for ii=1:length(names)
end
end % level 2
if ~isin
out.odisp([structurename '.' names{ii}])
out.odisp([structurename '.' names{ii} ' ='])
out.odisp(structure.(names{ii}))
end
out.odisp(' ');
......@@ -98,11 +101,11 @@ for ii=1:length(names)
end
end % level 1
if ~isin
out.odisp(structurename)
out.odisp([structurename ' ='])
out.odisp(structure)
end
if debug
if save
diary('off');
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment