find index of value in array
Show older comments
hello, how can I find which numbers in a matrix are less than x and then print another number instead of the number I found?
Answers (1)
A = randi(99,10,10) % test array
x = 30;
lessthanx = A(A<x) % all the numbers in A that are < x
fprintf('%d',randi(1000,1,1)) % "print another number instead of the number I found"
Categories
Find more on Data Types 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!