Is it possible to use element by element comparison between a single variable and individual matrix values?

1 回表示 (過去 30 日間)
Clayton
Clayton 2014 年 10 月 15 日
回答済み: Iain 2014 年 10 月 15 日
Is it possible to use element by element comparison between a single variable and individual matrix values?

回答 (1 件)

Iain
Iain 2014 年 10 月 15 日
Yes. Try these to see what makes sense for your little problem whatever it happens to be...
logical_cmp_result = eye(3) == 1
all(logical_cmp_result)
any(logical_cmp_result)
all(all(logical_cmp_result))
randomvals = rand(3,3);
logical_cmp_result = randomvals([1,3,5,7,9]) > 0.5 % This uses randomvals(1,1),(3,1),(2,2) (1,3) & (3,3)
logical_cmp_result = randomvals(eye(3) == 1) > 0.5

カテゴリ

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