why mat2gray function isnt working in my matlab?

4 vues (au cours des 30 derniers jours)
Roni
Roni le 4 Oct 2023
this is the code:
clear all
load('BrainTumors.mat');
imagesc(MRI{1});
colormap('gray')
a = mat2gray(MRI{1});
the last row isnt running and thats the error:
"Undefined function 'mat2gray' for input arguments of type 'int16'.
Error in ExecriseSolution1 (line 5)"
i was able to run this code in other computer. how do i fix it?
  3 commentaires
Roni
Roni le 4 Oct 2023
im not sure. how can i confirm it?
Dyuman Joshi
Dyuman Joshi le 4 Oct 2023
See @Steven Lord's answer below.

Connectez-vous pour commenter.

Réponse acceptée

Steven Lord
Steven Lord le 4 Oct 2023
The mat2gray function is part of Image Processing Toolbox. Do you have this toolbox installed and licensed? You can check this by running the ver command and looking for a line starting with "Image Processing Toolbox" in the displayed output.
If that line does not exist you will need to install Image Processing Toolbox to use this function.
  2 commentaires
Roni
Roni le 4 Oct 2023
thank you' it helps a lot. The "Image Processing Toolbox" does not exist, how can i install it?
Walter Roberson
Walter Roberson le 4 Oct 2023
If you have a recent matlab I suggest substituting rescale()

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by