Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

Dyuman Joshi
Dyuman Joshi il 6 Lug 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 Commento
영훈 정
영훈 정 il 6 Lug 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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Resizing and Reshaping Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by