Why getting this error??

조회 수: 3 (최근 30일)
Hanan Awawdeh
Hanan Awawdeh 2020년 12월 16일
답변: Image Analyst 2022년 6월 9일
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