フィルターのクリア

indexing to find elements between 2 values in a matrix

4 ビュー (過去 30 日間)
Chloe St John
Chloe St John 2019 年 1 月 26 日
コメント済み: madhan ravi 2019 年 1 月 26 日
I have created a random 5x5 matrix called M6
i'm trying to using indexing, define an array containing all elements of M6 that are negative or between 29 and 33
clc
clear
M6=-10+(33+10)*rand(5)
B=(M6<0 & M6>29 & M6<33)
but its just coming up with a 5x5 matrix of 0's

採用された回答

madhan ravi
madhan ravi 2019 年 1 月 26 日
B=M6<0 | (M6>29 & M6<33)
  2 件のコメント
Chloe St John
Chloe St John 2019 年 1 月 26 日
thank you that works, what does the '|' do to make it work?
madhan ravi
madhan ravi 2019 年 1 月 26 日

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by