1
$\begingroup$
data={{"0.00mA", "0.18V", "43.1mV"}, {"0.02mA", "0.22V", "55.9mV"}, {"0.03mA", "0.30V", "59.4mV"}, {"0.05mA", "0.33V", "63.6mV"}, {"0.05mA", "0.36V", "79.8mV"}, {"0.07mA", "0.42V", "91.5mV"}, {"0.10mA", "0.54V", "92.6mV"}, {"0.09mA", "0.60V", "91.9mV"}, {"0.00mA", "0.15V", "39.1mV"}, {"0.00mA", "0.18V", "43.1mV"}, {"0.02mA", "0.22V", "55.9mV"}, {"0.03mA", "0.30V", "59.4mV"}, {"0.05mA", "0.33V", "63.6mV"}, {"0.05mA", "0.36V", "79.8mV"}, {"0.07mA", "0.42V", "91.5mV"}, {"0.10mA", "0.54V", "92.6mV"}, {"0.09mA", "0.60V", "91.9mV"}}

I use the following code,but very slow.

Map[QuantityMagnitude@
ReleaseHold@WolframAlpha[#, {{"Input", 1}, "Input"}] &, data, {2}]

How to convert it to a matrix that only contains number?

$\endgroup$
2
  • 1
    $\begingroup$ Is QuantityMagnitude[Map[Interpreter["Quantity"], matrix, {2}]] still too slow for your needs? $\endgroup$ May 9, 2016 at 14:06
  • $\begingroup$ Good,I intend to use Interpreter["Units"], but found nothing. $\endgroup$
    – partida
    May 9, 2016 at 14:13

2 Answers 2

1
$\begingroup$
Map[First@StringCases[#, NumberString] &, data, {2}]

This code can cater my purpose.

$\endgroup$
1
$\begingroup$

Example:

MatrixForm @ Partition[StringDelete[Flatten @ data, LetterCharacter], 3]

Ex. time: .00010723

Output

output example

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.