27 lines
686 B
Python
27 lines
686 B
Python
__author__ = 'dmy'
|
||
|
||
import numpy
|
||
|
||
class IEEEData:
|
||
def __init__(self,filePath,seperator='\t'):
|
||
self._filePath=filePath
|
||
self._seperator=seperator
|
||
self._read()
|
||
def _convertToVector(self,lineVec):#把数据文件按分隔符存成矩阵,像Matlab一样。
|
||
self._array=numpy.array(lineVec)
|
||
print(lineVec)
|
||
print(self._array[0])
|
||
|
||
def _read(self):
|
||
lineVec=[]
|
||
with open(self._filePath,'tr') as f:
|
||
for line in f:
|
||
if len(line.strip())==0:
|
||
continue
|
||
lineVec.append([float(x) for x in line.split(self._seperator)])
|
||
self._convertToVector(lineVec)
|
||
|
||
|
||
|
||
|