making a vector based off ginputs
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
michael
el 29 de Nov. de 2014
Respondida: Image Analyst
el 30 de Nov. de 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 comentarios
Respuesta aceptada
Image Analyst
el 30 de Nov. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Exploration en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!