Why do I get "Array indices must be positive integers or logical values." error?
Afficher commentaires plus anciens
Hello!! When I try to run the following code, I get this error "Array indices must be positive integers or logical values." and I don't understand why.
img=imread('Barbara.bmp'); colormap(gray(256));
image(img); axis off; truesize;
S=2;img2=img(1:S:end,1:S:end);
figure; colormap(gray(256));
image(img2); axis off; truesize;
The error comes from line 1. Do I have to install anything to make it work?
2 commentaires
Stephen23
le 5 Nov 2020
@Ali Marie Avila Wragg: please show us the complete error message. This means all of the red text.
Ali Marie Avila Wragg
le 5 Nov 2020
Réponses (1)
Walter Roberson
le 5 Nov 2020
2 votes
You probably have a variable named colormap that is interfering with using the function colormap
1 commentaire
Mohammad Mobayenjarihani
le 4 Avr 2023
thank you!
Catégories
En savoir plus sur Discrete Data Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!