extract numeric values from strings in xls files?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Walter Roberson
il 19 Nov 2011
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 Commenti
Vedere anche
Categorie
Scopri di più su String Parsing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!