Outline of shape in matrix using contour?
3 ビュー (過去 30 日間)
古いコメントを表示
Hi all!
I have a matrix with various shapes. The matrix looks something like this (picture included below) when I use the imshow command. I was wondering if anyone knew how to outline the shapes so that only the outline of the shape (i.e. the boundaries) appears. I tried using contourf, and it works, but this flips the image upside down. Any other options?
I have included some code for reference:
shape = ncread(file, 'shape', [1,1,1,612,1], [inf, inf, inf, 1, inf])
imshow(shape)
contourf(shape)
Thanks in advance!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/412408/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/412413/image.png)
0 件のコメント
採用された回答
Star Strider
2020 年 11 月 13 日
Try this:
figure
contourf(shape)
set(gca, 'YDir','reverse')
axis('equal')
That should fiip it right-side-up.
2 件のコメント
Star Strider
2020 年 11 月 16 日
As always, my pleasure!
I very much appreciate your compliment! You, too!
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Contour Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!