MATLAB Answers

Char to Double convertion

4 views (last 30 days)
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?

  0 Comments

Sign in to comment.

Accepted Answer

Stephen Cobeldick
Stephen Cobeldick on 22 May 2020
Edited: Stephen Cobeldick on 22 May 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 Comment

Rick Oliveira
Rick Oliveira on 26 May 2020
Thanks, it works.
All the best

Sign in to comment.

More Answers (0)

Tags


Translated by