How to replace all but one value with zero
30 ビュー (過去 30 日間)
I have generated the following vector f:
f=[49; 18; 48]
And I want to be able to replace each element, except let's say f21, with a value, let's say zero.
f=[0; 18; 0]
I have been playing around with loops, but I cant seem to figure it out just yet..
Does anyone have any advice on how to handle this? Preferably a solution that also works for larger matrices.