0
$\begingroup$

in this link i have two excel file that i want to plot them simultaneously but i can not do it. i want to draw files in one graph. i importing data by use of: s = Import["Example Data/population.xls"] but when i use ListPlot it draw a blank graph and i seriously confusing. link of my excel file

$\endgroup$
  • 1
    $\begingroup$ Numbers are stored as text in your Excel file, so they are imported as strings. You need to convert them back to numbers. Try s = ToExpression@Import["yourFile.xlsx"] instead. Note also that Import automatically generates a list of lists from Excel files, one element per tab in the original file. You might want to extract the first part of what Import returns, so s = ToExpression@Import["yourFile.xlsx"][[1]]. $\endgroup$ – MarcoB Feb 6 '17 at 9:32
2
$\begingroup$

There were two files, and I took one of them. Here is what I did:

In[12]:= top1 = 
  Import["<path to top1.xlsx"];

In[13]:= top1[[1, 1, 1]]

Out[13]= "-21.247643979057592"

In[14]:= Head[%]

Out[14]= String

Notice that the number is a string. Use ToExpression to get the strings converted into Real Numbers.

In[15]:= top11 = ToExpression[top1];

In[16]:= top11[[1, 1, 1]]

Out[16]= -21.2476

In[17]:= Head[%]

Out[17]= Real

In[18]:= ListPlot[top11[[1]]]

Here is the plot I got:

enter image description here

| improve this answer | |
$\endgroup$

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.