resolving the error Subscript indices must either be real positive integers or logicals when using squeeze function

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

Antworten (1)

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.

Kategorien

Mehr zu Aerospace Blockset finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 17 Mär. 2012

Community Treasure Hunt

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

Start Hunting!

Translated by