Unable to use title() for image.

2 次查看(过去 30 天)
I am trying to add a title to the image as following:
clc; close all;
A = imread("img1.jpg");
figure(1);
imshow(A);
title('A');
However, MATLAB shows the error for the "title('A')" statement:
'Index exceeds the number of array elements. Index must not exceed 19.'
I cannot figure out what that error is. How can I fix it?

采纳的回答

Voss
Voss 2024-9-2

You have a variable called title preventing you from using the title function.

Clear it:

clear title

and then run your code again.

  2 个评论
Thien-Phuoc
Thien-Phuoc 2024-9-2
Thank you so much! It works now.
Voss
Voss 2024-9-2
You're welcome! Any questions, let me know. Otherwise, please "Accept" this answer. Thanks!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by