# andor: Logical AND, OR (Matlab Style) In pracma: Practical Numerical Math Functions

## Description

`and(l, k)` resp. `or(l, k)` the same as `(l & k) + 0` resp. `(l | k) + 0`.

## Usage

 ```1 2``` ```and(l, k) or(l, k) ```

## Arguments

 `l, k` Arrays.

## Details

Performs a logical operation of arrays `l` and `k` and returns an array containing elements set to either 1 (`TRUE`) or 0 (`FALSE`), that is in Matlab style.

Logical vector.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11``` ```A <- matrix(c(0.5, 0.5, 0, 0.75, 0, 0.5, 0, 0.75, 0.05, 0.85, 0.35, 0, 0, 0, 0.01, 0.5, 0.65, 0.65, 0.05, 0), 4, 5, byrow=TRUE) B <- matrix(c( 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1), 4, 5, byrow=TRUE) and(A, B) or(A, B) ```

### Example output

```     [,1] [,2] [,3] [,4] [,5]
[1,]    0    1    0    1    0
[2,]    1    0    1    0    1
[3,]    0    0    0    0    0
[4,]    0    1    0    0    0
[,1] [,2] [,3] [,4] [,5]
[1,]    1    1    0    1    0
[2,]    1    1    1    1    1
[3,]    1    1    1    1    1
[4,]    1    1    1    1    1
```

pracma documentation built on Dec. 11, 2021, 9:57 a.m.