sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
4dd07a22b2ca2e5133080b408bebc791731ad2ab305e9d9d8d56022fabfcb8d8
MATLAB
2,118
75
clear [task_info,supPath] = loadDBAndSpecifyDataPaths('Golda'); timeWindow = -200:200; probabilities = [25,75]; raster_params.time_before = 200; raster_params.time_after = 800; raster_params.smoothing_margins = 200; raster_params.align_to = 'cue'; corr_window = raster_params.time_before + (50:250); req_params.grad...
474d9b9728bf73201a14a8bd856c45675475558fb073096b879caffe32bbff29
MATLAB
2,121
48
%Reorders electrode contact labels. %05/27/2021: checked that this works for new Emory electrode nomenclature (i.e. "A'1" %for example). %2024/02/26 function [labels_array,labels_index]=reorder_elabels(labels_array) temp_labels=cellfun(@(x) strsplit(x,'-'),labels_array,'UniformOutput',false); %first do this i...
53f8aa61610bde1f5843bd98db9a864f2ea8be1a90cf790f244908f40b7b9e3a
MATLAB
2,121
58
function [fx] = f_BSL(x,theta,u,in) % evolution function for a Bayesian sequence-learner (BSL) % function [fx] = f_BSL(x,theta,u,in) % BSL is simply tracking the log-odds of P(y_t=1|y_{t-1}), where y is a % binary outcome. This variable is updated according to a Laplace-Kalman % filter, yielding 2 sufficient statistics...
f2a1cac94880884d004bccb89644336fff427c04c6cad470641d4134ec028893
MATLAB
2,121
69
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Program to damp Gibb's Oscillation in FFTs % mixing one side into the other, with a gaussian weight % % by Reto Fiolka, 7.11.2008 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function c=DampEdgeC(a,w)%Bild ein...
8a43811c7a0b1ed00390608f36fcfbc60008fb649a97e7897a8c3b50339f3e23
MATLAB
2,124
69
% Actigraphy Toolbox Demonstration % % $Author: Peng Li % $Date: Mar 09, 2026 % clc; close all; clear; y = load('./test/case_5_20140319100100_epoch15.txt'); y = y(:, 1); % construct the acti object % note that acti is a value class subclassed from timeseries % every instance just stores a copy % a...
056d7d29c8add14119b95b53c49dd1e219cb8a06eb9d43c7c49fde7aac909ef0
MATLAB
2,125
68
function vtc = bv_readvtc(fname) % vtc = bv_readvtc(fname) % % :description % % Reads in a version 1 or 2 BrainVoyager VTC file. % % :inputs % % fname file to read, e.g. 'mytimecourse.vtc' % % :outputs % % vtc vtc structure. List this function to see the field % names. % % :h...
b9655858ad2f6cbd0a78a3aced816ac607b8078c40ca911328c8130bda4ee8b5
MATLAB
2,126
54
%This script analyzes data from the spep task from begining to end. %2024/02/25 %% Set dataset directory and dependent repos: [root_dir,repo]=define_flicker_root_dir; for field_name=fieldnames(repo)' addpath(genpath(repo.(field_name{:}))); end %note: can use function fetch_flicker_subjectIDs to get list of sessio...
374f4f185111fcbe43678ed06e7fb0f6e5c3436bdb2c98148575eec41ca02ab9
MATLAB
2,130
90
clear [task_info,supPath] = loadDBAndSpecifyDataPaths('Vermis'); req_params.grade = 7; req_params.cell_type = {'PC ss', 'PC cs', 'CRB','SNR', 'BG msn'}; req_params.task = 'saccade_8_dir_75and25|pursuit_8_dir_75and25'; req_params.ID = 4000:6000; req_params.num_trials = 100; req_params.remove_question_marks = 1; lines...
ee53c84b56368d9e83e34d93e40d5c5b213a475637c8ca17b863612709891baa
MATLAB
2,131
77
% % [Sout,SNout] = Sout_vsh_ctf(r_sphere,R,EX,EY,EZ,Lout) % % Calculate the external SSS basis Sout for a CTF system % using vector spherical harmonics % function [Sout,SNout] = Sout_vsh_ctf(r_sphere,R,EX,EY,EZ,Lin) % Copyright (c) 2016, Elekta Oy % --------------------------------------- % % Redistribution and use o...
3a7150c6e2308a6a5ea6c6679d1c5547a6706ab8db9e8f31f9ce6b8dea7e9588
MATLAB
2,133
48
clear all close all addpath('/Volumes/LASA/TBI_OpenNeuro/TBI_openneuro/Hopf_model/TBI_ON_Lesions_Hopf_mask1halfSD_bin/outputs/Grange/'); addpath('/Volumes/LASA/TBI_OpenNeuro/Shared_code/TBI_ON_Lesions_Hopf_mask1halfSD_bin/'); outdir='/Volumes/LASA/TBI_OpenNeuro/TBI_openneuro/Hopf_model/TBI_ON_Lesions_Hopf_mask1halfSD...
f810a872ade21d491978177e33b3b54997785c79b616aac0e697c062113c1709
MATLAB
2,133
59
function [stitchedVolume,volCell]=stitchVolume(volCell,tformCell) sizeCell=cellfun(@(v) size(v),volCell,'unif',0); assert(all([(cellfun(@(s) all(sizeCell{1}==s),sizeCell))])); % Compute the new output limits for vIdx=1:length(volCell) [xLimitsOut(vIdx,:),yLimitsOut(vIdx,:),zLimitsOut(vIdx,:)] = outputLimits(tformCe...
fe5cda96c3a0e4109dfc397771f6e9e499715f8868cd5caf35abf949d0446cff
MATLAB
2,134
86
clear all %% load("neurons_by_hand_1.mat"); load("neurons_reconstructed_max_2.mat"); load('Dataset1.mat') cdim=1; swscd=size(wholestack,2); for i=1:numel(neurons_reconstructed_max_2) neurons_reconstructed_max_2(i).coords(:,cdim)=-1.*neurons_reconstructed_max_2(i).coords(:,cdim)+swscd; end factor=1; ...
09035a6b72aea1b402b4f4541f82d00a70d3343fac0c299cfc61b0bf7fb9df38
MATLAB
2,137
90
function [coh, coh0, w, varargout] = wcoh(y, x, dim, w) %[coh,coh0,w] = wcoh(y,x,dim,w); %Compute robust estimate of coherence based on a iterative weighted procedure, %according to Chave et al. 1987 if nargin<3 || isempty(dim), dim = find(size(x)>1, 1, 'first'); end if nargin<4, w = ones(size(y)); %weights ...
f4c423bf8f68a454a2884d404c7e3aec0d4e6a523e78e66bcd7736a28b7a1947
MATLAB
2,137
70
function [subj] = load_bv_mask(subj,new_maskname,filename,varargin) % Loads an AFNI dataset into the subj structure as a mask % % [SUBJ] = LOAD_BV_MASK-AA(SUBJ,NEW_MASKNAME,FILENAME,...) % Author: Alex Ahmed (alex.ahmed AT yale DOT edu) % License: %===================================================================...
3d8a7cb61e3cbc3c5557da2ad0123ba3adb23723a0dab9acb1e0cd6ddb66fdbb
MATLAB
2,138
46
function [anterdir,posterdir,dorsaldir,ventraldir,leftdir,rightdir]=apdvlr_axes_2(coords,guess,scale_factor,str, normal_vector,chosen_point) midpoint=mean(coords,1,'omitnan')'; [coefs,~]=pca(coords); dorsaldir_counter=0; for i=guess(:)' dorsaldir_counter=dorsaldir_counter+dot(midpoint,normal_vector)-dot(normal...
70a3430e85a3abb0c10d381bea5f26e8079fc0592f1e0539eaab47803a2c5aed
MATLAB
2,138
51
% @title Generate synaptic connection inside organoid based on distance between neurons % @file syncon_single.m % @author Romain Beaubois % @date 06 Aug 2021 % @copyright % SPDX-FileCopyrightText: © 2020 Romain Beaubois <refbeaubois@yahoo.com> % SPDX-License-Identifier: GPL-3.0-or-later % % @detai...
dd84f100422a8474e27bf2a55164c54b412c287b1a0c45735ccf97c639a67ad6
MATLAB
2,138
69
function [subj masknames] = combine_masks(subj, func, newmask, varargin) % Combines two masks together using a given function. % % Usage: % % [SUBJ] = COMBINE_MASKS(SUBJ, FUNC, NEWMASK, MASK1, MASK2, ...) % [SUBJ MASKNAMES] = COMBINE_MASKS(SUBJ, FUNC, NEWMASK, REGEXP) % % Combines either a list of masks or all masks...
fc22155b66fe9fc4f4ff19faa5a45e7167c0f3588f49f6c1827fbc321f808584
MATLAB
2,138
63
clear all % Author: Alex Ahmed (alex.ahmed AT yale DOT edu) % License: %===================================================================== % % This is part of the Princeton MVPA toolbox, released under % the GPL. See http://www.csbmb.princeton.edu/mvpa for more % information. % % The Princeton MVPA too...
1eb99f48c1536641c9fb52d2609019a2cfed19425f275cca58d0ffdc9c38b8bc
MATLAB
2,142
65
function [linecolors, linestyles, linewidths] = SetDataPlotLineStyles(handles, iCh) global maingui datatype = GetDatatype(handles); ml = GetMeasurementList(handles); linecolorsAvailable = maingui.axesData.SDPairColors; linestylesAvailable = {'-',':','-.','--'}; linewidthsAvailable = [1.5, 2.0, 1.5, 1....
740400da61b77b1305a5dab8865129dc1849861e81228e26603b8563a01103a6
MATLAB
2,142
58
function display_motion_field_bw(ima,motionField,figNo,title,removeMean) % DISPLAY_MOTION_FIELD_BW Displays a motion field in BW % % display_motion_field_bw(ima,motionField,figNo,title,gamma,removeMean) % % INPUT ARGUMENTS % motionField - Motionfield to display % figNo - Figure number to displ...
18776ba5792e28ca2851680ab3a38d7cb6bcc5b3e1f7208da71e20f57590afc0
MATLAB
2,143
71
function [clustmask] = make_clust(mask,clust_size,args) % Removes singletons from a mask % % [clustmask] = make_clust(mask,clust_size,args) % License: %===================================================================== % % This is part of the Princeton MVPA toolbox, released under % the GPL. See http://www.csbmb.p...
fa3f34897519f93d36b3dd1ba7c7ad3e752b0f1816ab56b04530cf39fd9f04da
MATLAB
2,143
78
function imageStack=Kalman_Stack_Filter(imageStack,gain,percentvar) % function imageStack=Kalman_Stack_Filter(imageStack,percentvar,gain) % % Purpose % Implements a predictive Kalman-like filter in the time domain of the image % stack. Algorithm taken from Java code by C.P. Mauer. % http://rsb.info.nih.gov/ij/plu...
ad0507b5b288c70e5f12d362c467d15f6d600eaea8c0194cbfce4f3873721a9b
MATLAB
2,144
61
function dims = spm_extract_voxel_dims(subj, objtype, objname) % This function accesses the header.vol area of a pattern generated from % the load_analyze_pattern function and returns the voxel dimensions of % that object for use in other pieces of software or just for basic % reference. % % [dims] = SPM_EXTRAC...
c06bf692bf77c83db7986e75c3d2595dea377adaf3628f3913be270e19069b4e
MATLAB
2,145
71
function [acts scratchpad] = test_corr(testpats,testtargs,scratchpad) % Correlation-based classifier testing % % [ACTS SCRATCHPAD] = TEST_CORR(TESTPATS,TESTTARGS,SCRATCHPAD) % % This is the main function for the correlation-based classifier, akin % in spirit to the one used in Haxby (2001). It compares each test % bra...
a258c830f220391327ef57da7c6ce35d4a688f872ec3ba4e5d307439db8bb30f
MATLAB
2,152
51
%% Stats for max-3SAT with 6-9 nodes clear all; close all; clc; blue_70=[0,67,206];blue_60=[15,98,254];blue_50=[69,137,255];blue_40=[120,169,255];dark_green=[0,93,93];ibm_pink=[208,38,112];purple_40=[190,149,255];purple_60=[138,63,252];purple_70=[105,41,196];yellow_gold=[255,192,0];orange=[221,99,47];green=[0,128,0];...
bec4a26246d3927e9ac217eb16152b6205a741da8bdaecab22ece8d73350ba96
MATLAB
2,152
87
function [errs warns] = unit_create_xvalid_oddeven(subj) % Unit test for CREATE_XVALID_ODDEVEN.M. % % [ERRS WARNS] = UNIT_CREATE_XVALID_ODDEVEN(SUBJ) errs = {}; warns = {}; [errs warns] = basic_case(errs,warns); [errs warns] = uneven_nruns(errs,warns); % alert the user if there are any problems [errs warns] = aler...
e58da225f298502051105e70cbf3eed054756e918403347a9d6ca5d7629a09cd
MATLAB
2,155
82
function [dff, raw] = calc_dff_NH(Mr, Mask,n); % n number of ROIs, %Mask cells for ROI defined with x and y based on ginput function %Getting mean of lowest 100 pixel intensities/frame for bckgrdsub % background = []; % [x,y,z] = size(Mr); % for j = 1:z % frame = Mr(:,:,j); % sortedpixels = sort(frame(:))...
55391d9432d6eac611ac936a9e02b422d9e22083f5cb6165f038dcebe50a4e14
MATLAB
2,157
74
function [pval] = compute_pval_1tailed(actual, nulls) % Figures out where the actual-goodness value lies relative % to all the null distribution of shuffled-goodness % values, giving us a p value. % % N.B. This is a one-tailed test (more power). % % NULLS = vector of values that make up our null % distribution (genera...
5346b9acc2bd9ef7e9ae2fdc819f1d60f102f8093a211a34bc020fcdac9be76d
MATLAB
2,158
62
function univ_chosen_action_val_2nd() cfg = load('neurovar_cfg.mat').cfg; n_sub = 44; clear matlabbatch %% Contrast Chosen Action Value con_dir = fullfile(cfg.global.deriv_dir, 'pipeline_chosen_action_val_2nd', 'con_chosen_action_val'); mkdir(con_dir); index = 1; ...
2a6bd271ce45d7f5cf3f730454ed282fc9f11024eb517791f10d04ee33913831
MATLAB
2,159
69
% This script puts trial number to all the event markers. It does not % delete any event from data. It also does not mark an event as good or % bad. It just gives an additional level to the event marker, which % can be used to exclude unwanted trials from analysis. % Find the index of last event marker lasteve...
b6bb6cda2f277ca1d20bb4ef43c91079cbea82f4ab5dffbf0826885c9806e359
MATLAB
2,159
94
function my_export_fig(varargin) % my_export_fig % my_export_fig((f_handle), (savename), (type), (pad)) % % Make matlab print to the correct size of the figure on the screen % % pad can be positive or negative to either increase or decrease the % whitespace around the figure % % type is usually unnecessary if extension...
2f0ce347f5c730e56b7878400ca54830423e2a97778ff8d75cb6ee7b4aaab847
MATLAB
2,161
64
function plotStep(K_1, K_2, K_0, I, learn_color) %% plotStep(K_1, K_2, K_0, I, learn_color) % % Plots step response before and after learning T_smooth = 0.02; % (s) % 0.01 T_step = 0.25; % (s) Time to go out for step amp = 10; % (deg/s) Scale for step dt = K_1.dt; tt_step = (-.05:dt:T_step)'; % Gen...
10401edb8146c471adc84f8199418b2db295fdbb17d3025aec9d5103b020dd3b
MATLAB
2,162
72
function histmat = hist2(x, y, xedges, yedges) % function histmat = hist2(x, y, xedges, yedges) % % Extract 2D histogram data containing the number of events % of [x , y] pairs that fall in each bin of the grid defined by % xedges and yedges. The edges are vectors with monotonically % non-decreasing values. % %EX...
4cee31079695d082d96ccb5cca1fbf539ff57d2e2488a547e8e54b119c084205
MATLAB
2,162
66
function [transformationMatrix, rotationMatrix, shearMatrix, scaleMatrix] = ... create_transformation_matrix2d(varargin) % CREATE_TRANSFORMATION_MATRIX2D Create a 2D transformation matrix % % [transformationMatrix rotationMatrix shearMatrix scaleMatrix] = ... % create_transformation_matrix2d() % % INPUT ARGUMENT...
9d66641f6fad9420498503de70b0b334b7e21c0275ff0987b03a1225faa17550
MATLAB
2,163
44
function output=calculateSCE(singleTrace,minPhot,maxPhot,photsmW) xM=singleTrace.x(1:end-1);yM=singleTrace.y(1:end-1); %FPGA derived position estimate (x,y) dt=singleTrace.dt;t=[0;cumsum(dt(1:end-2))]; %time in measurement nx=singleTrace.nx(2:end,:);NX=sum(nx,2); %photons by exposure for x localizations and total numb...
6923634b8fdaf477b92930d01fd1cd913572a9db0703bc6b487d8b607c2dbf02
MATLAB
2,164
87
function [p2_closest, ip2_closest, dmin] = nearest_point(p2, p1, ith_closest) % % Usage: % % [p2_closest ip2_closest] = nearest_point(p2,p1) % % Description: % % Find the points in p2 that are nearest to the points in p1. % % AUTHOR: Jay Dubb (jdubb@nmr.mgh.harvard.edu) % DATE: 11/13/2008 % % Updates: % % 01/21...
d6587066444aff751928a1b42e00c4f7105789c08efa10eab738f3778e643d7e
MATLAB
2,165
85
function [ ts_MC_ARFIMA ] = func_mcARFIMA( input_struct ) %UNTITLED33 Summary of this function goes here % Detailed explanation goes here N = input_struct.N; alpha = input_struct.alpha; beta = input_struct.beta; gamma = input_struct.gamma; delta = input_struct.delta; d1 = input_struct.d1; d2 = input_struct...
2580b6191394983ad6f3191879b18275015f2a7908a1174efae54b59aea6b29e
MATLAB
2,170
50
function overlapvolumecombinedwsubtbi02 = importfile(filename, startRow, endRow) %IMPORTFILE Import numeric data from a text file as a matrix. % OVERLAPVOLUMECOMBINEDWSUBTBI02 = IMPORTFILE(FILENAME) % Reads data from text file FILENAME for the default selection. % % OVERLAPVOLUMECOMBINEDWSUBTBI02 = IMPORTFILE(FIL...
5690e005cd6f02dac0ee869169a31ec1196c8114390e3c6821847e1af0bf4f24
MATLAB
2,170
50
function overlapvolumecombinedwsubtbi07 = importfile(filename, startRow, endRow) %IMPORTFILE Import numeric data from a text file as a matrix. % OVERLAPVOLUMECOMBINEDWSUBTBI07 = IMPORTFILE(FILENAME) % Reads data from text file FILENAME for the default selection. % % OVERLAPVOLUMECOMBINEDWSUBTBI07 = IMPORTFILE(FIL...
677eea64ef98f6fcfb84497ae2889a36aa46f9d6d336a203429fc44210db5a9c
MATLAB
2,170
50
function overlapvolumecombinedwsubtbi06 = importfile(filename, startRow, endRow) %IMPORTFILE Import numeric data from a text file as a matrix. % OVERLAPVOLUMECOMBINEDWSUBTBI06 = IMPORTFILE(FILENAME) % Reads data from text file FILENAME for the default selection. % % OVERLAPVOLUMECOMBINEDWSUBTBI06 = IMPORTFILE(FIL...
b1b042aefd206f23688885bb3b5be35a9dec215a1440fddbcf73348c96f2d12e
MATLAB
2,170
50
function overlapvolumecombinedwsubtbi10 = importfile(filename, startRow, endRow) %IMPORTFILE Import numeric data from a text file as a matrix. % OVERLAPVOLUMECOMBINEDWSUBTBI10 = IMPORTFILE(FILENAME) % Reads data from text file FILENAME for the default selection. % % OVERLAPVOLUMECOMBINEDWSUBTBI10 = IMPORTFILE(FIL...
b1c43060b40b5b37cbdaee484218c9eb8fb34cb9f00789755d33eaf0bb4b71fa
MATLAB
2,170
50
function overlapvolumecombinedwsubtbi11 = importfile(filename, startRow, endRow) %IMPORTFILE Import numeric data from a text file as a matrix. % OVERLAPVOLUMECOMBINEDWSUBTBI11 = IMPORTFILE(FILENAME) % Reads data from text file FILENAME for the default selection. % % OVERLAPVOLUMECOMBINEDWSUBTBI11 = IMPORTFILE(FIL...
b9b5f8703735c1e9c06df11de8276aad12bbb2d242a040a81881c9e9e78d3242
MATLAB
2,170
49
function dimensions = yOCTLoadInterfFromFile_ThorlabsHeaderLambda(inputDataFolder,OCTSystem,chirp) %This script figures out what is lambda of the data folder % Optional inputs, if they are unknown, we will figure them out % chirp - if we have it (otherwise set to []) %% Figure out basic Parameters %To get la...
bbd5a8ff459e809f50ff0c87eeb42b6cfb6262c14459acb0e8d2402f7acfab06
MATLAB
2,170
50
function overlapvolumecombinedwsubtbi14 = importfile(filename, startRow, endRow) %IMPORTFILE Import numeric data from a text file as a matrix. % OVERLAPVOLUMECOMBINEDWSUBTBI14 = IMPORTFILE(FILENAME) % Reads data from text file FILENAME for the default selection. % % OVERLAPVOLUMECOMBINEDWSUBTBI14 = IMPORTFILE(FIL...
c83343b47ae8824ecf29505efea9ed56191d9c807ffeb1f0ad38c2ae50b2e1eb
MATLAB
2,170
50
function overlapvolumecombinedwsubtbi04 = importfile(filename, startRow, endRow) %IMPORTFILE Import numeric data from a text file as a matrix. % OVERLAPVOLUMECOMBINEDWSUBTBI04 = IMPORTFILE(FILENAME) % Reads data from text file FILENAME for the default selection. % % OVERLAPVOLUMECOMBINEDWSUBTBI04 = IMPORTFILE(FIL...
d6e1e1d90d777e9c2955f63eededa2266119bbdbc6e85cc385f2528a70ca9379
MATLAB
2,170
50
function overlapvolumecombinedwsubtbi03 = importfile(filename, startRow, endRow) %IMPORTFILE Import numeric data from a text file as a matrix. % OVERLAPVOLUMECOMBINEDWSUBTBI03 = IMPORTFILE(FILENAME) % Reads data from text file FILENAME for the default selection. % % OVERLAPVOLUMECOMBINEDWSUBTBI03 = IMPORTFILE(FIL...
e93362031c77e506f986237bf60c93b78fb2c90c552edb5ec6e6dbbecdb99f56
MATLAB
2,170
50
function overlapvolumecombinedwsubtbi08 = importfile(filename, startRow, endRow) %IMPORTFILE Import numeric data from a text file as a matrix. % OVERLAPVOLUMECOMBINEDWSUBTBI08 = IMPORTFILE(FILENAME) % Reads data from text file FILENAME for the default selection. % % OVERLAPVOLUMECOMBINEDWSUBTBI08 = IMPORTFILE(FIL...
e9e4e8c26ba85036c3852d69a318a0a68c04fb9c492e31b5016365888e49a629
MATLAB
2,170
50
function overlapvolumecombinedwsubtbi05 = importfile(filename, startRow, endRow) %IMPORTFILE Import numeric data from a text file as a matrix. % OVERLAPVOLUMECOMBINEDWSUBTBI05 = IMPORTFILE(FILENAME) % Reads data from text file FILENAME for the default selection. % % OVERLAPVOLUMECOMBINEDWSUBTBI05 = IMPORTFILE(FIL...
a898940129977767c0c469143983ad5de69824ceab16c4e702887ebe51b731db
MATLAB
2,172
74
%Loads in the data and runs scripts to make figures clear all; close all; % set paths current_path = pwd; if ismac addpath(strcat(current_path, '/data')); addpath(strcat(current_path, '/subtightplot')); else addpath(strcat(current_path, '\data')); addpath(strcat(current_path, '\subtightplot...
90ac665414a400c1eaa69d5e19ab750265b55611e266a2a4f58767b1c9dbb84d
MATLAB
2,173
60
function PatternChange_Regression_Behav_2nd() cfg = load('neurovar_cfg.mat').cfg; n_sub = 44; %% Beta Contrast clear matlabbatch con_dir = fullfile(cfg.global.deriv_dir, 'PatternChange_Regression_Behav', 'rpe_PatternChange_ActionChange_2nd'); mkdir(con_dir); index = 1; ...
cbcde91e907d0af85a7c59c8f4b399ac9152176fc4444edebef75ae16b001fa7
MATLAB
2,174
61
% unit test of mv_stat_wilcoxon_ranksum rng(42) tol = 10e-10; % example X with duplicates for debugging: % X = [10 -4 ; 1 10; 40 4; 10, -20; 0 -2; -30 20; 40 2; -10 10] %% U-statistic using example from https://sphweb.bumc.bu.edu/otlt/mph-modules/bs/bs704_nonparametric/BS704_Nonparametric4.html placebo = [7.1 5 6 4 ...
ccf3d9eaf4c35fc466b6fe1c634e35cdb3201f91ebc9cdd8f60711001e6b775e
MATLAB
2,174
67
function out = check_verbosity(msg,rule) % This function checks if a message at the same function level has been % displayed before. The output can be used to conditionally switch on or % off the display of these messages. % % Input: % msg: Message that is displayed in that function % rule: Rule us...
11625b1275a33f207296d8206c054ffc48afa24d0410e51f0783b7a937e14574
MATLAB
2,176
49
% Calculate and save single-trial HRF bc it's taking forever saveDir = 'C:\Users\mn0mn\Documents\ResearchProjects\spatailAttentionProject\RawDatafNIRS\Experiment03'; load([saveDir filesep 'intermediateOutputs.mat']); rejectedChn = find(mlActAuto{1}==0); % need to save old stim and compare with new stim var %rejectedTr...
9b8dc8727c6a555ab1319623346f19b8d1ae3ed4d1d5984cb3f019c8f2177622
MATLAB
2,178
51
function ADE = estimate_average_displacement_error(displacementField1,displacementField2,mask) % ESTIMATE_AVERAGE_DISPLACEMENT_ERROR Estimates the average displacement error % % ADE = estimate_average_displacement_error(displacementField1,displacementField2,mask) % % INPUT ARGUMENTS % displacementField1 - Displaceme...
fdd3f3f10a8cbb924341434260200198f1b71b02cf12486b15b88ce961027b04
MATLAB
2,178
78
function bids_setup(p) % function bids_setup(p) % % Creates a folder structure according to the BIDS organizational standard. % More information at: % http://reproducibility.stanford.edu/bids-tutorial-series-part-1a/#man2 % % Input: % - p: Structure with analysis parameters, including base directory of % the p...
5b2a7db558dc60e2d1e0d623ab7176b4f285545f600b73c2b1bc206aa64d2a64
MATLAB
2,179
47
% function for performing input quality control for UTIL_ITC and UTIL_RC function [type,Amt1,Var1,Amt2,Var2,data] = UMQC(type,choice,Amt1,Var1,Amt2,Var2,whatisvar) % 1. Convert everything to column vectors choice = choice(:); Amt1 = Amt1(:); Var1 = Var1(:); Amt2 = Amt2(:); Var2 = Var2(:); ...
62bc30cddfaf2f4d167f747ae34efd6583df9f0efa759d2154774e9a76593540
MATLAB
2,179
51
%% Stats for maxCut with 6-7-8-9 nodes clear all; close all; clc; blue_70=[0,67,206];blue_60=[15,98,254];blue_50=[69,137,255];blue_40=[120,169,255];dark_green=[0,93,93];ibm_pink=[208,38,112];purple_40=[190,149,255];purple_60=[138,63,252];purple_70=[105,41,196];yellow_gold=[255,192,0];orange=[221,99,47];green=[0,128,0...
be4a4f2fa3c8b98ba5d422ac4c3d2a709de9dc632927f42dc414c6c7185d441d
MATLAB
2,179
70
clear all close all format compact clc % script to calculate the statistics for each scan given this will currently only run if distances have been measured % for all included scans (UsedSets) MaxDist=20; %outlier thresshold of 20 mm time=clock;time(4:5), drawnow dataPaths = {'/home/dichang/code/related_work/u-mvsn...
9556db5b30d1244fd1d8614aa2746dab6586548a69dda6e14211d1837174c29b
MATLAB
2,180
82
clear [task_info,supPath] = loadDBAndSpecifyDataPaths('Vermis'); SD = 15; raster_params.time_before = 350; raster_params.time_after = 800; raster_params.SD = SD; raster_params.smoothing_margins = SD*5; corr_window = raster_params.time_before + (50:250); req_params.grade = 7; req_params.ID = 4000:6000; req_params.r...
9f8e6efa870562c4fb52daab7ea2d51b75927c41d55efbfc18596593762eed0f
MATLAB
2,181
67
function spots_filtered=bd3dq(single_volume,thresholds,sizes_local,zsizes_local,sigmas_local,voxel_size,max_spotnum) sizes=round(sizes_local./voxel_size(1)); zsizes=round(zsizes_local./voxel_size(3)); sigmas=round(sigmas_local./voxel_size(1)); filtersize=[sizes sizes zsizes]; % volume LOG filtering h=-fspecia...
308f038d3e0b67cb52fd1b12256fa9ebb7c0c8f1097a0f5c3d443bf554e21c05
MATLAB
2,183
62
function prior = mlpprior(nin, nhidden, nout, aw1, ab1, aw2, ab2) %MLPPRIOR Create Gaussian prior for mlp. % % Description % PRIOR = MLPPRIOR(NIN, NHIDDEN, NOUT, AW1, AB1, AW2, AB2) generates a % data structure PRIOR, with fields PRIOR.ALPHA and PRIOR.INDEX, which % specifies a Gaussian prior distribution for the netw...
e1676cd26e79e5f0e46904a70850c42ded65804f628a6faabc108ecda5fb6bae
MATLAB
2,183
55
function d0 = VORsensitivityGetData(filepath, freq) % For run_sensitivity.m % % DAT = VORsensitivityGetData('C:\Dropbox\rlab\model\data\data_100HzEyeFilter', 0.5) % Gives gain (relative to stimulus) and phase in radians. Negative phase = % phase lag if freq == 0.5; freqstr = '05'; else freqstr = num2str(freq); end...
405209f73114e710a567f034f8834b5f3bea854cb5b085c5c78e9a2ae29c464a
MATLAB
2,184
85
% @title Output neuron properties for a given type % @file ntype_to_params.m % @author Romain Beaubois % @date 06 Aug 2021 % @copyright % SPDX-FileCopyrightText: © 2021 Romain Beaubois <refbeaubois@yahoo.com> % SPDX-License-Identifier: GPL-3.0-or-later % % @details % > **08 Mar 2021** : file creat...
9f7419cff37606a7150aa802dd2f8a4455a166f3c649b71779e496be7c4823de
MATLAB
2,184
64
N = 500; replicates = 10; iter = 200; newtonIter = 200; sparsity = 0.01; SRtarget = linspace(1, 5, 10); residualTresh = 1e-6; stepConvergedIter = zeros(length(N), replicates); stepConvergedNewton = zeros(length(N), replicates); wasSolutionSame = zeros(length(N), replicates); defactoSR = zeros(length(N), replicates); %...
a198ef8b9ab2e765fb37b153f24d16c6f60f8c5954539b244b97d59e47f605de
MATLAB
2,185
70
function [subj new_maskname] = intersect_masks(subj,mask1name,mask2name,varargin) % Creates a new mask that's an intersection of two masks. % % [SUBJ NEW_MASKNAME] = INTERSECT_MASKS(SUBJ,MASK1NAME,MASK2NAME,...) % % Gets both masks, checks they're the same size, and then does an % AND on them to create a new mask that...
7812dfd371d7d8275e9e4609a3c88f4621fff78edcdb26baed97936cf696550d
MATLAB
2,186
71
%% Get summaries of burst and arrange data % % Vinding, M. C., Eriksson, A., Low, C. M. T., Waldthaler, J., Ferreira, D., Ingvar, M., Svenningsson, P., & Lundqvist, D. (2021). Different features of the cortical sensorimotor rhythms are uniquely linked to the severity of specific symptoms in Parkinson's disease. medRxi...
16712cfa0aa5495b8baee4f3115d18a5aa85aca50861e831a5a65cc34b555497
MATLAB
2,189
71
function Res = finalFigurePlots_rev1( Res, ResShuf, modelMaps, varargin ) % Classify BVCs and plot basic spatial props % % Load global parameter file prms = globalParams_final; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Plotting - which figures to plot % prms.plotClassFig ...
53a2234681ddce0237b37a5d8aa4905c4d13be0059d779ec2266c577bac390db
MATLAB
2,189
83
% ConvertBasler2Whl_All - Convert Basler data of all the sessions and % concatenate them % % USAGE % % ConvertBasler2Whl_All(filebasename,<options>) % % filebasename basename of the video file (should be filebasenmae.avi) % <options> optional list of property-value pairs (see table below) % % ======...
5427f68c43babd87bef823a49baa04d931fc9426e17c0da3a43a98e024d7e117
MATLAB
2,189
75
function test_suite = test_bids_examples %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> catch % no problem; early Matlab versions can use initTestSuite fine end initTestSuite; end function test_bids_examples_basic() % Test ...
7e09e06df45bfb74f192bbf4d55149baac62ae63c241c1742de08d2ec4db6257
MATLAB
2,189
66
function pSVR_plot_bfca_across_trial(p) % Get relevant variables from 'p' labels = p.psvr.all_labels; delay = p.psvr.delay; %%% Plot %%% % Define colors and positions for significance bars colors = {[0 170 0]./255; [255 85 85]./255; [179 128 255]./255; [255 212 42]./255}; sig_pos = [39 38 37 36]; f = figure; hold o...
0ec4fff6893654a11efbf97be3578fac344b07b1fd2519a975585c5959ef259c
MATLAB
2,191
53
clear all; L = [8 8]; M = [5 5]; A = 2; %%%%%%%%%%%%%%% TEST FOR ORTHONORMALITY OF Spherical Harmonic Functions %%%%%%%%%%%%%% % spharm_vec.m is vectorised wrapper for spharm.m %fun = @(theta,phi) spharm_vec(theta,phi,L(1),M(1)).*conj(spharm_vec(theta,phi,L(2),M(2))).*sin(theta); %Q = integral2(fun,0,pi,0,2*pi,'Me...
2afedf71d4e3a39bd9b4786e4c27d0f99411489c58a91349c66eaad4a6aa41cb
MATLAB
2,192
77
clear [task_info,supPath,MaestroPath] = ... loadDBAndSpecifyDataPaths('Vermis'); K_FOLD = 10; req_params.grade = 7; req_params.cell_type = {'PC ss','PC cs', 'CRB','SNR', 'BG msn'}; req_params.task = 'choice'; % req_params.ID = [4135, 4208, 4209, 4343, 4390, 4569,... % 4570,4602, 4604, 4605, 4623, 4625, 4658,...
f36cc8d2a990a2bcd9bf86fe69fe09787d27897e53df8ad1a6a3e94124f2eeca
MATLAB
2,195
118
function [c] = cov(x, varargin) % [C] = COV(X, NORMALIZEFLAG, DIM) computes the covariance, across all cells in x along % the dimension dim. W % [C] = COV(X, Y, NORMALIZEFLAG, DIM) computes the covariance between all cells in x and y % % X (and Y) should be linear cell-array(s) of matrices for which the size ...
ef0bf2c25a3e906a413bc10bf3d07b5884a982a7e0f2a0613a80eba742a93f9e
MATLAB
2,196
61
function [new_x_0,f_max,f_comp_max] = simGridNode(i,j,K,data,x_0) %SIMGRIDNODE i, j, K, data, x_0 % Simulates one step in a grid simulation. % i,j node indices % K coupling matrix % data data structure % x_0 initial conditions if isfield(data,'grid_par') data.grid_par_1 = data.g...
01610f85c6b9fdb75ee595b63d38f759da0ef93d4248a4f9bf241a073079a857
MATLAB
2,202
47
function f = antigradient2(g, mask, mu, n) % ANTIGRADIENT2 Reconstruction from gradients in 2D and 3D. % % This differs from antigradient in that it can handle arbitrarily % shaped domains. % % f = antigradient2(g) computes the function f which has a gradient % as close as possible to g. The vector field g must ...
0e74a4f07b829d6924525434f64b92d534fedf24761257516d30439c715649d5
MATLAB
2,203
81
function [ annulus ] = createAnnulus( n, r, w ) %createAnnulus Create a binary annular mask % % INPUT (all optional) % n - size of the annular mask as a scalar, or vector with coordinates % r - radius of the annulus in pixels % w - width of the annulus in pixels % % OUTPUT % annulus - n x n matrix with the annulus mark...
8434271d4aed61cdb48cd3338faf7b9ecacd8d2788ad5e193202ea74c3406935
MATLAB
2,203
65
function rgb = vals2colormap(vals, colormap, crange) % Take in a vector of N values and return and return a Nx3 matrix of RGB % values associated with a given colormap % % rgb = AFQ_vals2colormap(vals, [colormap = 'jet'], [crange]) % % Inputs: % vals = A vector of values to map to a colormap or a cell array of % ...
297cfedcffab0d854df15b8863999956f0572e177a0f51fa9f8e072adf2d5e5c
MATLAB
2,206
44
rng(42) tol = 10e-10; N = 1000; P = 100; X = simulate_gaussian_data(N, P, 1, [], [], 0); X2 = randn(N, P); X3 = simulate_spiral_data(N, 3, 1); LW = @LedoitWolfEstimate; % short notation %% result between 0 and 1 print_unittest_result('[Gaussian data primal] result between 0 and 1', true, 0 <= LW(X, 'primal') <= 1,...
59ac4a00115f0e671b404553bc7bd697d9122dc511a763974733d3914cb284ce
MATLAB
2,206
71
function mr_fmontage_nogl(anat,func,mask,slices) % use this if your system doesn't have opengl rendering % License: %===================================================================== % % This is part of the Princeton MVPA toolbox, released under % the GPL. See http://www.csbmb.princeton.edu/mvpa for more % informa...
d0e3069affaf16f25e1d9781b17e41d39ae2d140021e920388633cf156351a72
MATLAB
2,206
75
function this = gapDet(this) %GAPDET Automatically identify potential gaps % % $Author: Peng Li % $Date: Feb 25, 2026 % params = this.GapInfo.Parameter; rec = this.Data; if isempty(rec) this.Gap = []; return; end len = length(rec); epochSec = this.Epoch; this.Gap = []; % 1. Threshold cr...
80bfd644a4eecaeaf0d215e80ff6238d79974c81cae52332aa5ff00ea744c299
MATLAB
2,208
80
clear all close all format compact clc % script to calculate distances have been measured for all included scans (UsedSets) addpath('MeshSupSamp_web\x64\Release'); [dataPath,resultsPath]=getPaths(); method_string='Tola'; %'Camp' %'Furu'; light_string='l7'; %'l7'; l3 is the setting with all lights on, l7 is randomly...
29e91c4468a428f30ac22dd6ab6c1f592e7ad865cd577919ce20c4ffaf728a6f
MATLAB
2,209
53
%Figure 1 %Calculations needed for plotting SubjNum = 20; %calculate 95% CI SR_cont_square_ci = 1.96 .* std(SR_cont_square) ./ sqrt(SubjNum); SR_exp_square_ci = 1.96 .* std(SR_exp_square) ./ sqrt(SubjNum); SR_cont_phone_ci = 1.96 .* std(SR_cont_phone) ./ sqrt(SubjNum); SR_exp_phone_ci = 1.96 .* std(SR_ex...
4390ecc4502dcd3f6f26ebf13ead0e433b7d4e9646e6718fde22d6e7a2aee557
MATLAB
2,212
77
clear all; clc; % load data DATA = readtable('C:\Users\Neuroeconomics Lab\Data.csv'); % Main GLM (using the first 3 gradients) mdl05 = fitglme(DATA,'RS ~ ED_HCvsNC * BMI + Age + sex + (1|Study) '); % LOSO for RS predicted by HC-NC similarity shift lmfunction = 'RS ~ ED_HCvsNC + BMI + Age + sex + (1|Study...
8ec174a431996b1dbd053ad11a27b9cd3768d50faac2593e0ea3214794b84fa5
MATLAB
2,213
95
function [isbool isrest isoveractive] = check_1ofn_regressors(regressors) % Tells you about your regressors matrix % % [isbool isrest isoveractive] = check_1ofn_regressors(regressors) % % ISBOOL - true if all the regressors are 1s and 0s % % ISREST - true if some rest is included, i.e. some timepoints % don't have an ...
1382a13df83488afa85a93cb5fc231798f9e1653f35be915ee7002934806aea8
MATLAB
2,216
54
function awsSetCredentials (level) %This function sets user name and password for AWS and S3 storage %level specify how much access would the software need. %level = 0 - Read capability using fileDataStore %level = 1 - Write, start EC2 instances etc using AWS CLI if ~exist('type','var') level = 0; %Only set...
6a885ab7e6d1ced757e47aa51a2ff61953f9014350f1f29a8e5aad305dd6df9a
MATLAB
2,217
71
function [mat] = get_group_as_matrix(subj,objtype,name,varargin) % [MAT] = GET_GROUP_AS_MATRIX(SUBJ,OBJTYPE,NAME,...) % % Returns all the members of a group as a single matrix, % with each member of the group getting its own row in the % first dimension. In other words, the MAT it returns will % be of the following si...
2cd2c6c5959b3db33272cda86c2b0a0d93d8e13d968e54c3b7e469c4d534b578
MATLAB
2,218
69
function [subj] = ebc_tutorial_adv_load(subjnum, datapath) % Load an EBC tutorial subject structure from the data. % % [SUBJ] = EBC_TUTORIAL_ADV_LOAD(SUBJNUM, DATAPATH) % % Loads a tutorial_ebc<SUBJNUM> matrix and then inserts all the % appropriate data into a new 'subj' structure, which is then returned. % % SUBJNUM ...
f40542caf2ad0e4220e89ae7a99396103bec1a6a826766e26e86563d77c5fde4
MATLAB
2,218
70
% split into single and multi groups. % new. Use trials from dcNew var % For sbj 08 and 10 function plotPerformanceBarChartROINames_Special(sbjNum,varName,tInd,featureName,saveOp) figSaveDir = ['C:\Users\mn0mn\Documents\ResearchProjects\spatailAttentionProject\ProcessedDatafNIRS\Experiment' num2str(sbjNum) '\Figures\...
daedb6923ad99a73556c0375d77861e7087f04803ea584d30260bec236017510
MATLAB
2,219
84
function [L,weights] = CrossValidationPeerHDCheck_Cells(S,Q,ang,ep) nbEp = 10; epV = regIntervals(ep,nbEp); L = NaN(nbEp,length(S)); fprintf('Launching Cross-validated Peer info\n') dQ = Data(Q); nbC = length(S); weights = zeros(nbC,nbEp,nbC-1); angq = Restrict(ang,Q); for ii=1:nbEp fprintf('.') ix = ...
bcde56e00ecfd09874f7cebf6e78672e5ef4fe1e1646df99115ca15fce85faa9
MATLAB
2,221
80
clear; clc [task_info,supPath] = loadDBAndSpecifyDataPaths('Vermis'); DIRECTIONS = 0:45:315; PROBABILIES = [25,75]; BIN_SIZE = 100; raster_params.time_before = 199; raster_params.time_after = 800; raster_params.smoothing_margins = 200; raster_params.SD=15; raster_params.align_to = 'cue'; req_params.grade = 7; req_pa...
1741f29b5091309041c5df25f2433905ff3e296e19851319e075ae6d66a91be4
MATLAB
2,222
55
function [] = gen_dat(tw, dim, fs, delay, dE, dis_thresh, inputf, outputf, SAMPLES, rp) % GEN_DAT Generates datasets and recurrence plots for a list of samples. % % gen_dat(tw, dim, fs, delay, dE, dis_thresh, inputf, outputf, SAMPLES, rp) % processes a list of sample files, performs data segmentation, and generates...
e6366e460698fa75067e9836e0a3f48dd9c33bb9e248105316b56710a5a58799
MATLAB
2,222
77
clear all; addpath('/Volumes/LASA/TBI_OpenNeuro/TBI_openneuro/timeseries/inputs_sch1000/'); addpath('/Volumes/LASA/TBI_OpenNeuro/Shared_code/Hopf_TBI_ON/'); load schaefer_MK.mat; load tseries_openneuro_tbi_tp123_sch1000.mat; % Load your data % Parameters of the data TR=2; % Repetition Time (seconds) NPARCELLS=1000; N...
cbfcd62c9fbb77e10ac56e18ebc5eb79228647fce828d9e457f991d0103425e2
MATLAB
2,224
61
% script to run all. Can take 1-3 days. Parallel computing version is % available at ... % Final figures require photo editing. % Figure number refers to preprint version at % https://www.biorxiv.org/content/10.1101/2022.09.06.506821v2.full.pdf prompt = 'Warning. It'' take 1-3 days to run the whole thing. Are you sur...
dbdbb643ec817dce9e394e8453669f789b8692f864300f88887be398e826c008
MATLAB
2,224
74
function model = lvl2_contrasts(p) % function model = lvl2_contrasts(p) % % Defines and calculates constrasts for a SPM second-level analysis. % % Input: % - p: Structure with analysis parameters. % % Output: % - model: Structure with all SPM settings used for this analysis % step (would be 'matlabbatch' in ...
061ddbad9af7bb42192c52e9dc2a7b1e70bb04f29b765bd7399b9697c02dde43
MATLAB
2,225
63
function [masked_pat idx_of_child_items_contained_in_parent ib] = get_masked_pattern(subj,patname,maskname) % Returns the pattern's voxels allowed by the mask % % [MASKED_PAT IDX_OF_CHILD_ITEMS_CONTAINED_IN_PARENT IB] = GET_MASKED_PATTERN(SUBJ,PATNAME,MASKNAME) % % Calls GET_MAT to retrieve the PATNAME mat, and then a...
bad7cf2adc918ece57c16945ae9a4e19ef3bfd5024bd09b92f7d0c37b1a1605d
MATLAB
2,226
68
function [transformation] = displacement2transformation(displacement, imSize) % DISPLACEMENT2TRANSFORMATION Converts a displacement field to a transformation matrix % % [transformation] = displacement2transformation(displacement, imSize) % % INPUT ARGUMENTS % displacement - Resulting displacement field % imSiz...
0b3b2cf15265af46f1bdee2f2e6c790afe80f676d629f9f78dfb88848d0ad23c
MATLAB
2,232
58
function [velocityField] = baker_campbell_hausdorff_formula(... velocityField, updateVelocityField, approximationMode) % BAKER_CAMPBELL_HAUSDORFF_FORMULA Accumulates two velocity fields using the Baker-Campbell-Hausdorff-approximation % % [velocityField] = baker_campbell_hausdorff_formula(... % velocityField, upd...
1dbb4ff5973270668328a914ec1cba183f84f34e4a054468929ac3c2275a9ddf
MATLAB
2,232
66
initOAT; SR = SpikeReader('../results/spk_MEC_LII_Stellate.dat'); spikes = SR.readSpikes(1); X=[]; Y=[]; T=size(spikes,1); % time to plot fn = 75; % first neuron to plot N=50; % number of spikes to plot t_window = 5000;%1500; min_y = fn; max_y = fn+N; % animation hFigure = figure; hFigure.Position = [1 0 1920 204]; ti...
7fc41f3cef98b5ff15d02cc1827d443bba1bcc9f1abc62195debbe243984ea51
MATLAB
2,232
72
function o = create_main_effect_contrast(nconds) % Given N regressors, and assuming that each regressor % represents a level of a single factor, this scripts creates % a contrast matrix that will test for differences between % each regressor and any of the other N regressor. % % In essence, it will turn a standard one...
5ce8febfabe720c0469386f142941920f871831bdba756c581788689f3561d9c
MATLAB
2,238
54
function [spike_burst_dyn_table]=well_compute_spike_burst_dynamics_axons_220105(allregion_unit_matched) %despite the name, this function computes spike dynamics for the wells % This folder contains the contains the mea structs %load(strcat(parent_dir,'\','allregion_unit_matched')) % Parameters fs = 25e3; % Initial...