12345678910111213141516171819202122232425262728 |
- % LoadQuestions.m
- %
- % This function loads the question files and returns them in a cell
- % array. The first column is the question identifier
- %
- % input:
- % inputFile - name of the file
- %
- % output:
- % qIds - question IDs, nx1 cell array
- % options - options following the question ID. It is an nx1 cell array which contains
- % the available options as another cell array in each line
- function [qIds, options] = LoadQuestions(inputFile)
- fid = fopen(inputFile);
-
- qIds = {};
- options = {};
- line = fgetl(fid);
- ind = 1;
- while ischar(line);
- tmpLine = strsplit(line, ',');
- qIds{ind,1} = tmpLine{1,1};
- options{ind,1} = {tmpLine{2:end}};
- line = fgetl(fid);
- ind = ind + 1;
- end
- end
|