making a vector based off ginputs

1 view (last 30 days)
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!

Accepted Answer

Image Analyst
Image Analyst on 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.

More Answers (0)

Categories

Find more on Visual Exploration in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!