Unable to use title() for image.

2 visualizaciones (últimos 30 días)
Thien-Phuoc
Thien-Phuoc el 2 de Sept. de 2024
Comentada: Voss el 2 de Sept. de 2024
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?

Respuesta aceptada

Voss
Voss el 2 de Sept. de 2024

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

Clear it:

clear title

and then run your code again.

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Productos


Versión

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by