Why getting this error??

3 visualizaciones (últimos 30 días)
Hanan Awawdeh
Hanan Awawdeh el 16 de Dic. de 2020
Respondida: Image Analyst el 9 de Jun. de 2022
min=min(data);
max=max(data);
normdata=(data - min)./(max - min)
Why getting this error??
Error using -
Matrix dimensions must agree.

Respuestas (2)

James Tursa
James Tursa el 16 de Dic. de 2020
Editada: James Tursa el 16 de Dic. de 2020
Don't shadow the MATLAB min() and max() functions with variables of the same name. Also min() and max() operate on columns by default, not the entire matrix. Maybe this is what you want:
mindata = min(data(:));
maxdata = max(data(:));
normdata = (data - mindata)./(maxdata - mindata)

Image Analyst
Image Analyst el 9 de Jun. de 2022
normdata = rescale(data, 0, 1);

Categorías

Más información sobre Dynamic System Models en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by