フィルターのクリア

Matrix Averaging

1 回表示 (過去 30 日間)
Ben
Ben 2011 年 4 月 13 日
Hi, I'm trying to do something very simple, but can't seem to get the if condition correct.
I want to find the average of (:,2:5) if the values in the first column of the matrix are below a certain average.
Thanks in advance,
Ready to be humbled---

採用された回答

Matt Fig
Matt Fig 2011 年 4 月 13 日
If A is your matrix and tol stands for "a certain average,"
if mean(A(:,1))<tol
M = mean(A(:,2:5));
end

その他の回答 (1 件)

Sean de Wolski
Sean de Wolski 2011 年 4 月 13 日
A = rand(5);
A1 = A(:,1);
A1(A1>.5) = mean(A(A1>.5,2:5),2)
Like this? If not, please provide a small example.

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by