Skip to content
Snippets Groups Projects
Commit fd73d447 authored by Laura Nervo's avatar Laura Nervo Committed by Nicola Vigano
Browse files

print_structure : changed index 'i','j' into 'ii','jj'


Signed-off-by: default avatarLaura Nervo <laura.nervo@esrf.fr>
parent bd02b82a
No related branches found
No related tags found
No related merge requests found
...@@ -8,8 +8,8 @@ function print_structure(structure, structurename, save, debug) ...@@ -8,8 +8,8 @@ function print_structure(structure, structurename, save, debug)
% INPUT: % INPUT:
% structure = structure to be printed <struct> % structure = structure to be printed <struct>
% structurename = its name <string> % structurename = its name <string>
% save = % save = {false}
% debug = % debug = {true}
if ~exist('structurename','var') || isempty(structurename) if ~exist('structurename','var') || isempty(structurename)
structurename='parameters'; structurename='parameters';
...@@ -30,34 +30,34 @@ if save ...@@ -30,34 +30,34 @@ if save
diary('on'); diary('on');
end end
for i=1:length(names) for ii=1:length(names)
isin=false; isin=false;
%out.odisp([structurename '.' names{i}]) %out.odisp([structurename '.' names{i}])
if isstruct(structure.(names{i})) if isstruct(structure.(names{ii}))
isin=true; isin=true;
subnames=fieldnames(structure.(names{i})); subnames=fieldnames(structure.(names{ii}));
for j=1:length(subnames) for jj=1:length(subnames)
isin=false; isin=false;
%out.odisp([names{i} '.' subnames{j}]) %out.odisp([names{i} '.' subnames{j}])
if isstruct(structure.(names{i}).(subnames{j})) if isstruct(structure.(names{ii}).(subnames{jj}))
isin=true; isin=true;
subsubnames=fieldnames(structure.(names{i}).(subnames{j})); subsubnames=fieldnames(structure.(names{ii}).(subnames{jj}));
for k=1:length(subsubnames) for kk=1:length(subsubnames)
isin=false; isin=false;
%out.odisp([names{i} '.' subnames{j} '.' subsubnames{k}]) %out.odisp([names{i} '.' subnames{j} '.' subsubnames{k}])
if isstruct(structure.(names{i}).(subnames{j}).(subsubnames{k})) if isstruct(structure.(names{ii}).(subnames{jj}).(subsubnames{kk}))
isin=true; isin=true;
subsubsubnames=fieldnames(structure.(names{i}).(subnames{j}).(subsubnames{k})); subsubsubnames=fieldnames(structure.(names{ii}).(subnames{jj}).(subsubnames{kk}));
for l=1:length(subsubsubnames) for ll=1:length(subsubsubnames)
isin=false; isin=false;
%out.odisp([names{i} '.' subnames{j} '.' subsubnames{k} '.' subsubsubnames{l}]) %out.odisp([names{i} '.' subnames{j} '.' subsubnames{k} '.' subsubsubnames{l}])
if isstruct(structure.(names{i}).(subnames{j}).(subsubnames{k}).(subsubsubnames{l})) if isstruct(structure.(names{ii}).(subnames{jj}).(subsubnames{kk}).(subsubsubnames{ll}))
isin=true; isin=true;
subsubsubsubnames=fieldnames(structure.(names{i}).(subnames{j}).(subsubnames{k}).(subsubsubnames{l})); subsubsubsubnames=fieldnames(structure.(names{ii}).(subnames{jj}).(subsubnames{kk}).(subsubsubnames{ll}));
for m=1:length(subsubsubsubnames) for mm=1:length(subsubsubsubnames)
isin=false; isin=false;
%out.odisp([names{i} '.' subnames{j} '.' subsubnames{k} '.' subsubsubnames{l} '.' subsubsubsubnames{m}]) %out.odisp([names{i} '.' subnames{j} '.' subsubnames{k} '.' subsubsubnames{l} '.' subsubsubsubnames{m}])
if isstruct(structure.(names{i}).(subnames{j}).(subsubnames{k}).(subsubsubnames{l}).(subsubsubsubnames{m})) if isstruct(structure.(names{ii}).(subnames{jj}).(subsubnames{kk}).(subsubsubnames{ll}).(subsubsubsubnames{mm}))
isin=true; isin=true;
out.odisp('Limit to down to the fifth level...') out.odisp('Limit to down to the fifth level...')
else else
...@@ -65,37 +65,42 @@ for i=1:length(names) ...@@ -65,37 +65,42 @@ for i=1:length(names)
end end
end % level 5 end % level 5
if ~isin if ~isin
out.odisp([structurename '.' names{i} '.' subnames{j} '.' subsubnames{k} '.' subsubsubnames{l}]) out.odisp([structurename '.' names{ii} '.' subnames{jj} '.' subsubnames{kk} '.' subsubsubnames{ll}])
out.odisp(structure.(names{i}).(subnames{j}).(subsubnames{k}).(subsubsubnames{l})) out.odisp(structure.(names{ii}).(subnames{jj}).(subsubnames{kk}).(subsubsubnames{ll}))
end end
else else
isin=false; isin=false;
end end
end % level 4 end % level 4
if ~isin if ~isin
out.odisp([structurename '.' names{i} '.' subnames{j} '.' subsubnames{k}]) out.odisp([structurename '.' names{ii} '.' subnames{jj} '.' subsubnames{kk}])
out.odisp(structure.(names{i}).(subnames{j}).(subsubnames{k})) out.odisp(structure.(names{ii}).(subnames{jj}).(subsubnames{kk}))
end end
else else
isin=false; isin=false;
end end
end % level 3 end % level 3
if ~isin if ~isin
out.odisp([structurename '.' names{i} '.' subnames{j}]) out.odisp([structurename '.' names{ii} '.' subnames{jj}])
out.odisp(structure.(names{i}).(subnames{j})) out.odisp(structure.(names{ii}).(subnames{jj}))
end end
else else
isin=false; isin=false;
end end
end % level 2 end % level 2
if ~isin if ~isin
out.odisp([structurename '.' names{i}]) out.odisp([structurename '.' names{ii}])
out.odisp(structure.(names{i})) out.odisp(structure.(names{ii}))
end end
out.odisp(' '); out.odisp(' ');
else
isin = false;
end end
end % level 1 end % level 1
if ~isin
out.odisp(structurename)
out.odisp(structure)
end
if debug if debug
diary('off'); diary('off');
......
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