Why getting this error??

3 次查看(过去 30 天)
Hanan Awawdeh
Hanan Awawdeh 2020-12-16
min=min(data);
max=max(data);
normdata=(data - min)./(max - min)
Why getting this error??
Error using -
Matrix dimensions must agree.

回答(2 个)

James Tursa
James Tursa 2020-12-16
编辑:James Tursa 2020-12-16
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 2022-6-9
normdata = rescale(data, 0, 1);

类别

Help CenterFile Exchange 中查找有关 Dynamic System Models 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by