Replace even element with zero
9 次查看(过去 30 天)
显示 更早的评论
Hi.
I am trying to replace even elements in my matrix with zero like below:
a = [3 5 4 1 2]
enter magical code here
a = [3 5 0 1 0]
Any help would be greatly appreciated
1 个评论
回答(1 个)
KALYAN ACHARJYA
2020-11-22
编辑:KALYAN ACHARJYA
2020-11-22
"I am trying to replace even elements in my matrix with zero like below:"
a(2:2:end)=0
But the example is different ??
a = [3 5 0 1 0]
2 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!