How to map two rectangles in matlab?
이전 댓글 표시
So I am trying to map two rectangles so whenever I click a point in one rectangle, it will show the corresponding point in the second rectangle. I am new to matlab so I get lost in the program kind of easily.
I create two rectangles using ginput with:
[x,y]=ginput(2);
key=get(gcf,'CurrentKey');
if (key == 'return')
done=0;
end;
rectangle ('Position', [x(1) y(1) x(2)-x(1) y(2)-y(1)],...
'EdgeColor', 'b',...
'LineWidth', 2, 'LineStyle', '--');
[x1,y1]=ginput(2);
key=get(gcf,'CurrentKey');
if (key == 'return')
done=0;
end;
rectangle ('Position', [x1(1) y1(1) x1(2)-x1(1) y1(2)-y1(1)],...
'EdgeColor', 'r',...
'LineWidth', 2, 'LineStyle', '--');
This gives me a blue rectangle and a red rectangle. Now I am just completely confused on how I can go about actually working this out. Basically if I click inside the blue rectangle I want the corresponding point of the red rectangle to be calculated and plotted as well. Any ideas? Thanks!
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!