从几个在线想法(即here)来看,我有这样的想法:
但是,这种方法的问题是占用了太多的时间和太多的磁盘空间(每个.mat都有5Mb)。我想跑上千遍)。你知道吗
所以我想:
这是可能的和正确的方法吗?你知道吗
我现在正在使用的代码:
from oct2py import octave as oct
currentdirpath = os.getcwd() # get current directory path
currentfoldername = os.path.basename(currentdirpath) # get current folder name
newfoldername = "autogenerated_mats_" + datetime.datetime.now().strftime("%m_%d_%y%H_%M_%S") #creates the name unique folder that will store all the .mats generated;
os.makedirs(newfoldername) #creates an unique folder that will store all the .mats generated;
numoftimestoexecute = 2 #How many time would you like to execute
for x in range(numoftimestoexecute):
dateforname = "autogenerated_m_" + datetime.datetime.now().strftime("%m_%d_%y%H_%M_%S")
saveworkspace = "save -v7 " + currentdirpath + "\\" + newfoldername + "\\" + dateforname + "_workspace.mat"
saveworkspace = saveworkspace.replace('\\', '/')
print("Generating " + str(x+1) + " of " + str(numoftimestoexecute))
oct.eval("Generate_Data")
#oct.eval("save -v7 myworkspace.mat")
oct.eval(saveworkspace)
伪代码思想:
storegeneration = oct.eval("Generate_Data")
storemyworkspace = oct.eval("save -v7 myworkspace.mat")
然后,和西皮一起
from scipy.io import loadmat:
D = loadmat(storemyworkspace )
目前没有回答
相关问题 更多 >
编程相关推荐