making a vector based off ginputs
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
michael
am 29 Nov. 2014
Beantwortet: Image Analyst
am 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 Kommentare
Akzeptierte Antwort
Image Analyst
am 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Exploration finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!