extract numeric values from strings in xls files?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Walter Roberson
el 19 de Nov. de 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 comentarios
Ver también
Categorías
Más información sobre Environment and Settings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!