remove the blank area surrounding the figure
4 ビュー (過去 30 日間)
古いコメントを表示
My objective is to creat checkerboard and assign different values to white and black squares, the code is showed below. How can I I remove the blank area surrounding the figure, which means to enable the figure to fill the whole window. Thank you!!
K = checkerboard(500,1,1);
K(K>0)=1;
figure
imshow(K)
mask = K > 0;
K(mask) = 10;
K(~mask) = 100;
0 件のコメント
採用された回答
Adam Danz
2019 年 5 月 23 日
編集済み: Adam Danz
2019 年 5 月 24 日
"How can I I remove the blank area surrounding the figure, which means to enable the figure to fill the whole window"
If you're refering to the figure window, here's a solution.
fh = figure();
fh.Position(3) = fh.Position(4); %make figure square
ax = axes('Units','Normalize','Position',[0 0 1 1]); %set axes to fill figure
K = checkerboard(500,1,1);
K(K>0)=1;
imshow(K,'Parent', ax) %specify axes
3 件のコメント
Adam Danz
2019 年 5 月 28 日
How are you assigning values in the checkerboard? Where are those values stored? Whatever values are stored in the figure (or axes) properties will be retrievable if you save the figure and reopen it.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Graphics Object Properties についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!