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!