replace array numbers in places that are not the indices of another array
Show older comments
Hello, I have array_1 looks like this: array_1=[4 7 22 44 13 4 1 9 6 0 5 77 45 12];
I have another array -> array_2=3:7;
I need to write a code such that the indices of array_1 which are represented in array_2 will stay as they are and all the others will replaced by zeroe so I can get:
array_1=[0 0 22 44 13 4 1 0 0 0 0 0 0 0];
Help please! Thanks
Accepted Answer
More Answers (1)
Alon
on 10 Apr 2014
0 votes
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!