Why getting this error??

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 日

1 投票

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 日

1 投票

normdata = rescale(data, 0, 1);

カテゴリ

ヘルプ センター および File ExchangeDynamic System Models についてさらに検索

質問済み:

2020 年 12 月 16 日

回答済み:

2022 年 6 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by