Char to Double convertion

4 vues (au cours des 30 derniers jours)
Rick Oliveira
Rick Oliveira le 22 Mai 2020
Commenté : Rick Oliveira le 26 Mai 2020
I want to plot data given from a device that outputs the values as "Char", (see below).
I would like that the values appear as the ones shown in "figure 2".
Is it possible?

Réponse acceptée

Stephen23
Stephen23 le 22 Mai 2020
Modifié(e) : Stephen23 le 22 Mai 2020
>> str = 'LVLG -287.41E-03 -28.401E-03 -2.4001E-03';
>> tmp = regexp(str,'\S+','match');
>> vec = str2double(tmp(2:end))
vec =
-0.2874100 -0.0284010 -0.0024001
  1 commentaire
Rick Oliveira
Rick Oliveira le 26 Mai 2020
Thanks, it works.
All the best

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by