5
$\begingroup$

I would like to convert this .txt file: enter image description here

The [ ] indicate a row. The , separates the rows.

I want to convert this into a matrix.

How can I do it ?

Thanks.

$\endgroup$

1 Answer 1

7
$\begingroup$

You can Import[#, "Text"]& and then:

ImportString["[" <> # <> "]", "JSON"] & @ "[123.123,12,123],[1.1,1.2,3]"
{{123.123`, 12, 123}, {1.1`, 1.2`, 3}} 
$\endgroup$
1
  • 1
    $\begingroup$ Side note: consistent fail of TextRecognize , it converts all right brackets to 1's in image example given. $\endgroup$
    – Dave
    Commented Apr 27, 2017 at 17:50

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.