2
$\begingroup$

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]"}}]`
$\endgroup$
10
  • $\begingroup$ 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. $\endgroup$
    – Jonie
    Commented Jul 24, 2013 at 6:15
  • $\begingroup$ @ 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!? $\endgroup$
    – Shield
    Commented Jul 24, 2013 at 6:20
  • 1
    $\begingroup$ @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. $\endgroup$ Commented Jul 24, 2013 at 7:20
  • 1
    $\begingroup$ I have tested things and it seems indeed using "List" or "Table" causes the trouble. Just use matrix = First@Import[fileName]; $\endgroup$ Commented Jul 24, 2013 at 7:36
  • 1
    $\begingroup$ 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. $\endgroup$ Commented Jul 24, 2013 at 7:41

1 Answer 1

5
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ @ Nikola Dimitrov : Thank you Nikola !! That's the best way!! $\endgroup$
    – Shield
    Commented Jul 24, 2013 at 8:11
  • $\begingroup$ Glad to help :) $\endgroup$
    – Sektor
    Commented Jul 24, 2013 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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