Welcome to the forums. Please post in English or French.

You are not logged in.

#1 2020-11-12 21:03:29

Achille_2016
Member
Registered: 2020-11-11
Posts: 9

Import MASS and STIFFNESS matrices extracted from Code-Aster in matlab

Hi everyone.
I extracted the mass and stiffness matrix of a structure using in the comm file these instruction

import numpy as np
import scipy.sparse as ss
# vals, lins, cols, dim = M.EXTR_MATR(sparse=True)
mas = ss.csr_matrix(M.EXTR_MATR())
stif = ss.csr_matrix(K.EXTR_MATR())

ss.save_npz("/home/daniele/salome_meca/appli_V2019.0.3_universal/USERS/prova/Mass.npz", mas)
ss.save_npz("/home/daniele/salome_meca/appli_V2019.0.3_universal/USERS/prova/Stiff.npz", stif)

At the end i obtained the compressed file mas and stif containing npy files. How can i rebuild the matrices in matlab?
Thank you to those can help me

Offline

#2 2020-11-18 01:07:39

lsalles
Member
From: Imperial College London
Registered: 2011-09-27
Posts: 42

Re: Import MASS and STIFFNESS matrices extracted from Code-Aster in matlab

Hi,
You can use directly the aij format (vals, lins, cols, dim) and use scipy.io.savemat to save them directly in mat format and import the mat file into Matlab.
Regards,
Loic

Offline