Message Boards Message Boards

GROUPS:

Import Matrix from Excel file

Posted 9 years ago
3712 Views
|
1 Reply
|
1 Total Likes
|
Hi, I'm trying to import a matrix from an Excel file. The imported matrix appears to transposed and in vector form.

Firstly, I created a test matrix and exported into an Excel file. 
m = Table[i - j, {i, 5}, {j, 6}]
Export["mfile.xls", m, "XLS"]

Then tried to import the mfile.xls  (created above)
mn = Import["mfile.xls", "XLS"] // MatrixForm
The output appears to be different from the original matrix.
a.  How can I get rid of the vector form and transform the matrix?
b . How to get rid of the "." periods after each integer?
POSTED BY: Rashmil D
Posted 9 years ago
In[1]:= m = Table[i - j, {i, 5}, {j, 6}];
Export["mfile.xls", m, "XLS"];
mn = Rationalize[First[Import["mfile.xls", "XLS"]]];
m == mn

Out[4]= True
POSTED BY: Bill Simpson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract