# matlab种筛选三个值中的最大值,在MATLAB中从3个矩阵中获取坐标最大值(Get coordinate-wise maximum out of 3 matrices in MATLAB)...

A = [ a11 a12.. ] B = [b11 b12 ..] C = [c11 c12 ..]

[ a21 a22.. ] [b21 b22 ..] [c21 c22 ..]

NewMatr = [max(a11,b11,c11) max(a12,b12,c12) .. ]

[max(a21,b21,c21) max(a22,b22,c22) .. ]

Suppose I have 3 matrices A, B ,C. I want to create new matrix which will contain maximum value of matrices.

For example let

A = [ a11 a12.. ] B = [b11 b12 ..] C = [c11 c12 ..]

[ a21 a22.. ] [b21 b22 ..] [c21 c22 ..]

I want new matrix be constructed this way

NewMatr = [max(a11,b11,c11) max(a12,b12,c12) .. ]

[max(a21,b21,c21) max(a22,b22,c22) .. ]

I thought of combining them into new matrix which will contain 3x1 vectors and applying max to this new matrix but i don't know how. Pf course there is always for method but i'm running for optimisation.

max(max(A,B),C)

C = max(A,B)返回与A和B大小相同的数组，其中最大元素取自A或B A和B的尺寸必须匹配，否则它们可能是标量。

In addition to concatenating, you can use the 2-input version of max, twice:

max(max(A,B),C)

From the max docs regarding this somewhat uncommon syntax:

C = max(A,B) returns an array the same size as A and B with the largest elements taken from A or B. The dimensions of A and B must match, or they may be scalar.

2014-03-01

I'm not sure you gain much by doing that though!

c =

[] [] []

[] [] []

[] [] []

c{1,1}; = rand(3,3); %Set cell {1,1} to be random matrix of size *3x3*

c{1,2} = ones(4,6) %Set cell {1,2} to be matrix of on

...

cArray = {mat 2.*mat 3.*mat 4.*mat 5.*mat 6.*mat}; %# Your 6 unique matrices

index

...

You need to "shift" the first two dimensions of B into second and third dimensions respectively with permute and then use bsxfun with @tim

...

...

To sum along the n'th dimension, you can use the second argument to sum like this: s = sum(A,n);

thus in your case, to sum along the third dimension: s = sum(A,3);

From the max docs regarding t

...

clear all;

%%%%%%%%%%%%%%%%% take an example

m=4;

T=10;

y=zeros(1,T);

for i=1:(T)

y(i)=i;

end

%%%%%%%%%%%%%%%%%%%%%% calculate Ymin

count_i=0;

for i=m:1:(T-m)

count_i=count_i+1;

count_j=0;

...

dothing(tmp)

% Or

You can use an array as the row index into t

...

J = {J1, J2, J3, J4, J5};

%// Find rows of all matrices

...

03-23 1002
03-16 1万+
09-16 8640
05-26 2万+
02-18 590
04-04 2886
07-01 6158
07-18 11万+
11-18

• 非常没帮助
• 没帮助
• 一般
• 有帮助
• 非常有帮助