making a vector based off ginputs

3 次查看(过去 30 天)
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!

采纳的回答

Image Analyst
Image Analyst 2014-11-30
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 个)

类别

Help CenterFile Exchange 中查找有关 Visual Exploration 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by