// ReadABFFile // // Author: Joseph Grote // ReadABFFile reads in a ABF formatted data file // It cycles through all of the episodes. Macro ReadABFFile() string name variable file variable episodes variable channels string waveName variable size variable episode variable channel variable status string text string comments // brings up file select dialog open /d/r/t="????" file ABFFileClose ABFFileOpen S_fileName, status if (status != 0) ABFGetStatusText status, text print text return endif ABFFileGetComment comments, status if (status == 0) printf "File comments: %s\r", comments endif ABFChannelGetCount channels, status ABFEpisodeGetCount episodes, status printf "channels = %d\r", channels printf "episodes = %d\r", episodes // loop over episodes episode = 1 do // mimic C style for loop if (episode > episodes) break endif ABFEpisodeSet episode, status ABFEpisodeGetSampleCount size, status // loop over channels channel = 0 do if (channel == channels) break endif waveName = "data_" + num2str(episode) + "_ " + num2str(channel) printf "making %s\r", waveName make /n = (size) /d $waveName //ABFEpisodeReadStimulus channel, $waveName, status ABFEpisodeRead channel, 0, size, $waveName, status display $waveName as waveName channel += 1 while(1) episode += 1 while(1) ABFFileClose end