Filter löschen
Filter löschen

I want to collect the smallest arrays on the 3rd axis and get a 2d image.

1 Ansicht (letzte 30 Tage)
i have a 3X3X3 double data
a=[1 1 1;10 10 10;10 10 10];
b=[20 20 20;2 2 2;20 20 20];
c=[30 30 30;30 30 30;3 3 3];
d=cat(3,a,b,c);
To illustrate, let's say 3X3X3 is row, column, page.
I want to find the minimum value several pages with fixed rows and columns.
I think repeating this would make one 3X3 matrix in each row and column.
I think it's possible if i use "for loops" to find it. But can't do this using "min()"?
% i want get e=[1 1 1 ;2 2 2; 3 3 3]
e=[1 1 1 ;2 2 2; 3 3 3]
e = 3×3
1 1 1 2 2 2 3 3 3

Akzeptierte Antwort

Dyuman Joshi
Dyuman Joshi am 6 Jul. 2023
a=[1 1 1;10 10 10;10 10 10];
b=[20 20 20;2 2 2;20 20 20];
c=[30 30 30;30 30 30;3 3 3];
d=cat(3,a,b,c);
out=min(d,[],3)
out = 3×3
1 1 1 2 2 2 3 3 3
  1 Kommentar
영훈 정
영훈 정 am 6 Jul. 2023
a=[1 1 1;10 10 10;10 10 10];
b=[20 20 20;2 2 2;20 20 20];
c=[30 30 30;30 30 30;3 3 3];
d=cat(3,a,b,c);
out=min(d,[],3)
out = 3×3
1 1 1 2 2 2 3 3 3
out=min(d,3)
out =
out(:,:,1) = 1 1 1 3 3 3 3 3 3 out(:,:,2) = 3 3 3 2 2 2 3 3 3 out(:,:,3) = 3 3 3 3 3 3 3 3 3
%I was stupid

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

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

Community Treasure Hunt

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

Start Hunting!

Translated by