Hi Ian
1.
generating test matrix
A=randi([0 100],50);
imshow(uint8(A))
.
2.
selecting
3.
visually verifying selected pixels in white
A(L,L)=255
figure(2);imshow(uint8(A))
.
4.
the 18x18 result in A2
figure(3);imshow(uint8(A2))
imshow is just to ask you if the selected pixels are the ones you mean by 'rows & columns .. 1:16, 18 and 50.'
if you find this answer useful would you please be so kind to mark my answer as Accepted Answer?
To any other reader, please if you find this answer of any help solving your question,
please click on the thumbs-up vote link,
thanks in advance
John BG