+ 2
how to read 14 files with these names using import scipy.io data = scipy.io.loadmat('filename.mat') in google colab
0 how to read 14 files with these names: BCICIV_calib_ds1a.mat BCICIV_calib_ds1f.mat BCICIV_eval_ds1d.mat BCICIV_calib_ds1b.mat BCICIV_calib_ds1g.mat BCICIV_eval_ds1e.mat BCICIV_calib_ds1c.mat BCICIV_eval_ds1a.mat BCICIV_eval_ds1f.mat BCICIV_calib_ds1d.mat BCICIV_eval_ds1b.mat BCICIV_eval_ds1g.mat BCICIV_calib_ds1e.mat BCICIV_eval_ds1c.mat using import scipy.io data = scipy.io.loadmat('1.mat') in google collab
5 Réponses
+ 3
Something like this:
names = ['BCICIV_calib_ds1a.mat',...]
data = {n:scipy. Io.loadmat(n) for n in names}
or if you don't want to type all the filenames you can do
names = [f'BCICIV_{s}_ds1{c}' for s in ('calib', 'eval') for c in 'abcdefg']
+ 3
Zhenis Otarbay i have no idea - that must depend of your particular task - maybe 'calib' files are train data, 'eval' files are testing data, maybe each of those files has to be divided into train and testing. I guess your best option is to ask the person who provided you with these data. (same for the dataset name)
Based on names, this might be a description of your datasets: http://www.bbci.de/competition/iv/desc_1.html
+ 3
Volodymyr Chelnokov yes you found it, thanks
+ 2
Volodymyr Chelnokov now I would like to split them into train and testing, how shall I do it?
+ 2
print(traindata[0]) gives me the following, should that be my dataset name?
{'__header__': b'MATLAB 5.0 MAT-file, Platform: GLNXA64, Created on: Mon Jul 7 19:01:56 2008', '__version__': '1.0', '__globals__': [], 'mrk': array([[(array([[ 2092, 2892, 3692, 4493, 5293, 6093, 6893, 7693,
8493, 9293, 10093, 10893, 11693, 12493, 13293, 16294,
17094, 17894, 18694, 19494, 20294, 21094, 21894, 22694,
23494, 24294, 25094, 25894, 26694, 27494, 30495, 31295,
32095, 32895, 33695, 34495, 35295, 36095, 36895, 37695,
38495, 39295, 40095, 40895, 41695, 44695, 45495, 46296,
47096, 47896, 48696, 49496, 50296, 51096, 51896, 52696,
53496, 54296, 55096, 55896, 58895, 59695, 60495, 61295,
62095, 62895, 63695, 64495, 65295, 66095, 66895, 67695,
68495, 69295, 70095, 73096, 73896, 74696, 75496, 76296,
77096, 77896, 78696, 79496, 80296, 81096, 81896, 82696,
83496, 84296, 87295, 88095, 88898, 89695, 90495, 91295,
92095, 92895, 93695, 94495, 97399, 98199, 98999, 99799,
100599, 101399, 102199, 102999, 103799, 104599, 105399, 106199,
106999, 107799, 108599, 111599, 112399, 113199, 113999, 114799,
115599, 116399, 117199, 117999, 118799, 119599, 120399, 121199,
121999, 122799, 125798, 126598, 127398, 128198, 128998, 129798,
130598, 131398, 132198, 132998, 133798, 134598, 135398, 136198,
136998, 139997, 140797, 141598, 142398, 143198, 143998, 144798,
145598, 146398, 147198, 147998, 148798, 149598, 150398, 151198,
154197, 154997, 155797, 156597, 157397, 158197, 158997, 159797,
160597, 161397, 162197, 162997, 163797, 164597, 165397, 168396,
169196, 169996, 170796, 171596, 172396, 173196, 173996, 174796,
175596, 176396, 177196, 177996, 178796, 179596, 182595, 183395,
184195, 184996, 185796, 186596, 187396, 188196, 188996, 18