import numpy as np
import scipy.io as scio
N=np.zeros((7,6))
N[0,:]=[1,2,3,0,4,0]
N[1,:]=[0,3,0,5,0,1]
N[2,:]=[2,0,1,5,1,0]
N[3,:]=[3,2,0,0,2,4]
N[4,:]=[11,3,0,5,0,1]
N[5,:]=[12,1,1,5,1,0]
N[6,:]=[13,2,0,0,2,4]#将矩阵保存
Embedding_UI = ‘E://Embedding_UI.mat’
#N是需要保存的矩阵,A为字典名,读取的方便,保存为新矩阵dataNew=Embedding_UI
scio.savemat(Embedding_UI, {‘train’:N})
#读取矩阵,矩阵的名字为train.mat
dataFile1 = ‘E://Embedding_UI.mat’ # mat文件路径,data为名字,其中的变量名为A
data = scio.loadmat(dataFile1)
train = data[‘train’]