-
Notifications
You must be signed in to change notification settings - Fork 3
/
savefiles.m
36 lines (30 loc) · 996 Bytes
/
savefiles.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% StoreFiles
%%
%% Load files with a specific suffix and store them in a mat-file
%%
%% © R.A.I. Bethlehem 2012
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [] = rb_StoreFiles(Dir,Suffix)
% check input variables
if nargin<2, fprintf('You probably forgot something, check your input!!\n'), return, end;
% get directory list given filetype and suffix
FileList = dir(fullfile(Dir,Suffix));
% loop trough all files and give them a cell index and index name
for i=1:(length(FileList)
file_name = FileList
data = load(file_name)
% convert to single precision to reduce filesize
data = single(data);
% put data in cell structure
DATA(i).data = data;
% put name in cell structure
DATA(i).name = file_name1;
end
% input for storage name
new_name = input('Name of the dataset: ','s');
% save with compression
save(new_name,'DATA','-v7.3');
end