Hello
I have attached a model that is easier to understand.
Please try following script.
CurrentName = "A";
RequiredName = "B";
b1 = Simulink.findBlocks("model","GotoTag",CurrentName);
for i=1:length(b1)
set_param(b1(i),"GotoTag",RequiredName);
blkType = get_param(b1(i),"BlockType");
potH = get_param(b1(i),"PortHandles");
if strcmp(blkType,"Goto")
lineH = get_param(potH.Inport,"Line");
if isequal(lineH,-1)
else
set_param(lineH,"Name",RequiredName);
end
elseif strcmp(blkType,"From")
lineH = get_param(potH.Outport,"Line");
if isequal(lineH,-1)
else
set_param(lineH,"Name",RequiredName);
end
else
end
end
stozaki
Best Answer