How to use handles/pathnames with "delete_line" function?
Mostrar comentarios más antiguos
I have block handles and pathnames but delete_line function always gives the error of : "Invalid Simulink object handle". I mean I get handles and pathnames with "get_param" function so there should be no way of being them invalid.
I may be doing mistakes with using dots, paranthesis and brackets but matlab should give that error first, anyways here are my codes;
BlockHandle = get_param('DL/Subsystem/Subsystem', 'Handle');
Port = get_param('DL/Subsystem/Mux', 'PortConnectivity'); % Subsystem block connected to Mux block, from its input to Mux's output.
SourceHandle = get_param(Port(1,1).SrcBlock, 'Handle') % Source is the block which connected to inport of Mux block.(Subsystem Block.) SourceHandle and BlockHandle is the same as they should be.
delete_line = ('DL', 'Subsystem/1' , 'Mux/1') % This deletes the line, but It doesn't delete the line in the subsystem "subsystem",
%I work on a large file, so there may be so much more of this, I want to use handle or pathname because of this.
delete_line = ('DL', (SourceHandle)/1, 'Mux/1 % Error : Invalid Simulink obejct handle.
%then tried this thought maybe If I can have the handle with port number there shouldn't be any error;
k = get_param(SourceHandle, 'Ports')
PortHandle = get_param(k(1), 'Handle') % Also Error : Invalid Simulink object handle.
I could'nt figure out how to do this. "Name/PortNumber" works but I have the same name repeatedly.. So I need to use handle or pathname, I tried pathname it is not happening neither.
I think there might be a mistake I do with brackets or dots while using delete_line.
Respuestas (1)
Burak Bayram
el 20 de Oct. de 2017
Categorías
Más información sobre Programmatic Model Editing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!