Loading data from document and isolating numbers.

1 次查看(过去 30 天)
Hi, I have to add to creating program a complicated database from other file with united numbers sometimes with no space between them. Which formula should I use to load from random line in data document, and isolate them to other calculations.
Example 1.543 345.1200 1.32399.0099.00 1.3399.00
Thank you.
  4 个评论
Thorsten
Thorsten 2013-1-9
Unless you have some further information about the values of the numbers (e.g., always > 10) or the format (e.g., number of significant digits) you cannot retrieve the original numbers, because you can cut a chunk of digits at any positions other than those just before and after a . that would leave you with this single '.', which is not a number.
ZK
ZK 2013-1-9
Thorsten like I said I have this value. It always looks like there is no space before 99.00

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2013-1-9
NumericLine = str2double( regexp( regexprep(TheLine, '99\.0', ' &'), '\s+', 'split') );
  2 个评论
ZK
ZK 2013-1-10
Thank You, You were very helpful, I check it. Can I work with this formula when I have whole database loaded with fopen and fscanf with numbers characters and words?
Walter Roberson
Walter Roberson 2013-1-10
You would need to have scanned the line as a string, so you might as well fgetl() instead of fscanf()

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Database Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by