Filter löschen
Filter löschen

Vector problem

1 Ansicht (letzte 30 Tage)
Lizan
Lizan am 22 Jul. 2011
I have a (3,51)-sized vector, I would like to remove all data (set to zero) that does not belong to a certain interval,
x1 < x < x2
How can I do this efficiently?
Many thanks!

Akzeptierte Antwort

Fangjun Jiang
Fangjun Jiang am 22 Jul. 2011
A=rand(3,51);
Index=and(A<0.8,A>0.5);
A(Index)=0;
  4 Kommentare
Sean de Wolski
Sean de Wolski am 22 Jul. 2011
elements of A that are less than 0.8 AND those same elements of A greater than 0.5.
Jan
Jan am 22 Jul. 2011
@Susan: You could read the documentation "doc and" also. Do we assist to solve your homework?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by