I have a text file called EXP1_SQ1_Template.txt, that has 8 lines. it looks like this:
LOAD BOX 1 SUBJ M1_299633_D295158_JUN19@1910_Aut_ERROR2 EXPT St(m)_Se(n)_Rat1 GROUP 1 PROGRAM 1908_SIP_EPHYS_ERROR2_St3_TrainWZ_Cbi (x)
LOAD BOX 2 SUBJ M2_297928_D294277_APR19@1910_Aut_ERROR2 EXPT St(m)_Se(n)_Rat2 GROUP 2 PROGRAM 1908_SIP_EPHYS_ERROR2_St3_TrainWZ_Cbi (x)
LOAD BOX 3 SUBJ M3_299632_D295158_JUN19@1910_Aut_ERROR2 EXPT St(m)_Se(n)_Rat3 GROUP 1 PROGRAM 1908_SIP_EPHYS_ERROR2_St3_TrainWZ_Cbii (x)
LOAD BOX 4 SUBJ M4_297929_D294277_APR19@1910_Aut_ERROR2 EXPT St(m)_Se(n)_Rat4 GROUP 2 PROGRAM 1908_SIP_EPHYS_ERROR2_St3_TrainWZ_Cbii (x)
LOAD BOX 5 SUBJ F5_299621_D295158_JUN19@1910_Aut_ERROR2 EXPT St(m)_Se(n)_Rat5 GROUP 1 PROGRAM 1908_SIP_EPHYS_ERROR2_St3_TrainWZ_Cbi (x)
LOAD BOX 6 SUBJ F6_297923_D294277_APR19@1910_Aut_ERROR2 EXPT St(m)_Se(n)_Rat6 GROUP 2 PROGRAM 1908_SIP_EPHYS_ERROR2_St3_TrainWZ_Cbi (x)
LOAD BOX 7 SUBJ F7_299626_D295158_JUN19@1910_Aut_ERROR2 EXPT St(m)_Se(n)_Rat7 GROUP 1 PROGRAM 1908_SIP_EPHYS_ERROR2_St3_TrainWZ_Cbii (x)
LOAD BOX 8 SUBJ F8_297924_D294277_APR19@1910_Aut_ERROR2 EXPT St(m)_Se(n)_Rat8 GROUP 2 PROGRAM 1908_SIP_EPHYS_ERROR2_St3_TrainWZ_Cbii (x)
note the variables in (). I want a user to edit those, with user input. to that end, I wrote a code that is supposed to import this file, and then replace the strings.
here is the code:
Mac_Templ = importdata('EXP1_SQ1_Template.txt')
user_input_stage = input('Enter correct Stage: ');
Stage_Correction = strrep(Mac_Data, '(m)', user_input_stage);
user_input_session = input('Enter correct Session: ');
Session_Correction = strrep(Mac_Templ, '(n)', user_input_session);
user_input_list = input('Enter correct List: ');
List_Correction = strrep(Mac_Data, '(x)', user_input_list);
nothing is working as the Mac_Templ variable is saving the string "Exp1_SQ1_Template.txt". I am not sure what I am doing wrong. using
Exist('EXP1_SQ1_Template.txt')
returns a 2. thanks for the help