How to delete values using logical operator.
2 次查看(过去 30 天)
显示 更早的评论
Ok y'all I know what is wrong with my function, but I want to delete all the 4's and 6's in a vector r. Here is as close as I came...
function f=test7() clc; r=[2 4 3 1 8 7 6 1 6 0]; r(r==(4||6))=[]; f=r; endfunction
which of course just deletes all the ones. Answer away.
0 个评论
采纳的回答
Ahmet Cecen
2018-3-3
编辑:Ahmet Cecen
2018-3-3
function f=test7()
clc;
r=[2 4 3 1 8 7 6 1 6 0];
r(r==4|r==6)=[];
f=r;
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!