making a vector based off ginputs
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
michael
le 29 Nov 2014
Réponse apportée : Image Analyst
le 30 Nov 2014
Hi i currently have:
figure(04)
imgstates=imread('PartUSA.tif');
imshow(imgstates);
for i=1:11; %For 11 states
[xcord,ycord] = ginput(6);
xstate(i,:)=xcord;
ystate(i,:)=ycord;
end
giving me two 11X6 matrices with the boundaries of 11 states selected.
my issue is now i am supposed to create a 11x1 vector called myStates. where each row in myStates will contain a state name. The state name in each row should correspond to the coordinates in Xstate and Ystate. For example, if the 3rd row in myStates is ‘CA’, then Xstate(3,:) and Ystate(3,:) should contain the coordinates for California’s bounding box.
any help would be greatly appreciated!
0 commentaires
Réponse acceptée
Image Analyst
le 30 Nov 2014
Put this in the for loop to alert them what state they're supposed to be drawing
promptMessage = sprintf('Please click 6 points for state %s', myStates{i});
titleBarCaption = 'Continue?';
button = questdlg(promptMessage, titleBarCaption, 'OK', 'Cancel', 'OK');
if strcmpi(button, 'Cancel')
continue; % Skip to end of the loop and continue with loop.
end
Then call ginput(), etc. Be aware that Xstate and xstate are different because MATLAB is case sensitive.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Exploration dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!