# Having Problem with Importing Excel file to Mathematica Notebook?

I have solved some equations and exported the final results, which they are several Matrices, as a EXCEL file ( .Xls ). Now, I want to use these EXCEL files as my inputs to solve some other equations. I use Import[] to read these EXCEL files. But when I import them, these Matrices appears like this : {"ÐÏ\.11à¡\[PlusMinus]"}

When I use Import[exp,"Table"] or Import[exp,"List"] the results are exactly same as previous one.

I don't know what the problem is ?!

This is part of the code :

AA = Import["C:\\Users\\Com\\Desktop\\EXCEL\\AA.Xls", "List"];

BB = Import["C:\\Users\\Com\\Desktop\\EXCEL\\BB.Xls", "List"];

CC = Import["C:\\Users\\Com\\Desktop\\EXCEL\\CC.Xls", "List"];

ssm = StateSpaceModel[{AA, BB, CC}]


The results :

During evaluation of In[8]:= StateSpaceModel::farg: {{ÐÏ\.11à¡\[PlusMinus]},
{ÐÏ\.11à¡\[PlusMinus]},{ÐÏ\.11à¡\[PlusMinus]}} is not a valid TransferFunctionModel
or a list of state-space matrices in the form {a, b, ...}. >>

During evaluation of In[8]:= StateSpaceModel::farg: {{ÐÏ\.11à¡\[PlusMinus]},
{ÐÏ\.11à¡\[PlusMinus]},{ÐÏ\.11à¡\[PlusMinus]}} is not a valid TransferFunctionModel
or a list of state-space matrices in the form {a, b, ...}. >>

StateSpaceModel[{{"ÐÏ\.11à¡\[PlusMinus]"}, {"ÐÏ\.11à¡\\[PlusMinus]"},
{"ÐÏ\.11à¡\[PlusMinus]"}}]

-
any chance you can upload the file (or a section of it)? Also make sure you're not switching between 32 and 64 bit applications. – Jonie Jul 24 '13 at 6:15
@ Jonie : Sorry! It's not possible for me to upload it! But if you want, I can write here part of the code which I have faced problem with!? – Shield Jul 24 '13 at 6:20
@Shield if you like using Excel to view large matrices, try getting used to using TableForm and Take or Part to view your matrices inside Mathematica. Furthermore, note that adding a second argument to Import like "List" or "Table" should not be necessary in this case. To save your matrices to the hard disk, see DumpSave and Save, or try directly to Export to the formats .mx .m. Dumpsave and Export to .mx create computer dependent versions. File created by Save and .m files can shared between computers. – Jacob Akkerboom Jul 24 '13 at 7:20
I have tested things and it seems indeed using "List" or "Table" causes the trouble. Just use matrix = First@Import[fileName]; – Jacob Akkerboom Jul 24 '13 at 7:36
More evidence that you are not supposed to use "List" or "Table" here comes from Import[filePath, "Elements"]. This shows you all the valid strings that can be used as second arguments. Here I think "Data" is the default. – Jacob Akkerboom Jul 24 '13 at 7:41

Do not Import[] the matrices back in Mathematica using the options "List" or "Table", because that causes the problem. The solution is to use Import["file.xls", "Data"][[1]] or just omit the "Data" option Import["file.xls"][[1]]. You can also use Mathlink for Excel, if you have one, to copy and paste data between the two applications.