Setting up and calculating using an array and ginput?
이전 댓글 표시
Hi I'm trying to get my code to calculate the difference between x, y coordinates held in an array and that acquired from ginput.
So I've got two x, y ginputs that I want to calculate the difference between the first and second pair of values in my array called "ActualValues", so in this case I'd like to get the difference between ginput1 and 124, 93 and the difference between ginput2 and 109, 77.
How do I do this?
I'm using the following code:
clear clc close all
Map=imread('Map.Jpg'); imshow(Map); hold on;
ActualValues = [124 93; 109 77; 125 83; 117 75; 122 80]
uiwait(msgbox('Choose Point A')); [x,y] = ginput(1); hline = plot(x,y,'r+', 'MarkerSize', 50);
A = ginput(1);
uiwait(msgbox('Choose Point B')); delete(hline); [x,y] = ginput(2); plot(x,y,'r+', 'MarkerSize', 50); B = ginput(1);
disp ('Values:') disp(A); disp(B);
Would really appreciate some help, although I understand a minus operation should do the trick, I'm having difficulty referencing the ginputs and the array accordingly.
Many Thanks.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Data Exploration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!