How to remove specific numbers from an array?
41 次查看(过去 30 天)
显示 更早的评论
lb = [0 0 0 0 0];
ub = [24 24 24 24 24];
How can I remove or not consider certain values in the array? For each 0 - 24 range for 5 different slots, I want to eliminate the numbers 10 to 18.
0 个评论
采纳的回答
Askic V
2023-2-9
编辑:Askic V
2023-2-28
If you want to remove certain values from the array, please have a look at this simple example:
v = randi(10,1,20) % generate 20 random integer numbers in interval 0 to 20
ind = v>3 & v<7; % find indices of elements in certain interval
v(ind) = [] % remove those elements that fits criteria
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Least Squares 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!