Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
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

Réponse acceptée

Dyuman Joshi
Dyuman Joshi le 6 Juil 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 commentaire
영훈 정
영훈 정 le 6 Juil 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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by