compare integer values
Show older comments
How i can compare between each element in specific matrix and constant value as 0.5 and then take action if the result true .
Accepted Answer
More Answers (1)
Honglei Chen
on 15 Feb 2012
Say you have the matrix A, and you have a function foo contains the operation you'd like to apply to elements of A if they equal to 0.5, you can do
A(A==0.5) = arrayfun(@foo,A(A==0.5))
Categories
Find more on Creating and Concatenating Matrices 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!