1
我有一組座標值,我想將這些值相互比較。我想要x-min,x-max,y-min,y-max作爲結果。 例如: (10,40) 和 (20,30) 是兩組值。 我想比較他們; 它應該是結果:比較圖像的兩個座標值
x-min=10
y-min=30
x-max=20
y-max=40
我有一組座標值,我想將這些值相互比較。我想要x-min,x-max,y-min,y-max作爲結果。 例如: (10,40) 和 (20,30) 是兩組值。 我想比較他們; 它應該是結果:比較圖像的兩個座標值
x-min=10
y-min=30
x-max=20
y-max=40
聽起來很簡單:
max(x(:)); %#Get the maximal value.
min(x(:)); %#Get the minimal value.
max(y(:)); %#Get the maximal value.
min(y(:)); %#Get the minimal value.
現在你可以對它們進行比較。
如果您有單獨的陣列x
和y
,請參閱@安德烈的答案。 如果你有一個像
A = [x y] = [
10 40
20 30
..
90 25];
數組然後使用此:
mins = min(A);
maxs = max(A);
minX = mins(1); maxX = maxs(1);
minY = mins(2); maxY = maxs(2);