Replacing elements in matrix with relational operations
Show older comments
I am given a problem where I am given a matrix and I am suppose to change the values of the matrix depending on if a certain element of the matrix is greater than or less than a number. If it is greater than the variable n1 I am suppose to change the element to c1 and if is less than n1 I am suppose to change it to c2. I am to use only relational operations, I cannot use for, if, while or any implicit functions. How can I do this? This is what I have so far m3 is the matrix I am given
m4 = ((m3>n1)*c1)
m5 = ((m3<=n1)*c2)
Accepted Answer
More Answers (1)
Walter Roberson
on 7 Oct 2013
0 votes
The task cannot be accomplished without using at least one implicit function other than the relational operators.
Categories
Find more on Resampling Techniques in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!