close
In this example , we want to tell you how to replace specific number of array.
Assume we have follow matrix , and we want replace 0 to -1 ;
array = [0 3 1 5 6 0 0 1 4 7 9 0 0 0 4 5 3 0]
zero_loc = find(a == 0);
array(zero_loc) = -1;
the result of a will be :
array = [-1 3 1 5 6 -1 -1 1 4 7 9 -1 -1 -1 4 5 3 -1]
全站熱搜
留言列表