sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c2bfc569186895575b278b8cc04e6bd50e44fa0c3b2afc3f1b38381753d16815
MATLAB
4,955
102
% % % B01_raster_psth_sceneRecog_BAligned_BSep_NWB( nwbData, timestampsOfCell, channelid, cellNr, brainAreaOfCell, bin_width_raster, bin_width_fr, plot_flag) % %History %12/2/21: This file is forked from original B01_raster_psth_sceneRecog_BAligned_BSep.m by JZ. % function [] = B01_raster_psth_sceneRecog_SAligned_BSe...
d78fbb3cf540837b6dcca5562da7f309c6bd2a28cf97b04a20d03ffcb9ef1dd0
MATLAB
4,955
127
classdef SternRecording < AudioRecording methods (Static) function canLoad = canLoadFromPath(filePath) % See if the file's extension is .bin. [~, ~, fileExt] = fileparts(filePath); canLoad = strcmp(fileExt, '.bin'); if (canLoad) fid = fope...
157439e6b825a10b6785a5b615665c935cdb22f10b6523ddbd9df823c92f6ed9
MATLAB
4,957
139
function [] = updateEventSpikingPlots(paramGridFigHandles, analysisParam, gridOP, paramOP, simParam) %UPDATEEVENTSPIKINGPLOTS Summary of this function goes here % % Updates the plots in the parameter grid loop for the event Spiking analysis script ithGridOPPlot = 1; xVals = simParam.variedParam(1).range; xLabel = si...
83ddbf1d59f5f5db470a7414da3e6b32065d178ce7fc854186d44eb5c105122b
MATLAB
4,957
157
%% dd = dir('BenDec2019/*.lbl'); lblsnew = {dd.name}'; lblsnew = fullfile('BenDec2019',lblsnew); nlblsnew = numel(lblsnew); %% get all new movs mfa = []; tlbl = []; tlblconc = []; currmovoffset = 0; for i=1:nlblsnew ldnew = loadLbl(lblsnew{i}); mfacurr = ldnew.movieFilesAll; mfacurr = regexprep(mfacurr,'Z:\','/gr...
e389e80c6a64ffe17b28fd04c5996ccd0ebf879706f75473eac3c1086fea40ec
MATLAB
4,958
179
% Copyright (c) 2008 INRIA - Asclepios Project. All rights reserved. function writeinr(inrfile,data,type,voxelsize,slices) %Write down an image as an Inrimage file % WRITEINR(INRFILE, DATA, TYPE, VOXELSIZE, SLICES) % Input arguments: % INRFILE - filename % DATA - data matrix % TYPE - type of image...
e4ee9da0fa905b48c5e3df64201d8545ac7750929040af8a54af48e86acebdcc
MATLAB
4,958
131
function [freq] = ft_appendfreq(cfg, varargin) % FT_APPENDFREQ concatenates multiple frequency or time-frequency data structures % that have been processed separately. If the input data structures contain different % channels, it will be concatenated along the channel direction. If the channels are % identical in the ...
efd767d3a76b5c7af2255db71e915d1d3a800692374299d8dc406a6d311e9e46
MATLAB
4,962
169
function [ newevent, error ] = wlProc_fitFreqPhaseLogarithmic( ... hilfreq, hilphase, oldevent) % function [ newevent, error ] = wlProc_fitFreqPhaseLogarithmic( ... % hilfreq, hilphase, oldevent) % % This function estimates oscillatory burst frequency and phase by curve % fitting a logarithmic ramp in the region o...
87d42a6649960170187971e381fc1f7091bb349d0573b76598f4887db78717ba
MATLAB
4,963
152
function write_gdf(filename, hdr, data) % WRITE_GDF(filename, header, data) % % Writes a GDF file from the given header (only label, Fs, nChans are of interest) % and the data (unmodified). Digital and physical limits are derived from the data % via min and max operators. The GDF file will contain N records of 1 sampl...
cd12de80fa58912170f62aa67a4861bc446b0e665e1034247f61a5c0023c6b67
MATLAB
4,963
131
% check_stack.m % Sarah West % 8/27/21 % Checks if a preprocessed stack is corrupt function [] = check_stacks(parameters) % Assign parameters their original names input_data_name = parameters.input_data_name; dir_exper = parameters.dir_exper; mice_all = parameters.mice_all; digitNumber = pa...
54abeccba7196194db8a674a7caf16ab37fcf62bae9c2b510853689353a92069
MATLAB
4,967
158
function [T,Uinit] = tucker_als(X,R,varargin) %TUCKER_ALS Higher-order orthogonal iteration. % % T = TUCKER_ALS(X,R) computes the best rank-(R1,R2,..,Rn) % approximation of tensor X, according to the specified dimensions % in vector R. The input X can be a tensor, sptensor, ktensor, or % ttensor. The result r...
5df91a810a0258001e865b363387152fb80ebdaac176ebccc83f9ff29396f8c1
MATLAB
4,969
140
function [stat, cfg] = ft_statistics_crossvalidate(cfg, dat, design) % FT_STATISTICS_CROSSVALIDATE performs cross-validation using a prespecified % multivariate analysis given by cfg.mva % % Use as % stat = ft_timelockstatistics(cfg, data1, data2, data3, ...) % stat = ft_freqstatistics (cfg, data1, data2, data3...
37a0a96317ff42bfae4b8ffb9b0b4f67cdc433809525aded1a7fc29ea4d613c9
MATLAB
4,971
176
function [group_avgs, group_stes, subject_avgs, subject_stes, braindata] = selective_average_group(V, onsets, xyz_mm_pos, varargin) % .. % DOCUMENTATION NOT COMPLETE! % .. % uses selective_average.m % used in selective_average_interactive_view_init.m % % :Examples: % :: % % [group_avgs, group_stes, subject_avgs, ...
839bcc1848d430b43859f17b8bbd17405f66c0ebb8d0aca82c6a661a6e823d8f
MATLAB
4,971
223
function [xc,good,bad,type] = cornerfinder2(xt,I,wintx,winty,wx2,wy2); %[xc] = cornerfinder(xt,I); % %Finds the sub-pixel corners on the image I with initial guess xt %xt and xc are 2xN matrices. The first component is the x coordinate %(horizontal) and the second component is the y coordinate (vertical) % %Based on ...
127c4b0c43448e8df2fa2f6eb4aa8346b3fd897bc55a362388b57030b027859e
MATLAB
4,972
152
function pairsOut=View_Clear_Brain_ROI_Corr_fc(Anat,IM,M,dataOut,fc,Pmax,params) % % This function draws ROIs on the brain and connecting rods colored by sign % of correlation values in C. This can be the fc correlation itself if that % is passed, or it can be the correlation of brain fc with behavior if that % matri...
21e9e723005e8a0a4300b2510b172c36d8635a8cfa1b2357530d72efa0d7c804
MATLAB
4,976
171
function [P,Uinit] = cp_nmu(X,R,opts) %CP_NMU Compute nonnegative CP with multiplicative updates. % % P = CP_NMU(X,R) computes an estimate of the best rank-R PARAFAC % model of a tensor X with nonnegative constraints on the factors. % This version uses the Lee & Seung multiplicative updates from % their NMF alg...
0b5f14d56bbff7ae4d0bbb87c5e2da1b6868089c11cc90df6728d091204f14c0
MATLAB
4,977
166
function GonzalezPereyra_etal_Fig_01 load([pwd '/Data_GonzalezPereyra_etal_Fig_01.mat']) %#ok<*LOAD> ctrlColor=[168 177 192]./255; figure; set(gcf,'Position',[206 594 1087 202],'color','w'); theX=0.5:1:80; ctrlHist=histc(AllAnimals_AllRates_Ctrl(:,2),0:1:80); %#ok<*USENS,*HISTC> ctrlHist(end)=[]; subplo...
fb5e4f4d590f4591741bdcf29281a0551866c1c03b6e4eef56eba2cd2e139a44
MATLAB
4,977
163
function [dat] = read_neuralynx_cds(filename, hdr, begsample, endsample, chanindx) % READ_NEURALYNX_CDS reads selected samples and channels from a combined Neuralynx dataset with separate subdirectories for the LFP, MUA and spike channels % % Use as % hdr = read_neuralynx_cds(parentdir) % dat = read_neuralynx_c...
e332634d4438a9aaca197e2341fe4d07d3290ca25bc14e1b4fe2faf41d19eb06
MATLAB
4,978
214
%if exist('images_read'); % active_images = active_images & images_read; %end; var2fix = 'dX_default'; fixvariable; var2fix = 'dY_default'; fixvariable; var2fix = 'map'; fixvariable; if ~exist('n_ima'), data_calib; end; check_active_images; if ~exist(['I_' num2str(ind_active(1))]), ima_read_calib; ...
2208f1ea99af37d9bc08cd519263c9d545ccb14751bbe0f1a368b936841a0e46
MATLAB
4,979
142
% FindPhaseDifference.m % Sarah West % 7/20/23 % Finds the phase difference between two body part velocity traces for % pipeline_gait_analysis.m . Uses phdiffmeasure.m . Called by RunAnalysis. function [parameters] = FindPhaseDifference(parameters) % Inputs: reference = parameters.reference; % The cell arra...
79cca8409a0a5bd956fcfc5f44abfa5f9c7fc1d5d6dd575755dcbaca6f6c7ed5
MATLAB
4,979
126
classdef ParameterTreeConstraint < handle % A ParameterTreeConstraint is used at parameter-setting time to enforce % constraints between parameters that would be confusing for the user. % % In particular, eg a preprocessing parameter might have a constraint % with a CPR property; if a DL tracker is selected, ...
942cf3bc8fbae61c0360930facd1ab714dd8021348b0d2efdaebc31083be7695
MATLAB
4,979
153
% Second-kind integral equation on the unit square, Laplace single-layer. % % This is basically the same as IE_SQUARE1 but with the identity added to the % system matrix in order to create an artificial second-kind volume integral % operator. It skips the preconditioned GMRES comparison since the problem is % well-cond...
15200843ca1dd3dd9c83ec5c86effb1d78a416bcb27641013d9803096232ff89
MATLAB
4,980
144
function CBIG_preproc_create_ROI_regressors(fMRI_list, output_list, WB_mask, WM_mask, CSF_mask, diff_flag) % CBIG_preproc_create_ROI_regressors(fMRI_list, output_list, WB_mask, WM_mask, CSF_mask) % % This function creates ROI (region of interest) regressors based on given % masks: Whole Brain mask, White Matter mask o...
4ab719b623e5c2f256caf0fe5ceb4dc4cdee41e393329371943c0819b6bd4515
MATLAB
4,980
139
function write_brainvision_eeg(filename, hdr, dat, event) % WRITE_BRAINVISION_EEG exports continuous EEG data to a BrainVision *.eeg % and corresponding *.vhdr file. The samples in the exported file are % multiplexed and stored in ieee-le float32 format. % % Use as % write_brainvision_eeg(filename, hdr, dat) % % See...
a3393b657d3884d057c0342a35e7889c7d3df17250d84f5bef1969c4f8565e1f
MATLAB
4,980
112
function dlmcell(file,cell_array,varargin) % <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> %% % <><><><><> dlmcell - Write Cell Array to Text File <><><><><> % % <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> % % ...
40e55443aced009fb84ae138a4312f6ef40a654f456c47d58a5fd04bd0bef9fe
MATLAB
4,981
224
%%%%%%%%%%%%%%%%%%%% SHOW EXTRINSIC RESULTS %%%%%%%%%%%%%%%%%%%%%%%% if ~exist('show_camera'), show_camera = 1; end; if ~exist('n_ima')|~exist('fc'), fprintf(1,'No calibration data available.\n'); return; end; check_active_images; if n_ima ~= 0, if ~exist(['omc_' num2str(ind_active(1))]), fprintf(1,'...
70521fecf5f7c9a1cb6a4b6a1dcace3bcb7add33441e41eaee6383fd208186f2
MATLAB
4,982
148
%% parameters setting clear; hemi={'lh';'rh'}; hm=1; surf_tpe='sphere'; % surf_tpe='inflated'; %edit me surfsuffix='orig'; dataDir = '/home/xianchige/YZY/20220523data/sub03/session01/'; %dataDir = '/home/xianchige/YZY/20220322test/data/session1/sub01/'; %% load data % ssname='litongsubjectfortest'; % ssname='lito...
ec753adad5e31f83c900d93362c6f4131f4abd7584db24375bb253fb0baa0d66
MATLAB
4,983
139
function mscmd_detect3(timeseries_path,detect_out_path,opts) %MSCMD_DETECT3 - Detect super-threshold events in a raw/preprocessed dataset % %This is a wrapper to a command-line call to mountainsort. The %functionality is similar to that of ms_detect3. % % Syntax: mscmd_detect(input_path,output_path,opts) % % Inputs: %...
3cc572c2d400a619f21ccb5bf7367609a483d9e9d2978093c5496f57049fb9a0
MATLAB
4,985
138
function ga_mixedsensory_stats(subjects, nerve, has_allsubj) %% set variables srmr_nr = 2; savepath_ga = getenv('GADIR'); if nerve == 1 conditions = 2:3; % channels chan_names = {'Biceps' 'SC6' 'SC6_antRef' 'esg_cca' 'eeg_cca'}; nerve_name = 'median'; elseif nerve == 2 conditions = 4:5; % chan...
3e68d0aff497ad4c329703761eb267f0129a77902b359f0e8a6c2ea4a351c590
MATLAB
4,986
152
% l1 = load('/home/mayank/work/poseEstimation/RomainLeg/Apr28AndJun22_onlyBottom.lbl','-mat'); l1 = load('/localhome/kabram/Dropbox (HHMI)/MultiViewFlyLegTracking/multiview labeling/romainJun22NewLabels.lbl','-mat'); lfiles1 = {'/localhome/kabram/Dropbox (HHMI)/MultiViewFlyLegTracking/sep1616/sep1616-1531Romain.lbl' ...
60e1b9f0cdaea0099a47b111add0e70a0901058c47983776f2845b6e8fca1812
MATLAB
4,986
166
%% findMatchingStructRowFromString % %Macro for row-match indexing of struct field; used to find row indices for %a 1xN structure, which correspond to a query. % % pass in a struct, and field (of strings/characters), and find the unique % vals, and produce an iterator for each unique type 'class', which can % l...
051627a201b29ce687e708a46f83853f5f63e9e91051575d7367de6f169cb1d2
MATLAB
4,988
144
%% OBJECTIVE: Merge SH with Mayank data so we can use Mayank paths %% tM = load('tblMayank_20180412T190459.mat'); tM = tM.tblMayank; t = load('tblSH_idDupsRemoved_20180415T095958.mat'); t = t.tIDdupsRmed; tM.movFile = FSPath.standardPath(strtrim(tM.movFile)); tM.movID = FSPath.standardPath(strtrim(tM.movID)); tM.movI...
33a3f785f455a553b5c34621cf139e8b2c5ce068f5e1b758f880a5129b6c8e23
MATLAB
4,994
166
function h_setDendriteTracingVis3(handles) [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); state = currentStruct.state; tracingMarkObj = findobj(handles.imageAxes,'Tag','h_tracingMark3'); tracingMarkTextObj = findobj(handles.imageAxes,'Tag','h_tracingMarkText3'); skelet...
b11cd444fa07b7af0e0e53d460b5d67f5b3d271737b9aed0037baafcb71a1936
MATLAB
4,994
102
% % % B01_raster_psth_timeDiscrim_SAligned_BSep_NWB( nwbData, timestampsOfCell, channelid, cellNr, brainAreaOfCell, bin_width_raster, bin_width_fr, plot_flag) % %History %12/7/21: This file is forked from original B01_raster_psth_timeDiscrim_BAligned_BSep.m by JZ. % function [] = B01_raster_psth_timeDiscrim_SAligned_...
bbaef27bfcbe819ac8226891645bf169dbb97dadb59e7454cf441bd7a00dfd92
MATLAB
4,994
117
exptype = 'RF'; cprdir = '/groups/branson/bransonlab/apt/experiments/res/cprgt20190407'; isshexp = false; switch exptype, case 'SH' gtfile_trainsize_cpr = {fullfile(cprdir,'outputFINAL/stephen_view0_trainsize_withcpr.mat'),fullfile(cprdir,'outputFINAL/stephen_view1_trainsize_withcpr.mat')}; gtfile_trainsize =...
20245a472d6d00473016e44b0732cbe537d59e504e96b5be2a4515ba3dc35319
MATLAB
4,998
175
function varargout=rotationMatrix(varargin) % Performs different operations dealing with a rotation matrix % % USAGE % R = rotationMatrix( M ) % [u,theta] = rotationMatrix( R ) % R = rotationMatrix( theta ) % R = rotationMatrix( u ) % R = rotationMatrix( u, theta ) % R = rotationMatrix( th1, th2, th3 ) % R = rot...
b4f08586ced3735d5aa2d1dfcd6c28ba367a6a6a85df01a7095e00108fc416f7
MATLAB
4,998
223
function [xc,good,bad,type] = cornerfinder(xt,I,wintx,winty,wx2,wy2); %[xc] = cornerfinder(xt,I); % %Finds the sub-pixel corners on the image I with initial guess xt %xt and xc are 2xN matrices. The first component is the x coordinate %(horizontal) and the second component is the y coordinate (vertical) % %Based on H...
75ac0931a6ff13b9cb986e78504e220c0a658fbc86d1b0b0273d024e60564acb
MATLAB
4,999
129
function update_epochs(varargin) % update_epochs will add epochs to basename.session file using % digitalin.events.mat file. % input: % basepath: path to session folder % acquisition_event_flag: True if digitalin.events contain start and end % epcohs for whole session (i.e. start, start, end, end for start % s...
5fd9cf50ed52dbe623fcab2589ca162dc41943454fd5cd735a3d40e44cac2db3
MATLAB
5,003
187
%% plot_sta_v_x() % % Used to evaluate the state-dependent STA; % Effectively, plot a A(t) signal by x(s); % INPUT: % at0 = Pre-spike Signal Amplitude [N_X0PTS x N_OBS Array] % at1 = Post-spike Signal Amplitude [N_X1PTS x N_OBS Array] % xs = State-at-spike [1 x N_OBS] Vector % - If xs is no...
0b8bf03b3358c1e0115822ac9bb11cbe9b99a427e5873ffabaaa3b70f633d316
MATLAB
5,005
132
function lickRateTimeCourse = estimateLickRate(clickArray, afterLastClick, lickTimes, params, method) % This function estimate the lick rate time course for each click from the % lick events following that click. There are four ways to estimate this % rate time course: (1) ordinary binning with a fixed bin size, (2) bi...
40d905ee2e992f15d7bb2853256e90e50e1a72ac39151c5fa9f021cf08224608
MATLAB
5,005
184
function [pX,gX,pY,gY,X,Y,U] = VBA_MCMC_predictiveDensity_fb(f_fname,g_fname,u,n_t,options,dim,fb,N,np,lx,ly) % prior predictive density under sDCM generative model (MCMC) % function [pX,gX,pY,gY,X,Y] = % VBA_MCMC_predictiveDensity(f_fname,g_fname,u,n_t,options,dim,N,np) % IN: % - f_fname: name/handle of the evoluti...
69c32f7910e3d0b429ecc8860e7f73675b92864586c24dced95f965915be6d6b
MATLAB
5,005
193
%mmf writer function [keyframes,nframes]=mmfwritertrans(inputfile,outputfile,obj,firstframe,lastframe) %obj=VideoReader(inputfile); foutput=fopen(outputfile,'wb'); %load text ftexto=fopen('/groups/visitors/home/albam/Desktop/mmfreader/text.text'); texto=[]; for i=1:15 linea=fgets(ftexto); texto=[texto linea]; end %w...
798a0a656723058710db22ab99841cba9269419e7f9699a59680150c39d46d9f
MATLAB
5,005
117
function drawFixation(d, colIndex) % % drawFixation(display, [colIndex=1]) % % Draws the fixation point specified in the display struct. % % HISTORY: % 2005.02.23 RFD: wrote it. % 2005.06.29 SOD: added colIndex for fixation dot task % added largeCrosses options % 2008.05.11 JW: added 'dot and 'none' op...
31ed2fc908bc28a4da4538d117e7c5aeccb90d5dd6956133fc04f97539943e8e
MATLAB
5,006
144
function FitOutput=Zach2DGaussianFit(S,InitialParams,InterpMethod,FitOrientation,FigDisplay) FitOutput=[]; % 1. 2D Gaussian function ( A requires 5 coefs ). g = @(A,X) A(1)*exp( -((X(:,:,1)-A(2)).^2/(2*A(3)^2) + (X(:,:,2)-A(4)).^2/(2*A(5)^2)) ); % 2. 2D Rotated Gaussian function ( A requires 6...
439d952e2c2cba99b49264130b601eb14f91da74795aa444d680a34f37395df3
MATLAB
5,006
129
function [headmodel, sens, cfg] = prepare_headmodel(cfg, data) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % SUBFUNCTION that helps to prepare the electrodes/gradiometers and the % volume conduction model. This is used in sourceanalysis and dipolefitting. % % This function will get t...
61026fb5c47a1154a5323d4631b28dbb6046b484c2df51e88a8611f2db58dfc9
MATLAB
5,006
112
function scored_replay = ground_truth_replay_scoring(data,analysis_type) %scores replay events using several measures- line fitting, weighted %correlation, "pac-man" path finding, and spearman correlation coefficient. %modify_decoding.m subroutine is run to zero probability if no spikes from %good place fields occur du...
6e4be622a2dc1674b3b979d425c1722381c66034c23230603b28b89518a19252
MATLAB
5,008
154
function gitInfo=getGitInfo() % Get information about the Git repository in the current directory, including: % - branch name of the current Git Repo % -Git SHA1 HASH of the most recent commit % -url of corresponding remote repository, if one exists % % The function first checks to see if a...
9395f44f4dbab61daef968f667535acb3e7a41d40fbb656769d64831496e8368
MATLAB
5,008
87
% GEN_MASS_MATRIX_FD_CPU Builds sparse matrix representation of time-invariant % diffusion transport equation within FEM mesh in 2D (triangles) or 3D % (tetrahedrons). Parallelized for multithreading with OpenMP. Uses all % available CPU power. % % SYNTAX: % [I_INDEX, J_INDEX, S_VALUE] = GEN_MASS_MATRIX_FD_CPU...
d9cc54edf1041c287f47bedd8a3ad284967b76d0f8797c192e49f63c39b314de
MATLAB
5,008
124
%{ Copyright (c) 2025 Axion BioSystems, Inc. Contact: support@axion-biosystems.com All Rights Reserved %} classdef StimulationEvent < EventTag %STIMULATIONEVENT Event data that corresponds to a tagged stimulation %that occurred in the file properties (GetAccess = public, Constant = true) ...
dc3b712261e80fae1dea2703a08114c557e3c42472f2937ea6af09066e81a41c
MATLAB
5,010
139
function write_brainvision_eeg(filename, hdr, dat, event) % WRITE_BRAINVISION_EEG exports continuous EEG data to a BrainVision *.eeg % and corresponding *.vhdr file. The samples in the exported file are % multiplexed and stored in ieee-le float32 format. % % Use as % write_brainvision_eeg(filename, hdr, dat, evt) % ...
37f7352e88d963f6ab7a25e614a005e3f19c941839a5edf1fb785a54ee2ed5b5
MATLAB
5,012
170
% Description: % This script processes and compares muscle activations from individual muscles and their equivalent muscles with EMG data. clear; clc; % Load necessary data files load('Activations.mat'); load('Activations_9Groups.mat'); load('MotionData.mat'); % Define muscle names from EMG data MuscleNames_EMGs = ...
6e13dff5f1f2a1beac8bd3b924e55d29a27786ca9902cdcc01cff058ec8a1671
MATLAB
5,013
134
function displayID = openScreen(displayID, hideCursorFlag) % openScreen - open screen for psychtoolbox % % Usage: displayID = openScreen(displayID, [hideCursorFlag=true]) % % openScreen takes a displayID structure (e.g., from running % loadDisplayParams), and does the following: % 1. opens a PTB window with a backgro...
9271f1242504e808c2f41a68a83d02e6a5a94d4973d45ff22e55ad1a8e124883
MATLAB
5,013
142
%% GCCA_tsdata_to_pwcgc % % Calculate pairwise-conditional time-domain MVGCs (multivariate Granger % causality) from time series data by "traditional" method (as e.g. in GCCA % toolbox) % % <matlab:open('GCCA_tsdata_to_pwcgc.m') code> % %% Syntax % % [F,A,SIG,E] = GCCA_tsdata_to_pwcgc(X,p,regmode) % %% Arguments % ...
c5fb0f06b86bff5eb159783b6c2be46c9994ed9429b9afcf005b147306202a51
MATLAB
5,013
176
function [IND, D, RD] = nearestpoint(x,y,m) % NEARESTPOINT - find the nearest value in another vector % % IND = NEARESTPOINT(X,Y) finds the value in Y which is the closest to % each value in X, so that abs(Xi-Yk) => abs(Xi-Yj) when k is not equal to j. % IND contains the indices of each of these points. %...
a64ba9702b3ceff5fab1595779614d7c67a3e6aec7e72d991a396ac1a09dabba
MATLAB
5,014
148
function [grid] = patchsvd(cfg, grid) % This function does something % cf. Limpiti et al IEEE trans biomed eng 2006;53(9);1740-54 % Copyright (c) 2006, Jan-Mathijs Schoffelen & Robert Oostenveld, F.C. Donders Centre % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and de...
0888188b01fa2cbcd9282a970f4f725fd14578362b3ca3f8c2cf614c12651c26
MATLAB
5,016
175
% Before detection, have a look at the pupil image and find the pupil/reference area manually. close all; clear all; clc; %load the movie date='0111'; enum='E19'; vd=['D:/22/U19_09022022/scale/video/',date,'2023dummmy=40_',enum,'.avi']; rotate=30; v = VideoReader(vd); f=[];frame=[]; for i=1:10*40 f = ...
5d94299872c4c7ec6dd5c9e3a66d58089c3f5c9fa2a0538162ed6ba6f8457860
MATLAB
5,017
134
%EPS2PDF Convert an eps file to pdf format using ghostscript % % Examples: % eps2pdf source dest % eps2pdf(source, dest, crop) % eps2pdf(source, dest, crop, append) % eps2pdf(source, dest, crop, append, gray) % eps2pdf(source, dest, crop, append, gray, quality) % % This function converts an eps file to pdf f...
f42bdfe376049c18cf93686d0896293506a86975dac0ac7ac7a422259cdba554
MATLAB
5,017
177
% Compute the When-decoder %% Adaptend from AZ 2022 global par_sess ndatasets = length(par_sess); plot_figs = 0; names = {'all','Tin','Tout','Min_C','Min_i','allButTin','allButTinOut'}; AUC = nan(ndatasets, length(names)); clear allWhenDs for sess = 1 : ndatasets disp(num2str(sess)) par = par_sess...
f85c729a8a7f2adf0e3b6e6b59faec42a2425973c9aacd058f712b01ef81c97c
MATLAB
5,019
98
% GET_FIELD_TR_CPU Solves time derivative of sparse system of linear % equations using trapezoidal Clark-Nicholson integration method in the % time dimension and BiCGStab solver with FSAI preconditioning to solve at % derivative steps. Parallelized for multithreading with OpenMP. Uses all % available CPU power....
8b26e510f3b6816c99b0573ae43f54d9ab60314c9502d363c2528fbed2c280ec
MATLAB
5,020
112
function [lambdas,as,scales,fs] = chnsScaling( pChns, Is, show ) % Compute lambdas for channel power law scaling. % % For a broad family of features, including gradient histograms and all % channel types tested, the feature responses computed at a single scale % can be used to approximate feature responses at nearby sc...
450758dbdd7c1d044da3ffbe5a0ea8790a99e89146f0062e87564ba8ba7c0430
MATLAB
5,023
133
%% HMMs and the occasionally Dishonest Casino % This is an example from 'Biological Sequence Analysis: % Probabilistic Models Proteins and Nucleic Acids' by Durbin, Eddy, Krogh, & % Mitchison, (1998) p54. %% Description % Suppose a casino uses a fair die most of the time but occasionally % switches to and from a loade...
9183766c9a09efce70c7586743e0b1b99d28f7441d718dcca02e31f9dddde05c
MATLAB
5,025
150
function spkDat = ReloadWaves2(spkDat, trodeFile, varargin) [wL, nChan, nSpk] = size(spkDat.waves); pk = double(spkDat.peakLoc); wP = double(spkDat.wavePad); wL = wL - 2*wP; upsample = spkDat.upsample; batchSize = 32768; verbose = true; whiten = false; alignWin = spkDat.alignWin; % convert wave parameters to ms wL = 1...
b945fecce4bc9650fbdf5ae2835a0dcbb7ecc156a743bae0c766a6affcb9758f
MATLAB
5,025
119
function CBIG_RF_compute_surf2vol_avgMapping(sub_list, input_dir, input_prefix, output_dir, output_prefix) % CBIG_RF_compute_surf2vol_avgMapping(sub_list, input_dir, input_prefix, output_dir, output_prefix) % % This function computes surface-to-volume avgerage mapping of x/y/z index % across a given list of subjects. ...
e001e977ebbc285f73bef045e0bfeb22d2dfbff3b490812ecd13847b483c8542
MATLAB
5,026
114
function [ANCOVA_F,Header] = y_ANCOVA1_Image(DependentDirs,OutputName,MaskFile,CovariateDirs,OtherCovariates,PALMSettings) % [ANCOVA_F,Header] = y_ANCOVA1_Image(DependentDirs,OutputName,MaskFile,CovariateDirs,OtherCovariates,PALMSettings) % Perform one-way ANOVA or ANCOVA analysis on Images % Input: % DependentDi...
12276d918331ae8a82e62be7a6359467fc4f747193e5fc16b605041864c0c08e
MATLAB
5,028
132
function [s, cfg] = ft_statfun_depsamplesregrT(cfg, dat, design) % FT_STATFUN_DEPSAMPLESREGRT calculates dependent samples regression T-statistic on % the biological data in dat (the dependent variable), using the information on the % independent variable (ivar) in design. % % Use this function by calling one of the h...
c673343e81ffa3d30afe7218e54b8e72431ce7f5d105141ba8b5f6ade4d6f2ab
MATLAB
5,030
182
function [bestModel, w, gamma] = ARDwipf(X, y, varargin) % [bestModel, w] = ARDwipf(X, y, varargin) % Automatic relevance determination, written by David Wipf % lambda - measurement precision (default: inferred from lars residuals) % maxIter - defautl 100 % method - default: mackay's method (see comments in code) % ver...
215a9d7ba37b3cd41b956238baed94d9ca8d3d315b047f5235f11e8f39623f33
MATLAB
5,031
174
function [FC_simR, CC_check] = CBIG_MFMem_rfMRI_nsolver_eul_sto_resLH(parameter,SC,y_FC,FC_mask,Nstate,Tepochlong,TBOLD,ifHighres) %----------------------------------------------------------------------------- % [FC_simR, CC_check] = CBIG_MFMem_rfMRI_nsolver_eul_sto_resLH(parameter,SC,y_FC,FC_mask,Nstate,Tepochlong,TB...
7006dbf45f5c0c25e6e0f054def3527cf70c915c9021e21b0cb3563dc9b72c69
MATLAB
5,035
139
function spkDat = LoadNexWaves(nexFile, trodeFile, varargin) wL = 1.6; % wavelength, in ms pk = 0.7; % peak location, in ms wP = 0.35; % wavePad, in ms alignWin = [-0.7 0.7]; % alignWin, in ms (not used much at this juncture) upsample = 2; % upsampling ratio batchSiz...
4ef8030a404455e3a41d2d5e643f77d61b550a43df89baf794294dd47ea685ef
MATLAB
5,037
174
%%% INPUT THE IMAGE FILE NAME: if ~exist('fc')|~exist('cc')|~exist('kc')|~exist('alpha_c') fprintf(1,'No intrinsic camera parameters available.\n'); return end KK = [fc(1) alpha_c*fc(1) cc(1);0 fc(2) cc(2) ; 0 0 1]; disp('Program that corrects distorted images'); disp('The intrinsic camera parameters are ass...
9dd79196e7c1374c1c34f47105f5e5df31a00d670bc49995863c0995329a2c52
MATLAB
5,038
172
function [tfr,rtfr,hat] = tfrrgab(x,t,N,Nh,trace,K); %TFRRGAB Reassigned Gabor spectrogram time-frequency distribution. % [TFR,RTFR,HAT] = TFRRGAB(X,T,N,NH,TRACE,K) % computes the Gabor spectrogram and its reassigned version. % This particular window (a Gaussian window) allows a 20 % faster % algorithm than the TFRRSP...
02c75e6e9cd28e85be922f36cc08cf3844f4339d9d9a8be0eda7329e1244f331
MATLAB
5,039
100
%% Description % This example illustrates simulation of refraction and reflection % according to Fresnel's equations. This requires the matchedInterfaces flag % to be set to false. The geometry consists of three layers: At the bottom % is a reflector such as metal (n = infinity), at the top is air (n = 1) % and in betw...
f19cca31d2e3fcb162f9274b80b4351980fac6f524d7c1d963e15ca2f402bebd
MATLAB
5,039
126
%% Compares the relative beta/gamma and theta/gamma powers in the early and late windows % also gives a spectrogram for a representative channel %% setup clear;clc dataPaths{1} = 'D:\InVivo\S1-Baclofen\2022-04-19_Baclofen\3-baseline'; dataPaths{2} = 'D:\InVivo\S1-Baclofen\2022-04-21_Baclofen-Attempt\1-baselin...
e5f72e7e6a4cc09b3d7a58a2f8c969a8c3c11e54d83c5892e72e34c47700386c
MATLAB
5,040
150
function [dipout] = residualvariance(dip, grad, headmodel, dat, varargin) % RESIDUALVARIANCE scan with a single dipole and computes the RV % at each grid location. % % Use as % [dipout] = residualvariance(dip, grad, headmodel, dat, ...) % Copyright (C) 2004-2006, Robert Oostenveld % % This file is part of FieldTrip...
50c87f4173bd1514d389329277dd889f9097d77f6cb402f1e8332be302dbc782
MATLAB
5,041
186
%% SELECTEDFRAMES = '/groups/branson/bransonlab/apt/experiments/data/SelectedGTFrames_SJH_20180603.mat'; sel = load(SELECTEDFRAMES); t = sel.frames2label; %% FLY2CALIB = '/groups/branson/bransonlab/apt/experiments/data/fly2DLT_lookupTableAL.csv'; fly2cal = readtable(FLY2CALIB); [tf,loc] = ismember(t.flyID,fly2cal.fly)...
f551557aaa24e2bf3be6f91b06f724d920f82926df163b764e6348753533c3f1
MATLAB
5,041
169
% DELCODE-SAME, Figure "FADE SAME corrs" % _ % original paper: Soch*, Richter* et al., HBM, 2022 % Figure 4: Correlations with independent variables, separated by age group % % DELCODE paper: Soch et al., medRxiv, 2023 % Figure 3: Partial correlations of FADE and SAME scores with other indices of cognitive aging % % ...
0bda9f0ac5cab5971ccf10c9798a9d907b686cc3d53273f73aa7746e72a98af5
MATLAB
5,042
70
clear;clc;close all ROOTPATH = strcat(NoveltySU.utils.getRootDirPath(mfilename("fullpath"), 4), "Data\Processed Data\"); cd(NoveltySU.utils.getRootDirPath(mfilename("fullpath"), 2)) protStr = "Active duration"; temp = NoveltySU.utils.dirItem(strcat(ROOTPATH, protStr), "spkData.mat"); popRes = cell2mat(cellfun(@(x)...
f6f4d97b7977bcd8651c8347c82538f0efaf87f660ef7d1389e4bdbf40f957bb
MATLAB
5,042
167
% CompareBetaPerToi %% get cnv load('TrioEEGBehAnalysis.mat','trialTab','varNames'); nVars=3; vNames = {'velocity','RT','distractor pull'}; load('trioEEGAnalyseByTrials_readyBS.mat','meanAmplTrialsPost','meanAmplTrials','eegByCond','xTimes') trialTab.CNV = nanzscore(col(meanAmplTrialsPost(:,:,:,:,30,:))); trialTab.P...
c4314105790a13543431093fad1b2bd85c82cd10a8889a0f2432e979b4e12c7d
MATLAB
5,043
137
function hs = ft_plot_headshape(headshape,varargin) % FT_PLOT_HEADSHAPE visualizes the shape of a head from a variety of % acquisition system. Usually the head shape is measured with a % Polhemus tracker and some proprietary software (e.g. from CTF, BTi % or Yokogawa). The headshape and fiducials can be used for coreg...
0762a01d0ffd507f0847d368e37bfd79544a2c679779c43b5994c7a5346a8811
MATLAB
5,046
160
clear; clc; do_save_fig= 0; code_dir= fileparts(pwd); addpath(code_dir) %% with actual trajectory fs= 20e3; stimdur= 1; stimlen= round(fs*stimdur); dam_f_start= 2^4; dam_f_end= 2^10.25; fc= 3e3; mod_depth= 1; tStim= (1:stimlen)/stimlen*stimdur; dam_traj_Hz= 2.^linspace(log2(dam_f_start), log2(dam_f_end), stimlen);...
10d84b8114dcdbf991497ceb7e8a38d99ac79aad820b60b564fc628770d93a4b
MATLAB
5,046
122
function [data, info] = get_field_FD_bicgstab_matlab(i_index, j_index, value, qvec, OPTIONS) % GET_FIELD_FD_BICGSTAB_MATLAB Solves sparse system of linear equations using % MATLAB implementation of BiCGStab solver and incomplete LU or Cholesky % factorisations for preconditioning. % % SYNTAX: % [PHI] = GET_FIELD...
635f78cf7f2ae3b7c73cb2a91cecef25d6e921f78282f28c708e584265993d13
MATLAB
5,046
150
function [dipout] = residualvariance(dip, grad, headmodel, dat, varargin) % RESIDUALVARIANCE scan with a single dipole and computes the RV % at each grid location. % % Use as % [dipout] = residualvariance(dip, grad, headmodel, dat, ...) % Copyright (C) 2004-2006, Robert Oostenveld % % This file is part of FieldTrip...
6eb69c1d077c318e6e3ebe550f3e0170aa93023b517ce5abb4e12dad3feae504
MATLAB
5,048
112
function [TTest1_T,Header] = y_TTest1_Image(DependentDirs,OutputName,MaskFile,CovariateDirs,OtherCovariates,Base,PALMSettings) % [TTest1_T,Header] = y_TTest1_Image(DependentDirs,OutputName,MaskFile,CovariateDirs,OtherCovariates,Base,PALMSettings) % Perform one sample t test. % Input: % DependentDirs - the image...
1efbfd2fedceaa3d8ebe55f2cc6ed39a88ebf4b8f12432bbcac942cd8adc3e1b
MATLAB
5,051
165
function s = saveJSONfile(data, jsonFileName) % saves the values in the structure 'data' to a file in JSON format. % % Example: % data.name = 'chair'; % data.color = 'pink'; % data.metrics.height = 0.3; % data.metrics.width = 1.3; % saveJSONfile(data, 'out.json'); % % Output 'out.json': % { % "name...
3a17a88f09d9b16680364a9725714e11e90205c58dadcc147e1fdafa02a13331
MATLAB
5,053
179
%% File location, image size, if MIP u.filename="C:\SAA\w4_stk1\annotations.h5"; u.x_pixels=512; u.y_pixels=512; u.z_range=5; % Choose whether to perform on MIP or normal image stack. u.MIP_flag=true; if u.MIP_flag u.z_range=1; end %% Configure image stack % resize(binning) or not % ISG=resize_image_stack(imgs...
9abd16711e79784434db20cd2c4d5f049df11289728637089edfc9d8f892cb67
MATLAB
5,053
190
function [phi_G, Cov_E_p, A_p] = phi_G_Gauss_LBFGS( Cov_X, Cov_E, A, Z, normalization ) % Calculate integrated information "phi_G" based on information geometry % with a combination of an interative method and a quasi-Newton (LBFGS) method. % % See Oizumi et al., 2016, PNAS for the details of phi_G % http://www.pnas...
ea6d2bbeb48a071cfe9a4fcc280a9b21624d1aa38a04525e85e986366980d4cd
MATLAB
5,054
177
% pop_fmrib_qrsdetect() - GUI for fmrib_qrsdetect: % Detect QRS events from ECG channel and add them to % EEGLAB data event structure. % % Usage: % >> [EEGOUT, COM] = pop_fmrib_qrsdetec(EEG) % for gui % or >> [EEGOUT, COM] = pop_fmrib_qrsdetec(EEG,ecgchan,'ename','yes') % for command line. 'no' or 'yes' can be...
024d3e733182711d74937f1312ef3786ebcabcee1603cf764dcc7c673fc720f9
MATLAB
5,057
130
function oimg = loadtiff(path) % Copyright (c) 2012, YoonOh Tak % All rights reserved. % % Redistribution and use in source and binary forms, with or without % modification, are permitted provided that the following conditions are % met: % % * Redistributions of source code must retain the above copyrig...
a33a60615003a9a98b6252533d704d89f35ba39b485520204cb5884b5761aeac
MATLAB
5,057
183
% cmps={[1 2],[1 3],[2 3],[ 1 2 3],1,2,3}; %% FigHandels=[]; MeasName='gdP'; % MeasName='gR2'; Labels={'Pinch' 'Press' 'Rub' 'Tap'}; condName='FcFsOc'; L={'FcFs','FcOc','FsOc','FcFsOc','Fc','Fs','Oc'}; % condName='FcFsOs'; % L={'FcFs','FcOs','FsOs','FcFsOs','Fc','Fs','Os'}; % condName='...
4440f319565c1b6a56beed7e995b6b632e9ba24fb9f543ae27348ac6a28b2ab1
MATLAB
5,058
137
function [dipout] = music(dip, grad, headmodel, dat, varargin) % MUSIC source localization using MUltiple SIgnal Classification % % This is a signal subspace method, which covers the techniques for % multiple source localization by using the eigen structure of the % measured data matrix. % % Use as % [dipout] = musi...
b807146d63a7d7677009112c3c45a9fe5568aac45f2ba3c78faf7794d22c6aad
MATLAB
5,059
178
function [varargout] = ie_fmm3dbie_ss_paper_final_ex(igeomtype,iref,npu,norder,ndir,zk) % IE_SPHERE An example usage of strong skeletonization, solving a % second-kind integral equation (Helmholtz combined field potential) on a % wiggly torus % % - OCC: The occupancy parameter, specifying the maximum numbe...
020b3c01278eeea201e9e9ca39093e5cd49b09bae2c7427b30ab83444dd67d09
MATLAB
5,060
152
function varargout = loadxml(filename,varargin) %LOADXML Load workspace variables from disk (XML file). % LOADXML FILENAME retrieves all variables from a file given a full % pathname or a MATLABPATH relative partial pathname (see PARTIALPATH). % If FILENAME has no extension LOAD looks for FILENAME and FILENAME.xml ...
7514a9b6cd1a972f7a551c307991c9756d2269a7eb2473fc9b4fb93df1c4dc27
MATLAB
5,060
109
function [v,v_unit,v_norm,v_norm_std,r0] = calc_mouse_estimate_vector(sites,simParam,nbootstrap_samples,rescale_to_target_distance,start_site,target_site,calc_significant_path_args) % calculates the estimate of food position given by the sites step probability lattice struct % the mouse estimate v is anchored at the re...
844319abf9d6371e2229394103c5bb553ff97ba49bba3e7cff284dfc2f02ec7d
MATLAB
5,062
139
function [cROIs, Cs, coherence, skew, sz] = DNMF_General3(V, options) % [cROIs, Cs, coherence, skew, sz] = DNMF_General3(V, options) %Extract options thr = options.thr; patchSize = options.patchSize; stride = options.stride; overlapThr = options.overlapThr; sizeRange = options.sizeRange...
e7c8a1ed9bf14c9601f124095908e921a8fd8d9dc2024df9617f20500473cd10
MATLAB
5,062
163
function [suffStat,posterior] = VBA_check_errors(y,u,options) % dummy diagnostic of model specification [suffStat] = VBA_getSuffStat(options,[],0); dim = options.dim; posterior = options.priors; posterior.muX = sparse(0,dim.n_t); % watch out about display setting options.DisplayWin = 0; if ~options.OnLine && options....
2ebe8ee21de2170ae70bcc3b6ec53f1bd1022d38a204f913f146387de8a2e12c
MATLAB
5,064
137
function [dipout] = music(dip, grad, headmodel, dat, varargin) % MUSIC source localization using MUltiple SIgnal Classification % % This is a signal subspace method, which covers the techniques for % multiple source localization by using the eigen structure of the % measured data matrix. % % Use as % [dipout] = musi...
138b2bb23e2d472f2e892de232fd76e12c13a6f5e0ed2f3d35f6550de0199943
MATLAB
5,065
122
function Step4d_CFC(config, pid, visitnum) % % Step4d_CFC is a cross-frequency coupling function that calculates the % mean vector length (a phase amplitude coupling measure) between regions. % % INPUTS: % > config: % struct, configured in your "main" script with all analysis parameters % and paths. S...
5e2bd14861e27f9e62e7a04a8207126616bf099940e66240a9e643659ba3e73d
MATLAB
5,066
171
function ie_fmm3dbie_sqrtscaling_plane(iref) % IE_SPHERE An example usage of strong skeletonization, solving a % second-kind integral equation (Helmholtz combined field potential) on a % wiggly torus % % - OCC: The occupancy parameter, specifying the maximum number of % points a node in the...
b631742b85340237d32c90a261221619d15c6a5e16d2c4af7deb8f66457839ba
MATLAB
5,067
166
datRoot = '/Volumes/LaCie/Farries recordings/'; rat = 'IM1056'; sesList = dir([datRoot rat '/20*']); sesList = arrayfun(@(x) x.name, sesList, 'UniformOutput', false) iSes = [3]; sesDir = [datRoot rat filesep sesList{iSes} filesep] ratDir = [datRoot rat]; cal = Calibrate(ratDir); sesList = dir([ratDir '/20*']); sesList...
be663ad30fe4eea3e546e7a0e25d7478ae4a55cc2de9b2cc393860d1dc7d3e26
MATLAB
5,067
181
function [mix, options, errlog, post] = gmmem(mix, x, options) %GMMEM EM algorithm for Gaussian mixture model. % % Description % [MIX, OPTIONS, ERRLOG] = GMMEM(MIX, X, OPTIONS) uses the Expectation % Maximization algorithm of Dempster et al. to estimate the parameters % of a Gaussian mixture model defined by a data str...
0891f3419dae1f84c41bc187a662d666580f603245d08de77d2ecdb13b4595cb
MATLAB
5,068
143
datRoot = '/Volumes/Seagate Backup Plus Drive/Recordings/'; rat = 'IM1261'; sesList = dir([datRoot rat '/20*']); sesList = arrayfun(@(x) x.name, sesList, 'UniformOutput', false); sorted = cellfun(@(s) exist([datRoot rat filesep s filesep 'unitDat.mat'], 'file') == 2, sesList); sesList = sesList(sorted); for i = 1:lengt...
b12a18e738471a8b85a3eee788996e4314a199c7ea2566272237e349a523cfea
MATLAB
5,070
141
% Five-point stencil on the unit square, constant-coefficient Poisson equation, % Dirichlet boundary conditions. % % This is the same as FD_SQUARE1 but using MFX. % % Inputs (defaults are used if not provided or set empty): % % - N: number of points + 1 in each dimension (default: N = 128) % - OCC: tree occupancy p...