extract numeric values from strings in xls files?
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I have an xls file with 10 columns. The columns are full of string and inside the strings there are some numeric values that I need to extract and put in a new column. I was thinking to do something like this:
load doc.txt %to load the file in txt format
for i=1:total lines of txt
read each line
take numeric values
put in table
end
I don't even know if any from above is possible in matlab. Is it possible to read strings and from them extract the numeric values?
0 件のコメント
回答 (1 件)
Walter Roberson
2011 年 11 月 19 日
You can use regexp() and str2double()
Note: if the values are floating point numbers that might be in exponential format, then it is fairly difficult to construct a correct regexp pattern that will match such numbers properly. When working with such numbers, it is much easier if there is a delimiter such as space or comma.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!