function update_patchlog(trial,time_since_prev_trial,log_filename,OVSF_presyn,OVSF_postsyn,pulse_duration_presyn,pulse_duration_postsyn,sampling_rate,... stim_philosophy_or_timing_offset,output_channel_to_presynaptic,patchlog_name) %modifies the patchlog after each trial by adding a new dataset recording that trial to the patchlog %first read the trial log into a variable input_reading=daqread(log_filename); raw_temperature_data=input_reading(:,3); temperature_during_train_mean=mean(raw_temperature_data); temperature_during_train_std=std(raw_temperature_data); input_reading=input_reading(:,1:2); %if the presynaptic neuron is patched by the electrode on amplifier channel 2, flip the input info l-r (the output having been flipped earlier) if output_channel_to_presynaptic==2 input_reading=fliplr(input_reading); %flipping the input channel data end %putting OVSF for this trial as the first item in each column OVSF_presyn_mat=[OVSF_presyn OVSF_presyn]; OVSF_postsyn_mat=[OVSF_postsyn OVSF_postsyn]; pulse_duration_presyn_mat=[pulse_duration_presyn pulse_duration_presyn]; pulse_duration_postsyn_mat=[pulse_duration_postsyn pulse_duration_postsyn]; sampling_rate_mat=[sampling_rate sampling_rate]; stim_philosophy_or_timing_offset_mat=[stim_philosophy_or_timing_offset stim_philosophy_or_timing_offset]; output_channel_to_presynaptic_mat=[output_channel_to_presynaptic output_channel_to_presynaptic]; temperature_during_train_mean_mat=[temperature_during_train_mean temperature_during_train_mean]; temperature_during_train_std_mat=[temperature_during_train_std temperature_during_train_std]; input_reading=cat(1,OVSF_presyn_mat,OVSF_postsyn_mat,pulse_duration_presyn_mat,pulse_duration_postsyn_mat,sampling_rate_mat,... stim_philosophy_or_timing_offset_mat,output_channel_to_presynaptic_mat,temperature_during_train_mean_mat,... temperature_during_train_std_mat,input_reading); %note -- experiments from before oct 20, 2003 will only have OVSF (equivalent to OVSF_presyn) appended to the beginning of the trial %open the .hdf log file to write storingraw=hdfsd('start',patchlog_name,'write'); %create the data set within the .hdf log file ds_name=int2str(time_since_prev_trial); %sets the ITI as the name of the data set ds_type='double'; ds_rank=2; ds_dims=fliplr(size(input_reading)); %flipping per the row/column preferences of hdf sds_id_u_p=hdfsd('create',storingraw,ds_name,ds_type,ds_rank,ds_dims); %place the data into the sds ds_start=zeros(1:ndims(input_reading)); %start at the beginning ds_stride=[]; %write every element ds_edges=fliplr(size(input_reading)); %reverse the dimensions for the conventions of hdf stathey=hdfsd('writedata',sds_id_u_p,ds_start,ds_stride,ds_edges,input_reading); %this stanza was used to confirm that the number of datasets == the number of trials; also confirmed the sds number starts at zero for the first trial and then increments (feb 24,2003) %trialnum=trial %sds_id_new=hdfsd('select',storingraw,trial-1)%if trial == number_of_trials %if trial==number_of_trials % disp('fromupdate') % [ndatasets,nglobal_atts,stat]=hdfsd('fileinfo',storingraw) %end %close the dataset statupdate1=hdfsd('endaccess',sds_id_u_p); %close the sd file statups=hdfsd('end',storingraw);