How can i assign a value for this type of datas?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I want to assign a value for a given vector with using a one rule. Assigned value will be named as x.
My reference vector is:
[6 5 4 3 2 1]
For ex., given vector is symbolized as A:
A=[NaN NaN 1 1 NaN NaN]
x should be equal to 4.
or if A equals to:
A=[1 1 1 1 1 1]
x=6
Finally, a last example:
A=[NaN NaN NaN 1 1 1]
x=3
Briefly, x value should be equal to leftmost 1's reflection in referance vector.
How can i perform this control?
Thx!
2 commentaires
Réponse acceptée
madhan ravi
le 25 Mar 2019
Modifié(e) : madhan ravi
le 25 Mar 2019
V(find(A==1,1,'first')) % V is your referenced vector
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!