Well, apparently I was wrong when saying that in another block it didn't get disconnected.
Anyway, I finally solved the problem by including another condition to get into the if :
if strcmp(get_param(gcb,'append_element'),'on') &&...
~strcmp(get_param([gcb '/Signals +1'],'BlockType'),'Outport')
[...]
elseif strcmp(get_param(gcb,'append_element'),'off') &&...
~strcmp(get_param([gcb '/Signals'],'BlockType'),'Outport')
[...]
end
Basically it is checking if it has to execute a change in the outputs. If not, the code is not getting into the if.
Cheers!