MATLAB Answers

How to express coordinate range of an area

1 view (last 30 days)
I want to read the pixel value of an area but I dont know how to write the coordinate range
x = [ 1119 until 1121]
y = [ 392 until 394]
I have to change the 'until' word into what symbol?


Sign in to comment.

Answers (1)

Johannes Fischer
Johannes Fischer on 23 Sep 2019
You are looking for the colon operator (
x = 1119:1121;
y = 392:394;


Show 3 older comments
Steven Lord
Steven Lord on 23 Sep 2019
What is the full and exact text of the error message you received when you tried running that line of code? Show us all the text displayed in red (and all the text displayed in orange if you receive any warning messages.)
Johannes Fischer
Johannes Fischer on 24 Sep 2019
That error message means you are trying to get data points from a pixel that doesnt exist. Along the first dimension, your image has 825 pixels. with
x = [1119:1121];
you are trying to access data that does not exist, hence the error.
In order to see how big your image is, use
It will give you the number of pixels along each dimension.

Sign in to comment.

Translated by