-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_data.m
42 lines (29 loc) · 815 Bytes
/
get_data.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
37
38
39
40
41
42
function [ data, filename] = get_data( data_type, separator , msg, file_type)
%UNTITLED1 Summary of this function goes here
% Detailed explanation goes here
[filename path] = uigetfile(file_type, msg);
if(path == 0)
error(['file not selected' ' :-(']);
exit
end
filepath = [path filename]
[fid,msg] = fopen(filepath,'r');
if(fid<0)
error(['Cannot open ' filename]);
exit
end
fprintf('file (%s) opened successfully\n', filename);
L = fscanf(fid, '%d', [1 1]); % Total features/dimension with class number
format = '';
for(i = 1:L-1)
format = [format data_type separator];
end
format = [format data_type];
%% Write code to get the data of your type
%<<
file_data = fscanf(fid, format, [L inf]);
file_data = file_data';
%>>
fclose(fid);
Antigen = file_data;
data = Antigen;