Borrar filtros
Borrar filtros

How to get the index of the first non-zero element in an 1-D array in SIMULINK

32 visualizaciones (últimos 30 días)
Hi, guys
I want to find the index of the first non-zero element in a 1-D array in simulink, just like the way that 'find' command in matlab did.
For example:
x = [0 0 5 0 3 0];
idx = find(x~=0, 1, 'first');
The answer would be:
idx = 3.
So, how to do this in simulink?
Thanks!
by Ben

Respuesta aceptada

Arnaud Miege
Arnaud Miege el 6 de Abr. de 2011
Use the Find block.
HTH,
Arnaud
  5 comentarios
Hongmei Hu
Hongmei Hu el 31 de Mayo de 2011
HI, i had very similar problem.
I am doing the svd in Simulink, I got the eigenvalue, now I want to set some eigenvalues smaller than a given value to zero. for example, if the eigenvalue small than 2, i set it to zero and keep those eigen values large than 2 unchanged, incuding the place in the matix and the value.
PS: my matlab is 2009b, there are no Find block. so I can not use that block to find the zero value also.
br,
hongmei
Arnaud Miege
Arnaud Miege el 31 de Mayo de 2011
Not sure. Please create a new question with a meaningful title rather than append your question to an existing one, you're much more likely to get an answer, see:
http://www.mathworks.co.uk/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Simulink Functions 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