MATLAB Answers

how to delete value?

1 view (last 30 days)
SM
SM on 19 Aug 2020
Commented: Walter Roberson on 19 Aug 2020
I have two arrays which are:
A=[1 1 4 2 1 3 1 3 2 2];
a=[1 3 1 2];
The outcome will be:
A=[4 1 1 3 2 2];
The very beginning elements in A turn empty based on the elements in a. It is possible by using loop and function find. Is there any other way? TIA
  2 Comments
Walter Roberson
Walter Roberson on 19 Aug 2020
Is the rule sort of like:
Look at the next element of a . Take the value there, and locate the first occurance of it in A, and change that to 0 in A. Then move on to the next element of a
Another way of saying that is that there are two 1's in a and the first two 1's in A are to be set to 0; there is one 2 in A and the first 2 in A is to be set to 0; there is one 3 in a and the first 3 in A is to be set to 0
??

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by