How to plot specific rows and columns from a matrix?

1 回表示 (過去 30 日間)
Ian
Ian 2017 年 3 月 2 日
コメント済み: John BG 2017 年 3 月 2 日
I have a 50x50 matrix, however the only rows & columns I want to plot are 1:16, 18 and 50.
Ideally, this new matrix I want to print will be 18x18 with the rows/cols specified above
Is there anyway I can only return the rows and columns I care about? Thanks

採用された回答

John BG
John BG 2017 年 3 月 2 日
Hi Ian
1.
generating test matrix
A=randi([0 100],50);
imshow(uint8(A))
.
2.
selecting
L=[1:16 18 50];
A2=A(L,L)
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
  2 件のコメント
Ian
Ian 2017 年 3 月 2 日
Awesome, thank you for the help!
John BG
John BG 2017 年 3 月 2 日
thanks for accepting my answer
John BG

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOctave についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by