1
$\begingroup$

I have been trying to import some matrices from MATLAB to MATHEMATICA. The matrices are the output after I run the MATLAB file. I had saved that file in .MAT format and trying to import it in MATHEMATICA using "import" function but there is an error:

"Import::noelem: The Import element "P" is not present when importing as MAT

Set::wrsym: Symbol N is Protected

$Failed"

Maybe I am using the function wrongly, I typed: N = Import["C:\Users\Admin\Desktop\DDP\CODE\stiffness matrix\Shin_6.mat", "P"] Here Shin_6 is the mat file, P is the matrix that I want from that file and I name that matrix N in my Mathematica file.

Please suggest me with some solution. Matlab version 2015b, Mathematica version 10.0

$\endgroup$

closed as off-topic by MarcoB, user9660, ubpdqn, Bob Hanlon, m_goldberg May 6 '16 at 21:13

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – MarcoB, Community, ubpdqn, Bob Hanlon, m_goldberg
If this question can be reworded to fit the rules in the help center, please edit the question.

7
$\begingroup$

The syntax you use is wrong. There is no import element called "P" for the MAT format. Take a look at the documentation: it lists the allowed elements: "Elements", "Rules", "Options", "Data", "LabeledData", "Comments", "Labels".

You probably want "LabeledData", so use

Import["file.mat", {"MAT", "LabeledData"}]

or alternatively

Import["file.mat", "LabeledData"]

which auto-detects the format based on the file extension.

The pick out the P variable from the output (ReplaceAll or Lookup)

$\endgroup$

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