%Get events from text file
prompt_totalfiles = 'Enter number of files you want to input: '; %asks for number of files
total_files = input(prompt_totalfiles);fileids = cell(total_files,1);j = 1;Baseline_adjustment = 0.1; %put in baseline photodetector value here (the readout with the led on but the patch cable in pitch black
wholedff = cell(1, 11);for file = 1:total_files[inputfile,path] = uigetfile('*.txt');fileids{file} = fopen(fullfile(path, inputfile));if fileids{file} == -1 error('Failed to open file "%s"', fullfile(path, inputfile));endb = textscan(fileids{file},'%n %n',-1, 'delimiter', '/t');events = b{1};event_times = b{2};
I am trying to use this code to read in only the first two columns of the text file. However, it doesn't seem to work: what I obtain is a 1×2 cell with [3;1] in the first column and [819;0] in the second one.
Instead, it should be [3; 3; 2; 1; 4; 5; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0] and [819; 826; 2279; 3427; 3907; 3919; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0].
Thanks!
Best Answer