Vector problem
조회 수: 1 (최근 30일)
이전 댓글 표시
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!
댓글 수: 0
채택된 답변
Fangjun Jiang
2011년 7월 22일
A=rand(3,51);
Index=and(A<0.8,A>0.5);
A(Index)=0;
댓글 수: 4
Sean de Wolski
2011년 7월 22일
elements of A that are less than 0.8 AND those same elements of A greater than 0.5.
Jan
2011년 7월 22일
@Susan: You could read the documentation "doc and" also. Do we assist to solve your homework?
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!