Borrar filtros
Borrar filtros

How to vectorise this function

1 visualización (últimos 30 días)
Master Blabla
Master Blabla el 17 de Nov. de 2020
Editada: Stephan el 17 de Nov. de 2020
How to vectorize this function:
NumI = 0;
for i=1:100
if Value(i) < 10000
NumI = NumI +1;
end
end
Elements = zeros(5000, NumI);
%% Value - array of float values

Respuestas (2)

Stephan
Stephan el 17 de Nov. de 2020
Editada: Stephan el 17 de Nov. de 2020
NumI = sum(Value < 10000);
Elements = zeros(5000, NumI);

Andrei Bobrov
Andrei Bobrov el 17 de Nov. de 2020
NumI = sum(Value(1:100) < 10000)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by