Setting up and calculating using an array and ginput?
Afficher commentaires plus anciens
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.
1 commentaire
DocD
le 14 Déc 2017
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Data Exploration dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!