Borrar filtros
Borrar filtros

Identify a connecting line

14 visualizaciones (últimos 30 días)
mtr
mtr el 25 de Feb. de 2013
Hi,
I have a model with several blocks and lines connecting them. I am able to get all my line names using the following:
LineNames= get_param(find_system(gcs,'FindAll','on','type','line'),'Name')
If I tell Matlab the names of two blocks, ie. InputPort and Filter1, does anyone know how I can identify which line in LineNames is conencting these two blocks? Would I have to use 'PortConnectivity'?

Respuestas (1)

Babak
Babak el 25 de Feb. de 2013
here are some useful command you can (may want to) use :
BlocksYoureLookingFor = find_system(gcs,'BlockDialogParams','MyDlgParams')
% or use it with another switch to find your filter block, like
% BlocksYoureLookingFor = find_system(gcs,'BlockType',....)
% now get the line handles of that block,
YourBlocksLineHandles = get_param(BlocksYoureLookingFor(1),'LineHandles')
% note that there may be more than 1 block found.
% here's how you can find the name of the inport line of the block:
Line_name = get(YourBlocksLineHandles.Inport,'Name')
% here's how you can change the name of the inport
set(YourBlocksLineHandles.Inport,'Name','YourFavouriteName')
  4 comentarios
mtr
mtr el 26 de Feb. de 2013
I get the error on the last line: Line_name = get(YourBlocksLineHandles.Inport,'Name')
Babak
Babak el 26 de Feb. de 2013
Please run these lines in MATLAB's command window, Try to see what
YourBlocksLineHandles
is. It should be a structure. You can check it's fields by typing this in command window:
fieldnames(YourBlocksLineHandles)
Check see if Inport is one of the options or not.

Iniciar sesión para comentar.

Categorías

Más información sobre Schedule Model Components en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by