Filter löschen
Filter löschen

Extracting data from a cell format

1 Ansicht (letzte 30 Tage)
Lue
Lue am 29 Mär. 2011
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?

Antworten (1)

Clemens
Clemens am 29 Mär. 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.

Kategorien

Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by