フィルターのクリア

compare value between different arrays

3 ビュー (過去 30 日間)
Lidank Abiel
Lidank Abiel 2013 年 6 月 23 日
Hi all. I have 2 array that have value. I want to compare each value of each array, but i dont know how to do that. Can somebody help me ? Thanks in advance.
  6 件のコメント
Iain
Iain 2013 年 6 月 24 日
result = b > a; %(b greater than a)
result = b >= a; %(b greater or equal to a)
result = b == a; %(b equal to a)
result = b <= a; %(b less than or equal to a)
result = b < a; %(b less than a)
result is the same length as b, and is 1 (true) when b is that comparison to a, and 0 (false) everywhere else.
all(result) will be 1 (true) if all the elements of b are "that comparison"
any(result) will be 1 (true) if any of the elements of b are "that comparison"
result = b > (5*a); %(b greater than five times a)
Lidank Abiel
Lidank Abiel 2013 年 6 月 25 日
yes, check each element of b less than or equal to a. ( I mean, check b[1] to a[1], b[2] to a[2], etc. If the result are as expected, it will be 1 (true).

サインインしてコメントする。

回答 (2 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 6 月 23 日
編集済み: Azzi Abdelmalek 2013 年 6 月 23 日
a=[2 3 4]
b=[1 4 0]
comp=a<b
  12 件のコメント
Lidank Abiel
Lidank Abiel 2013 年 6 月 24 日
I want that values used to percentage of proximity.
My plan, i set value for tolerance, example, tolerance = 93. Then, i process image to get the euclidean value. The result above, is value from 2 image. and then, i want to calculate 2 value above ( maybe divided ) if the result approach to value tolerance, so, the image have percentage minimal similarity 90%.
I'm sorry make all of you confused. I'm new in programming. So, I explained it according to my knowledge.
Thanks in advance.
Jan
Jan 2013 年 6 月 24 日
Thanks for the explanantions. Unfortuantely I do not understand this:
i want to calculate 2 value above ( maybe divided ) if the result approach to value tolerance, so, the image have percentage minimal similarity 90%.
I still do not know hwta kind of result you expect for the above mentioned input data. Are you able to calculate it manually or give a definition of the calculations? In the comments to the question you wrote "i want to compare each value of array b to array a". As soon as it is explained, what "campare" means explicitly, I assume the problem can be solved in seconds. So please try to explain this clearly.

サインインしてコメントする。


Thorsten
Thorsten 2013 年 6 月 24 日
You can compute two fractions a/b and b/a, and then take the minimum to ensure that the value is not above 100%. Then take the minimum of these values to get "percentage minimal similarity"
min_similarity = min(min([a./b; b./a]))

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by