Get line properties from it's handle

조회 수: 47 (최근 30일)
Lucas
Lucas 2012년 6월 13일
I’m trying to get a lines property from its handle. I do this to get the handle to the line:
lines = get_param(outPorts{i}, 'LineHandles');
lineHandle = lines.Inport();
My line handle is a double like 16.0071 and when I do:
line = findobj(lineHandle);
I get an error saying it’s an invalid handle. But if I do:
sigH = find_system('FindAll', 'on', 'type', 'line');
sig1 = get_param(sigH(1), 'Object');
get(sig1);
I get all the lines properties, one of them is handle and it has the same value I want to use. I don’t want to loop through all the lines in my program to get the one I want. I just need to be able to get the line from the handle so I can get its position.

채택된 답변

Anton Semechko
Anton Semechko 2012년 6월 13일
try this:
x=get(lineHandle,'XData');
y=get(lineHandle,'YData');
x and y variables respectively should be the x and y co-ordinates of your line

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Test Model Components에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by