Error in Matlab R2019b with titles

조회 수: 25 (최근 30일)
Cam
Cam 2019년 9월 27일
답변: Subhadeep Koley 2020년 1월 9일
Im having issues with Matlab's use of titles, Im not new to Matlab and I've never seen something like this, I might be doing something silly but Ive reduced my code to the simplest form that still produces the error.
This is the error: When I run this the title for the second figure is attached to the first figure. and the second figure doesnt have a title. If I run with only one image its fine. Only happens on this computer on this version. macOS R2019b. So here the title "Aerial" is assigned to the figure that is actually Lena.
clear, clc, close all
lena = imread('input/lena.png');
aerial = imread('input/aerial.jpg');
figure;
imshow(lena)
title('Lena')
figure;
imshow(aerial)
title('Aerial')
  댓글 수: 3
Cam
Cam 2019년 9월 27일
As stated in the question, i'm using macOS and Matlab R2019b the latest release. Im getting this which is the title from the second figure matched with the first photo.
untitled.jpg
Ke Lu
Ke Lu 2019년 10월 21일
편집: Ke Lu 2019년 10월 21일
I had exactly the same problem

댓글을 달려면 로그인하십시오.

답변 (1개)

Subhadeep Koley
Subhadeep Koley 2020년 1월 9일
Hi, you can try specifying target object for the title. Refer the code below.
clear, clc, close all;
lena = imread('input/lena.png');
aerial = imread('input/aerial.png');
figure; ax1=axes;
imshow(lena, []);
title(ax1,'Lena');
figure; ax2=axes;
imshow(aerial, []);
title(ax2, 'Aerial');
Hope this helps!

카테고리

Help CenterFile Exchange에서 Title에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by