resolving the error Subscript indices must either be real positive integers or logicals when using squeeze function
Show older comments
I am new to matlab.I am using it interactively select pixels from an image.I am using imagesc to display my image,ginput to select a pixel and retrieve its coordinate values.but i am getting an error in this line of code-
p1=squeeze(I(y,x,:));
I am using envihdrread to read the header info and envidataread to read the image data.And then i am using the following code:
s =I(:,:,80); imagesc(s) [x y]=ginput p1=squeeze(I(y,x,:));
This is giving me an error:-
Subscript indices must either be real positive integers or logicals
please help me to sort it out.
Thank you!!!!!!!
Ekta Shah
Answers (1)
Walter Roberson
on 17 Mar 2012
0 votes
ginput() returns data units, not necessarily integer coordinates.
Another consideration is that for image() and imagesc(), positions are measured by the center of the pixels.
Categories
Find more on Convert Image Type 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!