# Importing data from a MATLAB file to MATHEMATICA [closed]

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

## closed as off-topic by MarcoB, user9660, ubpdqn, Bob Hanlon, m_goldbergMay 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.

• (MAT). Also, consult the most common pitfalls Q&A thread. – Sektor May 5 '16 at 9:38
• N is also a protected term in Mathematica, because it is the numerical evaluation function. I would recommend against single capital letter symbols, because many are protected such as C, D,E, I ... – Rashid May 5 '16 at 11:50
• Consider MATLink. – Michael E2 May 6 '16 at 16:55
• – Léo Léopold Hertz 준영 Sep 23 '16 at 10:13

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)