function fix_flagged_file_facts_from_access(table,colnames,extdata,whereclause_info,database_modification_style) %this file uses the database toolbox and sql syntax to 'update' selected fields from selected records %it can be used in conjunction with simple_database_querier like this: %[flagged_filenames,repeated_entries]=simple_database_querier; -- with whatever query is appropriate %fix_flagged_file_facts_from_access(flagged_filenames) conn=database('microperfusion_data_sourcename','',''); %microperfusion_data_sourcename setdbprefs('datareturnformat','cellarray'); extdatacell{1}='[]' colnamescell{1}='suffix' update(conn,'patchlog_epochs_table',colnamescell, extdatacell,'') return %------------ % table='patchlog_epochs_table' %colnamescell{1}='conversion_to_mV_or_pA_postsyn_channel' %extdatacell{1}='null' %whereclause='WHERE epoch_free_of_severe_technical_problems = 0' %----------- %USE THIS FORM WHEN FEEDING IN DATA FROM ANOTHER M-FILE, WITH ONE CALL TO THIS M-FILE PER DATUM if database_modification_style==1 %extdatastr=num2str(extdata); %use when string data is required by the database extdatacell{1}=extdata; colnamescell{1}=colnames; update(conn,table,colnamescell, extdatacell,whereclause_info) %-------------- % %USE THIS FORM WHEN FEEDING IN DATA AS CELL ARRAYS WITH WHERECLAUSE INFO TELLING WHERE EACH DATUM IS PLACED elseif database_modification_style==2 for i=1:size(whereclause_info,1) colnamescell{1}=colnames; datacell{1}=num2str(extdata{i}); %extdatastr=num2str(extdata(1,:)); %as is, THIS ADDS THE SAME VALUE TO ALL SLOTS %extdatacell{1}=extdatastr; update(conn,table,colnamescell,datacell,strcat('WHERE first_patchlogfile_this_expt=''', whereclause_info{i}, '''')) end end close(conn)