how to find out how many columns have more than 50 elements which are greater than 1?

1 visualización (últimos 30 días)
I currently have a matrix that's 100*100 size, and I wish to work out how many columns have more than 50 elements which are greater than 1. Is it possible to do it using only rudimentary functions like find(), mod(), length(), numel(), etc?

Respuesta aceptada

KALYAN ACHARJYA
KALYAN ACHARJYA el 15 de Oct. de 2019
Editada: KALYAN ACHARJYA el 15 de Oct. de 2019
I currently have a matrix that's 100*100 size, and I wish to work out how many columns have more than 50 elements which are greater than 1
Lets say matrix 100*100 named as data
idx=data>1;
result=sum(idx);
data2=result>50;
fprintf('The column number is: %d',sum(data2(:)));

Más respuestas (1)

TADA
TADA el 15 de Oct. de 2019
x = rand(100) * 2;
atLeast50 = sum(x > 1, 1) > 50;

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by