to compare two matrix element by element

3 Ansichten (letzte 30 Tage)
Pradheep S
Pradheep S am 22 Jul. 2021
Bearbeitet: per isakson am 22 Jul. 2021
i have matrix
A= [
15.87 24.88 36.34 46.44 59.32 73.98 90.16
15.87 24.88 36.34 46.44 59.32 73.98 90.16
15.87 24.88 36.34 46.44 59.32 73.98 90.16
15.87 26.4 38.2 48.2 63 80.6 96.7
21.3 32 44.8 56.1 73 92 109.4
24.5 38.7 53.4 66.4 87 109.5 512
29.2 45.8 62.6 77.8 101.4 125.9 512
32.8 51.8 71.6 88.6 115.5 143.4 512
33.2 53.7 77.7 96.5 127.2 158.1 512
33.5 54.9 81.4 101.3 134.8 168.4 512
33.6 55.6 82.7 103.2 138 174.5 512
34 56 83.4 104.1 139.3 176.9 512
34.2 56.4 84 105 140.7 179.1 512
34.2 56.5 84.7 105.8 142 181.2 512
34.2 56.6 85.2 106.4 143 182.8 512
34.2 56.6 85.3 106.5 143.2 183.1 512
34.2 56.6 85.3 106.5 143.2 183.1 512 ]
and Matrix
B= [
13.87 24.88 36.34 46.44 59.32 73.98 90.16
13.87 24.88 36.34 46.44 59.32 73.98 90.16
13.87 24.88 36.34 46.44 59.32 73.98 90.16
13.87 26.4 38.2 48.2 63 80.6 96.7
19.3 32 44.8 56.1 73 92 109.4
22.5 38.7 53.4 66.4 87 109.5 512
27.2 45.8 62.6 77.8 101.4 125.9 512
30.8 51.8 71.6 88.6 115.5 143.4 512
31.2 53.7 77.7 96.5 127.2 158.1 512
31.5 54.9 81.4 101.3 134.8 168.4 512
31.6 55.6 82.7 103.2 138 174.5 512
32 56 83.4 104.1 139.3 176.9 512
32.2 56.4 84 105 140.7 179.1 512
32.2 56.5 84.7 105.8 142 181.2 512
32.2 56.6 85.2 106.4 143 182.8 512
32.2 56.6 85.3 106.5 143.2 183.1 512
32.2 56.6 85.3 106.5 143.2 183.1 512 ] .
want to caompare element by element martix operators and any one element or all element in A if > B should return matrix A as greater .
Here first column of A is greater compared to B .
Here while comparing A and B . Even if one element in A if greater B should return Marix A as greater

Antworten (1)

KSSV
KSSV am 22 Jul. 2021
You can use inequalities straight away.
idx = A>B ;

Kategorien

Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by