operation in matrix in matlab
3 views (last 30 days)
Show older comments
if i want to know the number of times an condition is fullfilled for a matrix, how can i do so;
a=[3 4 2 5 3 5]; %defining a matrix
% now what should i write if i want to know the number of times, a matrix
% has a value greater than 4.
0 Comments
Accepted Answer
Arif Hoq
on 31 Jan 2022
a=[3 4 2 5 3 5];
expected_value=a(find(a>4))
how_many_times= length(find(a>4))
Or
times=length(expected_value)
4 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!