[1 0 1 1 0 1 1 0] to [10 11 01 10]?

1 vue (au cours des 30 derniers jours)
Emanuel
Emanuel le 1 Juin 2019
Commenté : James Tursa le 2 Juin 2019
I need to transform 8 numbers into 4 like the title, how could i do that?
  3 commentaires
James Tursa
James Tursa le 1 Juin 2019
"Numeric formats do not store leading digits"
I know what you meant by this (floating point formats), but in fact all of the integer formats store leading digits. For these formats it is more of a display issue rather than a storage issue.
James Tursa
James Tursa le 2 Juin 2019
@Stephen: I was responding to your blanket statement ... not to OP directly. E.g., the leading bits of 2's complement integers are physically stored, regardless of whether the MATLAB doc talks at this level or not.

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 1 Juin 2019
V = [1 0 1 1 0 1 1 0];
one_way = V(1:2:end) * 10 + V(2:2:end)
another_way = reshape(V, 2, []).'

Plus de réponses (0)

Catégories

En savoir plus sur Elementary Math 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!

Translated by