InfiniteVariance
InfiniteVariance

Reputation: 81

Apply threshold to the elements of a matrix in MATLAB

How can I quicky get an index vector showing if all elements of Matrix with correpsponding number of rows has all elemets in this row below some threshold?

for instance:

threshold = 5;

A = [5,6;4,5;3,4];

should give

[0;0;1];

Thanks a lot!

Upvotes: 0

Views: 178

Answers (1)

zinjaai
zinjaai

Reputation: 2385

Just try:

threshold = 5;
A = [5,6;4,5;3,4];
all((A < 5)')

Upvotes: 1

Related Questions