フィルターのクリア

How can I find the median of each element between 2 rows

1 回表示 (過去 30 日間)
Gucci
Gucci 2022 年 4 月 30 日
コメント済み: Voss 2022 年 4 月 30 日
Hello I am a bit new to MATLAB syntax and get confused
I have a matrix of size 3x10.
I want to find the median between each element in the first row, and each element in the second row.
How can I do this? I will need to end up with 10 median values

採用された回答

Voss
Voss 2022 年 4 月 30 日
% 3-by-10 matrix:
M = rand(3,10);
% median of each column:
median(M,1)
ans = 1×10
0.2939 0.2871 0.5671 0.8380 0.4499 0.5502 0.3408 0.9692 0.3886 0.3581
% 10-by-3 matrix:
M = rand(10,3);
% median of each row:
median(M,2)
ans = 10×1
0.8276 0.4754 0.6724 0.7976 0.4674 0.5106 0.6841 0.7998 0.5076 0.1331
  4 件のコメント
Gucci
Gucci 2022 年 4 月 30 日
Thank you
Voss
Voss 2022 年 4 月 30 日
You're welcome!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by