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


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


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)


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