Suppose I have two matrix A and B, both are m$\times$n size, now I set a condition: if the entry in A is smaller than a value, I want the entries in same position of B outputted.
For example:
$A=\begin{bmatrix}1&2&3\\4&5&6\\7&8&9 \end{bmatrix}$ and $B=\begin{bmatrix}10&0&1\\3&2&9\\1&0&-6 \end{bmatrix}$
The condition is when the entry in A < 5, and the output result should be:
$B'=\begin{bmatrix}10&0&1\\3&0&0\\0&0&0 \end{bmatrix}$
How can I code MatLab to realize this? Is there any function or package that I can use? Thanks!
My license for Matlab expired a few weeks ago however I downloaded octave
$A=\begin{bmatrix}1&2&3\\4&5&6\\7&8&9 \end{bmatrix}$ and $B=\begin{bmatrix}10&0&1\\3&2&9\\1&0&-6 \end{bmatrix}$
$$ B_{ij} =\begin{align}\begin{cases} b_{ij} & \textrm{ if } A_{ij} < 5 \\ \\ 0 & \textrm{ for everywhere else } \end{cases} \end{align}$$