Group Abstract Group Abstract

Message Boards Message Boards

0
|
5.1K Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Data Import[ ... , "Table" ] do not transpose

Posted 12 years ago

I want to ListPlot the data in my txt file.

In[5]:= data = 
 Import["C:UsersMitjaDocuments

ovaacrocurvature.txt", "Table"]

Out[5]= {{-3726, 5094}, {-3646, 5392}, {-3518, 5490}, {-3278, 
  5723}, {-3163, 5862}, {-2744, 6218}, {-2560, 6283}, {-2037, 
  6570}, {-1872, 6691}, {-1286, 6923}, {-1072, 6940}, {-429, 
  7070}, {-219.4, 7137}, {219.4, 7137}, {429, 7070}, {1072, 
  6940}, {1286, 6923}, {1872, 6691}, {2037, 6570}, {2560, 
  6283}, {2744, 6218}, {3163, 5862}, {3278, 5723}, {3518, 
  5490}, {3646, 5392}, {3726, 5094}, {}}

In[6]:= points = Transpose[{data[[All, 1]], data[[All, 2]]}]

During evaluation of In[6]:= Part::partw: Part 1 of {} does not exist. >>

During evaluation of In[6]:= Part::partw: Part 2 of {} does not exist. >>

During evaluation of In[6]:= Transpose::nmtx: The first two levels of the one-dimensional list {{{-3726,5094},{-3646,5392},{-3518,5490},{-3278,5723},{-3163,5862},{-2744,6218},{-2560,6283},{-2037,6570},{-1872,6691},{-1286,6923},{-1072,6940},{-429,7070},{-219.4,7137},{219.4,7137},{429,7070},{1072,6940},{1286,6923},{1872,6691},{2037,6570},{2560,6283},{2744,6218},{3163,5862},{3278,5723},{3518,5490},{3646,5392},{3726,5094},{}}[[All,1]],{{-3726,5094},{-3646,5392},{-3518,5490},{-3278,5723},{-3163,5862},{-2744,6218},{-2560,6283},{-2037,6570},{-1872,6691},{-1286,6923},{-1072,6940},{-429,7070},{-219.4,7137},{219.4,7137},{429,7070},{1072,6940},{1286,6923},{1872,6691},{2037,6570},{2560,6283},{2744,6218},{3163,5862},{3278,5723},{3518,5490},{3646,5392},{3726,5094},{}}[[All,2]]} cannot be transposed. >>

Out[6]= Transpose[{{{-3726, 5094}, {-3646, 5392}, {-3518, 
     5490}, {-3278, 5723}, {-3163, 5862}, {-2744, 6218}, {-2560, 
     6283}, {-2037, 6570}, {-1872, 6691}, {-1286, 6923}, {-1072, 
     6940}, {-429, 7070}, {-219.4, 7137}, {219.4, 7137}, {429, 
     7070}, {1072, 6940}, {1286, 6923}, {1872, 6691}, {2037, 
     6570}, {2560, 6283}, {2744, 6218}, {3163, 5862}, {3278, 
     5723}, {3518, 5490}, {3646, 5392}, {3726, 5094}, {}}[[All, 
   1]], {{-3726, 5094}, {-3646, 5392}, {-3518, 5490}, {-3278, 
     5723}, {-3163, 5862}, {-2744, 6218}, {-2560, 6283}, {-2037, 
     6570}, {-1872, 6691}, {-1286, 6923}, {-1072, 6940}, {-429, 
     7070}, {-219.4, 7137}, {219.4, 7137}, {429, 7070}, {1072, 
     6940}, {1286, 6923}, {1872, 6691}, {2037, 6570}, {2560, 
     6283}, {2744, 6218}, {3163, 5862}, {3278, 5723}, {3518, 
     5490}, {3646, 5392}, {3726, 5094}, {}}[[All, 2]]}]

It Imports data as Table perfectly, but it does not want to Transpose?... :( WHY?

POSTED BY: Mitja Jan?i?
4 Replies

To get rid of the extraneous {} in your data execute the following:

data=DeleteCases[data,{}]
POSTED BY: David Reiss
Posted 12 years ago
POSTED BY: Douglas Kubler
POSTED BY: Ilian Gachevski

*** Here is the file.

Attachments:
POSTED BY: Mitja Jan?i?
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard