举个例子,希望有所帮助. 代码 % By lyqmath clc; clear all; close all; A = magic(5) for i = 1 : size(A, 2) temp = A(:, i); temp = (temp-min(temp))/(max(temp)-min(temp)); A(:, i) = temp; end A 结果 A = 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 A = 0.6842 1.0000 0 0.3158 0.6316 1.0000 0 0.2500 0.6316 0.6842 0 0.0526 0.5000 0.9474 1.0000 0.3158 0.3684 0.7500 1.0000 0 0.3684 0.6842 1.0000 0 0.3158