Effacer les filtres
Effacer les filtres

how to read numbers in a string where white-space separated everthing

2 vues (au cours des 30 derniers jours)
how to read numbers in a string where white-space separated everything here an example for 2 numbers in a string tab separated: '3 9 8 . 6 1 9 5 0 0 1 3 0 3 1 3 . 2 1 2 7 6 0'
Thanks, Frank
  2 commentaires
Jan
Jan le 8 Nov 2012
You forgot to explain what you want as output.
Francois Doucet
Francois Doucet le 8 Nov 2012
>> strrep(S,' ','')
ans =
' 3 9 8 . 6 2 0 0 0 0 ' ' 1 3 0 2 7 1 . 9 9 1 6 0 8 '

Connectez-vous pour commenter.

Réponse acceptée

Matt Fig
Matt Fig le 8 Nov 2012
Modifié(e) : Matt Fig le 8 Nov 2012
This is not possible without more information. Say you do this:
S=strrep('3 9 8 . 6 1 9 5 0 0 1 3 0 3 1 3 . 2 1 2 7 6 0',' ','')
% S='398.619500130313.212760'
Should the second number be 313.212760 or 130313.212760 or 3.212760 or any of the other several or so combinations? You need to provide more information to be able to decipher the numbers.
  14 commentaires
Matt Fig
Matt Fig le 8 Nov 2012
Glad to help! I am still curious as to how you ended up with char(0) instead of char(32), but I guess we may never know.
Francois Doucet
Francois Doucet le 8 Nov 2012
big-endian/small-endian?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Numeric Types dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by