selectively replace elements in vector
Mostra commenti meno recenti
I need to replace some of the values in a vector example
a = [ 2 2 2 2 3 3 3 3 7 7 4 4 4 4 4 7 7 7 7 7 7 1 1 1 ]
I need to replace only the 7's occurring between 3 and 4 , and put 3 or 4 there
thanks in advance.
4 Commenti
Walter Roberson
il 23 Gen 2013
If there was [3 7 1 5 9 4] then would the 7 be counted as being between 3 and 4 ?
You have as a sublist, [3 7 7 4]. Is either 7 counted as being between 3 and 4? The first 7 is between 3 and 7, and the second is between 7 and 4.
Which are you wanting to put in, 3 or 4 ?
Srinivas
il 23 Gen 2013
Walter Roberson
il 23 Gen 2013
So if you have one or more 7's that is immediately preceded with a 3 and immediately followed by a 4, then the 7's are all to be changed to 4's ?
Srinivas
il 23 Gen 2013
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Matrices and Arrays in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!