2
$\begingroup$

I have an excel file I am trying to import into Mathematica. It is in the format of variables names in the first row of each column and then the data underneath. One of the columns specifies hospitals, so each row has observations for each hospital. There are approximately 800 columns and 400 hospitals. Some of the variables are strings, such as hospital names. But I could delete those in Excel if I had to. I imported it and the text filled the screen. I saw there was a program called Link for Excel, but $250 is a lot of money for a student. I then tried ListView and the table was all wrong. The variable names were in the first column. It seems like it was displaying rows as columns. I want to make sure what is imported is a matrix so we can run some linear programming. Thanks so much for your help in advance!

$\endgroup$
  • $\begingroup$ Take a look at Import[] ... What do you mean by " I imported it and the text filled the screen"? $\endgroup$ – Dr. belisarius Jun 17 '13 at 22:59
  • $\begingroup$ Use the Transpose[] function to convert between rows and columns. $\endgroup$ – shrx Jun 17 '13 at 23:01
3
$\begingroup$

How about:

 data = Import[file.xls, {"Data", 1}]
$\endgroup$
  • 1
    $\begingroup$ And if you don't want to see the data "fill the screen" when you do the import, add a semi-colon at the end: data = Import[file.xls, {"Data", 1}]; $\endgroup$ – bill s Jun 18 '13 at 2:09

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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