Skip to content
Snippets Groups Projects
Commit 5c995789 authored by Federico Felici's avatar Federico Felici
Browse files

Avoid adding same algoobj to list twice

parent b0ca1818
No related branches found
No related tags found
No related merge requests found
......@@ -245,7 +245,7 @@ classdef SCDclass_algo
function printinits(obj)
if(~isempty(obj.stdinits))
for ii=1:numel(obj.stdinits)
fprintf('%s -> %s in workspace %s \n',char(obj.stdinits{ii}{1}),char(obj.stdinits{ii}{2},obj.stdinits{ii}{3}));
fprintf('%s -> %s in workspace %s \n',char(obj.stdinits{ii}{1}),char(obj.stdinits{ii}{2}{1}),char(obj.stdinits{ii}{3}));
end
end
end
......
......@@ -399,27 +399,29 @@ classdef SCDclass_expcode
% Importing inits
algoinits=algo.getinits;
if(numel(algoinits)>0)
for ii=1:numel(algoinits)
toadd=1;
if(~isempty(obj.stdinits))
for jj=1:numel(obj.stdinits)
for kk=1:numel(obj.stdinits{jj}{2})
if(strcmp(char(obj.stdinits{jj}{2}{kk}),algoinits{ii}{2}))
warning('SCDclass_expcode:addalgorithm','An init driving the structure %s has already been added, ignoring algorithm object.\d',algoinits{ii}{2})
toadd=0;
end
end
end
end
if(toadd)
temp=cell(10,1);
temp{1}=algoinits{ii}{1};
temp{2}=algoinits{ii}{2};
obj.stdinits{end+1}=temp;
obj.algoobjlist{end+1}=algo; %% Add the full algorithm object here, to see if it is fine
toadd = ones(numel(algoinits),1);
for ii=1:numel(algoinits)
if(~isempty(obj.stdinits))
for jj=1:numel(obj.stdinits)
for kk=1:numel(obj.stdinits{jj}{2})
if(strcmp(char(obj.stdinits{jj}{2}{kk}),algoinits{ii}{2}))
warning('SCDclass_expcode:addalgorithm','An init driving the structure %s has already been added, ignoring this init.\d',algoinits{ii}{2})
toadd(ii)=0;
end
end
end
end
end
if toadd(ii)
temp=cell(10,1);
temp{1}=algoinits{ii}{1};
temp{2}=algoinits{ii}{2};
obj.stdinits{end+1}=temp;
end
end
if any(toadd) % if any inits from this algoobj were taken
obj.algoobjlist{end+1}=algo; %% Add the full algorithm object here, to see if it is fine
end
end
end
function out = getexportedtps(obj)
......
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