4
$\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$
6
$\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
    $\begingroup$ Side note: consistent fail of TextRecognize , it converts all right brackets to 1's in image example given. $\endgroup$ – Dave Apr 27 '17 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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