The Student Room Group

Matlab





I've just started learning Matlab and I'm trying to understand why A(1:2,2:3) yields the above answer? Also what does the comma indicate?
Original post by GPODT
...


Never used matlab, but from a quick Google.

The comma separates dimensions. First argument relates to rows, second to columns, etc.

In your example you're looking at rows (1st dimension/argument) 1 thru 2, intersecting columns (2nd dimension/argument) 2 thru 3; hence the result.

This may prove useful to supplement your learning.
(edited 9 years ago)
Original post by GPODT




I've just started learning Matlab and I'm trying to understand why A(1:2,2:3) yields the above answer? Also what does the comma indicate?

"From the first coordinates, take entries 1 to 2. That is, take the first and second rows. From the second coordinates, take columns 2 to 3. That is, the second and third columns."

Quick Reply

Latest