Extracting data from a cell format
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I got some data from an equimpment and the data comes like a xls file. Nevertheless, smartly, the equipment output mixes strings and numbers in one single cell. So the result I get when I call one data from the array is '0.00064 uA DC'. Because each data mixes strings and numbers the listed format in my workspace for this data is CELL. I have to extract the number in each data and indetify the 'uA' part to convert it to e-6. So when a call the variable I have this data: m = '0.00064 uA DC' (cell) And I would like to convert this into: m = 6.4e-10 (number) Help?
Help?
0 comentarios
Respuestas (1)
Clemens
el 29 de Mzo. de 2011
You can do the splitting with regexp.
It will look like:
out = regexp(in , '([.0-9]+) (.*)','tokens')
This will give you cells where in the first should only be numbers and in the second the unit.
str2double can convert the first part into a number.
The string for the unit you can pick apart similar.
0 comentarios
Ver también
Categorías
Más información sobre Characters and Strings 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!