简体   繁体   中英

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!

Just try:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM