Last active
April 3, 2018 03:00
-
-
Save nithikan/2f07acc7b3d2b11b8e6b2efb85554c97 to your computer and use it in GitHub Desktop.
Assignment 1(Python)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################# | |
# Assignment 1 # | |
# Read every mat file in # | |
# a folder and plot the # | |
# annotation counts they # | |
# contain. # | |
# # | |
# Author : Nithikan (Bam) # | |
# Date : 02.04.2018 # | |
# # | |
################################# | |
import os | |
import scipy.io as sio | |
import matplotlib.pyplot as plt | |
foldername = '.' | |
filtername = 'mat' | |
foldercontents = os.listdir(foldername) | |
filteredcontents = [i for i in foldercontents if i.split('.')[-1] == filtername] | |
print(filteredcontents) | |
annCount = [] | |
for i in filteredcontents: | |
print ("D:/Coop/UCF_CC_50/" +str(i)) | |
data = sio.loadmat("D:/Coop/UCF_CC_50/" +str(i)) | |
len(data["annPoints"]) | |
print(len(data["annPoints"])) | |
annCount.append(len(data["annPoints"])) | |
print(annCount) | |
#plt.plot(annCount) | |
print(len(annCount)) | |
x = [i for i in range(len(annCount))] | |
plt.bar(x, annCount) | |
plt.show() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment