import numpy as np from math import * import matplotlib.pyplot as plt fname = 'ADCdata.txt' fs = 5000.0 print "fs = %f" % (fs) Ts = 1/fs fO = open(fname) ln = fO.readline() arr = np.array([]) while not(ln==''): tab1 = ln.find('\t') # elso tabulator megtalalasa tab2 = ln.find('\t', tab1+1) # masodik tabulator megtalalasa tab3tab = ln.find('\t', tab2+1) # ha sima tabbal van elvalasztva tab3par = ln.find('(') # ha zarojellel meg van adva a tipus if (tab3par<0): tab3par = tab3tab tab3 = min(tab3tab, tab3par) numberRaw = ln[tab2+1:tab3] # a nyers szam if len(numberRaw)>2: if numberRaw[0:2]=='0x': numberRaw = int(numberRaw,16) # ha hexa arr = np.append(arr, float(numberRaw)) ln = fO.readline() # read a new line N = len(arr) t = np.array(range(N)) * Ts * 1e3 plt.plot(t, arr,'.-') plt.grid(True) plt.xlabel('t [ms]') plt.ylabel('x(t)') plt.show()