help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: regexprep resolve a comma value from a string


From: Philip Nienhuis
Subject: Re: regexprep resolve a comma value from a string
Date: Fri, 9 Jun 2017 09:46:50 -0700 (PDT)

hxchrist123 wrote
> Hallo, i stuck at the following problem.
> I have a Output-cell wich has the following form:
> 
> Output{8}=real:temp:297,15
> 
> My goal is to have just the value of 297,15.
> With
> Temp=str2num(regexprep(Output{8},'\D+', ''));
> i got just the numbers 29715.
> The comma is deleted. How I can I resolve the complete comma number?

A regexp along the lines of

cell2mat (regexp ("real:temp:297,15", '.+?([\d\.,]+)', "tokens"))
ans =
{
  [1,1] = 297,15
}

should do the trick.

Philip



--
View this message in context: 
http://octave.1599824.n4.nabble.com/regexprep-resolve-a-comma-value-from-a-string-tp4683609p4683624.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]