Creating a mask using mod()

2 ビュー (過去 30 日間)
Kratos
Kratos 2014 年 9 月 13 日
回答済み: Geoff Hayes 2014 年 9 月 14 日
How to use mod() to create a mask of where A contains an even number?
C =
How to replace values with a mask. Using your mask, C, assign the even values in var1 into the corresponding values of var2.
D =
Use 'and' and 'or' to find a mask of where both A and C were true.
E =

回答 (1 件)

Geoff Hayes
Geoff Hayes 2014 年 9 月 14 日
Kratos - your question seems to be a homework one. Here's a hint - what can you say about all even numbers? They are all divisible by y (which is..?). So if x is any number, then what is mod(x,y) when x is even, and what is mod(x,y) when x is odd? See mod for details on this function.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by