Azzera filtri
Azzera filtri

Extracting data from a cell format

1 visualizzazione (ultimi 30 giorni)
Lue
Lue il 29 Mar 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?

Risposte (1)

Clemens
Clemens il 29 Mar 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.

Categorie

Scopri di più su Data Type Conversion 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!

Translated by