I am trying to use the following code to read in a text file.
%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);fileNames = cell(total_files,1);for file = 1:total_files[inputfile,path] = uigetfile('*.txt');fileNames{file} = fopen(inputfile);endj = 1;Baseline_adjustment = 0.1; %put in baseline photodetector value here (the readout with the led on but the patch cable in pitch black
dff1=[];dff2=[];dff3=[];dff4=[];dff5=[];dff6=[];dff7=[];dff8=[];dff9=[];dff10=[];dff11=[]; wholedff={dff1,dff2,dff3,dff4,dff5,dff6,dff7,dff8,dff9,dff10,dff11};%Read formatted data from text file
for file = 1:total_filesb = textscan(fileNames{file},'%n %n', -1, 'delimiter', '/t');
This is the error I receive:
Error using textscanInvalid file identifier. Use fopen to generate a valid file identifier.Error in StimulusTestNew (line 17)b = textscan(fileNames{file},'%n %n', -1, 'delimiter', '/t');
The text file I wanna read in is this: I want to read in only the first two columns.
Can you please help me? Thanks!
Best Answer