I want to compare every matrix element to a constant then calculate a new matrix based on every case
2 views (last 30 days)
Show older comments
i have a matrix A=[ 1 2 3 4 5 ] and a constant b=3 . and i want to compare each element in that matrix with that constant b and calculate a new matrix based on every case .
if element in A<b then should do A*b
if element in A=>b then should do A+b and i want to calculate a new matrix like this :
C= [ A*b A*b A+b A+b A+b ].
0 Comments
Accepted Answer
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!