sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
7f88922d22399db41f6515fd048fdf886109c2f47f75575894fa10c32c0cd8fd
MATLAB
4,164
113
% MY_SPECTRUM Welch spectrum for multiple signals. % % call [ PXX, F ] = MY_SPECTRUM( X, NFFT, FS, WINDOW, NOVERLAP, DFLAG ) % % gets X matrix; trials in columns % NFFT {128}; length of segments to be averaged % ...
128cb9e3814d41d127b551295c5d3423f6699736905c7169be15139e38fc6ea2
MATLAB
4,165
149
function [subj] = apply_to_runs(subj, patname, selname, fname, varargin) % Applies a function to the runs of a given pattern. % % [SUBJ] = APPLY_TO_RUNS(SUBJ, PATNAME, SELNAME, FUNCTIONS, ...) % % Each function in the cell array FUNCTIONS is applied individually to % the runs specified by SELNAME of pattern PATNAME. ...
3d92a990e71d3b9d1c7cea264e230a5d00fafa796e99b814140958b233066396
MATLAB
4,167
126
%DEMGPARD Demonstrate ARD using a Gaussian Process. % % Description % The data consists of three input variables X1, X2 and X3, and one % target variable T. The target data is generated by computing % SIN(2*PI*X1) and adding Gaussian noise, x2 is a copy of x1 with a % higher level of added noise, and x3 is sampled r...
787355d59ae580fe7f5754942e704f4aec51882a0f30d5043d1b5fb5ba62a617
MATLAB
4,167
129
function [ptStart_Scan, ptEnd_Scan, ptStart_Extended, ptEnd_Extended] = ScanAndPattern_GeneratePatternToPhotobleach(config) %This auxilary function will generate line set to photobleach as part of %the scan and the extended lines ptStart = []; ptEnd = []; ini = yOCTReadProbeIniToStruct(config.octProbePath); ...
35a1e87ca1bf6a0d9158bedd8807c30acac0057e9df35153430ade30d4023f9e
MATLAB
4,170
142
function [data, headers, y_labels] = list_events(varargin) % % Returns summary of all events for a given task. % % USAGE:: % % [data, headers, y_labels] = bids.internal.list_events(BIDS, ... % modality, ... % ...
0dff8ad8c0c688f62168ceab06bfeba6e9e577a33234ebb08080d6d7b9851139
MATLAB
4,171
90
function pd = weibulltails(x,pl,pu,distrib) if ~exist('distrib','var') | isempty(distrib) distrib = 'weibull'; end [yvals xvals ylvals yuvals] = ecdf(x); yvals = 1-yvals; ylvals = 1-ylvals; yuvals = 1-yuvals; % Use upper tail xvals = (xvals(1:end-1)+xvals(2:end))/2; % Piecewise linear interpolation, to enble inte...
f812d466a7de16a87b5470d36a9d4c22b917867e4e90ff78f6523f3996e53167
MATLAB
4,173
129
warning('off', 'all'); m = []; %% Dataset 4 load('.\Dataset4.mat'); fname = 'D4'; fixed_time = 132; voxel_size = [0.267 0.267 2]; current_neuron_arangement = pca_reconstruction(neurons_cleaned,20); % prima sembrava giusto [29.7563 76.6338]; [319.0453 115.6386]; chosen_point = [40 70]; [correspondences,di...
d34e597880a4b4f25617b1531488f37785a0e7941f454722f7c6c1264a1592d2
MATLAB
4,177
142
classdef cosinor < timeseries % COSINOR define class for cosinor analysis % % C = COSINOR(DATA, TIME) creates a COSINOR object to fit the default % cycle length (24 hour). TIME should be in seconds relative to % 'StartDateTime'. If 'StartDateTime' is not specificed, the % ...
325df97d8b37db1390ca30a74496dba04135bdbff28f346fab98407a67b67ce5
MATLAB
4,178
122
function [pparam, X, clabel] = mv_preprocess_pca(pparam, X, clabel) % Performs Principal Component Analysis (PCA) by projecting the data onto % the n leading eigenvectors of the covariance matrix. % %Usage: % [pparam, X, clabel] = mv_preprocess_pca(pparam, X, clabel) % %Parameters: % X - [... x ... x ...] ...
e7ce8f906a663e80ebb1a76e2e96f148d65c1aef22e39ecf78ba6f374c1d3b57
MATLAB
4,181
102
function PlotMean_IndDataPts_MultCond( DIST_STRUCT, TITLE, YLABEL, cmap, cmap_num,... stdOrsem, STATS ) % Michelle Cahill 20211201: modified from violinplot_STATS.m % PlotMean_IndDataPts_MultCond plots the mean value of each t-series for each % condition & the std or sem of all t-series. A statistical test ...
a21e041c4a54d076feface61a0a2a67e2f8cf38abd2d0fe99a8e743627d64de2
MATLAB
4,184
134
function response = get_response(Experiment, responseType) Keys = Experiment.Keys; Timing = Experiment.Timing; switch responseType case 'continue' % Wait for response keyIsDown = 0; while 1 % Infinite loop of keyboard checks [keyIsDown, secs, keyCode] ...
aa95c06fac317f322f977db24f69812c12c272be4246f1bfdbf10a4994ef564d
MATLAB
4,185
112
% Extract the brain activity computed in the GLM2_Test Grid orientation in % the EC %% Set up the environment clc clear restoredefaultpath SPMPath = '/Applications/spm12'; addpath(SPMPath); %% Add the pm_data path pmDataPath='/Users/federica/data/GridMagination/3Iso/Script/00_pm_data'; addpath(pmDataPath) WorkingDi...
3dffa4fff39598f9b021908c779687bdc05173543266e8a8c2c0f3e9f513e0fc
MATLAB
4,186
121
function fdln = fdlnIdentifyLinesByRatio(fdln,vLinePositions,hLinePositions) %This function tries to identify fiducial line structure based on the distance ratios. %INPUTS: % fdln - fiducial line structure array % vLinePositions - crossing points of vertical lines (x=0, y=c) [mm] % hLinePositions - crossing ...
9186d480c2e6196eaf69962de50e18909267266f2532725d1febdcd34e8c38c2
MATLAB
4,189
133
function vmp = bv_writevmp(fname_out_vmp, data, fname_in_vtc, ... x_vmr, y_vmr, z_vmr) % vmp = bv_readvmp(fname) % % :description % % Writes a VMP file in version 2 (BrainVoyager QX). % % :inputs % % fname_out_vmp file to be written out, e.g. 'myvolstats.vmp' % data 3d m...
0d5faa27b8ee764630496a8f8e9cdc9c6e679dacbf20af560388583f0f506a08
MATLAB
4,191
125
function [subj mat] = duplicate_object(subj,objtype,old_objname,new_objname,varargin) % Duplicate an object % % [SUBJ MAT] = DUPLICATE_OBJECT(SUBJ,OBJTYPE,OLD_OBJNAME,NEW_OBJNAME,...) % % Calls init_object to create a new obj called NEW_OBJNAME, % and then copies across the mat from OLD_OBJNAME and sets % the derived_...
7efc2fc7a083107ea5c6a073a55b4e475400d93cb58b5c758a79990f435a8d67
MATLAB
4,192
77
% Fit a utility logit choice model for intertemporal binary choice data % % 'type' : String input indicating the model to fit. One of H, E, GE, GH1, GH2, Q, DD. % 1 param models (k) % 'E' : Exponential Model (Samuelson, 1937). U = A * exp(-kD) % 'H' : Hyperbolic Model (Mazur, 1987). U = A / (1+kD) %...
fda37488362f687c6a1e179fa7f33734920226558cfc9a99f92d1b808249b190
MATLAB
4,193
104
function mri_reconstruction_permute(p) % Run the pSVR analysis as for the optimal values for voxel-counts and % feature-space smoothing FWHM values. First, the results from the % parameter grid-search analysis (see mri_reconstruction_grid.m) are loaded % and submitted to a nested cross-validation across subject, in wh...
19e09c13b6ed040e57b41d38e87eb3b423532d4c8c3218b8a089ca4784835a2d
MATLAB
4,194
119
%% IN-PHASE AND ANTI-PHASE SYNCHRONY clear rng(17) % seed Path = [pwd, '\ML_sims\']; clrs = ["b","r","g","k","c","y"]; % colors per_clr = [0.9290,0.6940,0.1250]; % periodogram color % TIME T = 1500; % time span dt = 0.01; % COUPLING epsilon = 0.10; n = 2; N = sum(n); K = getK(n,epsilon); % al...
5b3553c044876b35cb608aa655330a412b935add42fb0d4e45305f85f8e803f2
MATLAB
4,197
87
% This script is a template for people who are interested in carrying out % between-group decoding of brain imaging data. This is the case where each % of your subjects carries only one condition. If you have one group and % have multiple conditions per subject you want to compare between subject, % see decoding_te...
3c16cb423078dcb654628e5780902faa76d06ffce49924db9e6618a891571931
MATLAB
4,206
120
function [transformationMatrix] = ... phase_difference_linear_registration2d(moving, movingCertainty, ... fixed, fixedCertainty, varargin) % PHASE_DIFFERENCE_LINEAR_REGISTRATION2D Estimates a transformation matrix using phase-difference % % [transformationMatrix] = ... % phase_difference_linear_registration...
f4d59c61b02a7d27029212f8904afe334b16e70b3a68d61b68ed8c3145c68e2f
MATLAB
4,211
135
clear all [task_info, supPath ,~,task_DB_path] = loadDBAndSpecifyDataPaths('Vermis'); req_params.grade = 7; req_params.cell_type = 'PC cs'; req_params.task = 'speed_2_dir_0,50,100'; req_params.ID = 4000:6000; req_params.num_trials = 50; req_params.remove_question_marks = 1; lines = findLinesInDB (task_info, req_par...
07b2b3ce8758c19edf88d71908f6ba7b051c838321d550c4b083ce2ee182adfa
MATLAB
4,214
142
% dehighpass in a data-dependent manner % % xd = dehighpass( x, minAmp, minDur, f ) % % default parameters: % minAmp 0.01 of the range (max-median) % minDur 3; [samples] % f 2; multiples of the instantaneous duration % % does % given a segment of data filtered with a high-p...
9bae9dfb4de770f220287479fe2979bced645c1127cb6a4b4f92924b2c2ccefb
MATLAB
4,216
147
clear [task_info,supPath,MaestroPath] = ... loadDBAndSpecifyDataPaths('Vermis'); angles = [0,90]; probabilities = [0:25:100]; test_window_form_event = 1:300; NUM_COND = 10; req_params.grade = 7; req_params.cell_type = 'PC ss|CRB'; req_params.task = 'choice'; req_params.ID = 4000:5845; req_params.num_trials = 100...
11f3859473a05ee42ddba6d58c96358618c1cec29d5324f9faf30872ded3c853
MATLAB
4,220
93
% This script is a template that can be used for a representational % similarity analysis on brain image data. It is for people who have betas % available from an SPM.mat and want to automatically extract the relevant % images used for the similarity analysis, as well as corresponding labels % and decoding chunk nu...
56b1bdfc6c1dc1595d64f14724af402f672929598d9fd662cef8b2b606c76f9d
MATLAB
4,225
152
function [x, options] = linemin(f, pt, dir, fpt, options, ... varargin) %LINEMIN One dimensional minimization. % % Description % [X, OPTIONS] = LINEMIN(F, PT, DIR, FPT, OPTIONS) uses Brent's % algorithm to find the minimum of the function F(X) along the line DIR % through the point PT. The function value at the start...
dcf85d886ac40d358396b023cdd6382b50598c50d4b528f58246bc01e5429b51
MATLAB
4,229
92
function singlePlaneFit = spfCreateFromUVH (u,v,h,v_,pixelSize_um) %This function creates a single plane fit structure from u,v,h inputs %Single plane structure contains some statistics on the plane. %INPUTS: % u,v,h ar 3D vectors defining the plane as u*U+v*V+h. units: mm. % v_ [optional] - typical value fo...
0b050bfbcc8531474c7aee572ab673c69fc5bf6efd869ea1e4ab592f3c4dda78
MATLAB
4,231
125
%% Load data load(fullfile('Data','BehavEpochs')); load(fullfile('Data','SpikeData'),'S'); load(fullfile('Data','Angle')); load(fullfile('Data','Velocity')); % epTemp = csvread(fullfile('Analysis','LED1_TS.csv')); % wakeEp = intervalSet(epTemp(2,1),epTemp(2,2));...
4e0d2dfe36eaf8ab7628d670a192d5cb4f21458cf6f5e42366b0a5b4a9bd0ecf
MATLAB
4,231
82
% Template for creating ML documents. Using the HEP average by trial data. % X, truth, duration, skipLOO, perm, eigratio,gamma, method) % Sample length = 1000 Hz Downsampled to 500 Hz tau = 5; % 10 ms of increment for discrimination duration = 30; % 60 ms of windo...
46c50f6842f4c72fbbb3a54941a463d1d80bda8342feee6e35b5414810093653
MATLAB
4,235
95
% This demo shows how to apply prevalence inference as statistics to a toy % dataset. This example shows you what you minimally have to do to PROVIDE % YOUR OWN DATA (i.e. if you do not want to use TDT or images). Find % further explanations about the analysis in the paper below. % % Alternatively, consider tak...
2213866e16a8dc52e00579ae4e58d309808773649876160c2b1768a76ae03d3d
MATLAB
4,236
121
% beta is #sbj x HbX x #Channels x #conditions % bvar is #sbj x #HxB x #Channels x #conditions % sigAct is HbX x #Channels x #conditions % sigDiff is HbX x #Channels x #pairs % For sbj 12, # of coefficients is 16. % use welch t-test % Average beta % Use Wald's test for single parameter estimation. % Given each obser...
533fcbe9608c953e4ab607b90dd10e39154a8b735aee2fd0f56fed60d9ca037b
MATLAB
4,238
175
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 = 'choice'; req_params.remove_question_marks = 1; req_params.remove_repeats = false; req_params.num_trials = 120; epoch = 'cue'; lines = findLine...
71073643d7dd158e4c1c19ca92072db6ab8c7e296cbdb82fb3d14f72780ff87c
MATLAB
4,240
71
function [h, p, stats, n, stderr_spon, stderr_stim]=no_pad_wilcoxon_210701(table1, table2) %if conduction time isnt present in both, drop time and spikes etc for i=1:length(table1) [rwtb,~]=size(table1{i}); for j=1:rwtb time_similar_1=zeros(1,length(table1{i}.("Conduction Time"){j})); ...
cbbea57dc885856996694f4006002c1de8447afa9e7df5cbd24cd845d198ecab
MATLAB
4,243
130
function [errs warns] = unit_spm_afni_tutcompare(varargin) % [ERRS WARNS] = UNIT_SPM_ANA_AFNICOMPARE(varargin) % % FEXTENSION(*.nii/.img) % If unset, this will assume you wish to run the tutorial against nifti % data. If set to .img it will change to using the analyze data set. % % Unit test of the spm ana fi...
c43283f96675410e69656410e636ca6a28dcfcaf111142f6e47296e22fe595bd
MATLAB
4,250
109
clear,clc %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % This script is used to predict the learning outcomes of week 4 % intervetion % % Jin % 8/17/2022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% set the file path current_path = pwd...
2f28e5c4f31c9113c09b6a7f1e6e24c478a345097bb1d9ae48b19b060f057407
MATLAB
4,251
135
clear all;close all;clc; % import matrix for completion Y_filepath = 'ccle.xlsx'; [Y, text, alldata] = xlsread(Y_filepath); Y = Y'; % 491*23 --to--23*491 Y_dim = size(Y); % Known_index0 = find(isnan(Y)==0); % Missing_index0 = find(isnan(Y)==1); % missing_index_1 = randperm(length(Known_index0),500); % Known_index ...
c7507668fe2f6530298a6ae52c492525fda8884e79b6a265e739ef4159578e1d
MATLAB
4,251
135
clear all;close all;clc; % import matrix for completion Y_filepath = 'ccle.xlsx'; [Y, text, alldata] = xlsread(Y_filepath); Y = Y'; % 491*23 --to--23*491 Y_dim = size(Y); % Known_index0 = find(isnan(Y)==0); % Missing_index0 = find(isnan(Y)==1); % missing_index_1 = randperm(length(Known_index0),500); % Known_index ...
5b0b211074062757ec58de7f99a7ded1b2c1b5f210fa1b5708dad7205e05daa5
MATLAB
4,257
107
% lateralization test using welch's t-test for group. % beta is (#coefficients x HbX x #Channels x #conditions) % bvar is #coefficients x # Channels x #HbX % bvar is square of standard error, not SD function calcLatTest(sbjList) % Good news, same for both old and new probe leftChn = [1:6]; rightChn = [15:...
b10d276052684d9eb55701d332b373201c449b5653b88a0329a1c5fee5b88d49
MATLAB
4,268
84
%% Extended Data Fig. 1a and 3a: Ribosomal-mRNA expression in visual cortex astrocytes from the Farhy-Tselnicker et. al publicly available dataset % (NCBI Gene Expression Omnibus, GSE161398) % 1. Load 'GSE161398_FPKM_MasterTable_Development.xlsx' as a table % 2. Run the following code % Extended Data Fig. 1a: R...
b68e40c69be51db4504861f142cd3ce7e1e983f7687a07d95cb7397945c273f0
MATLAB
4,271
171
function [success errmsg] = test_tutorial_easy() % [success errmsg] = test_tutorial_easy() % % Runs the new and old version of the tutorial scripts to compare % them success = 0; errmsg = ''; rand_state_int = sum(100*clock); curdir = pwd; try cd ~/fmri/benchmark/ catch success = -1; errmsg = 'No benchmark di...
bbf2a12c41f2867703567af9969d4b833605f5a45e436cc8512ff9748b52b871
MATLAB
4,271
141
function [subj] = load_bv_pattern(subj,new_patname,maskname,filenames,varargin) % Loads an BrainVoyager dataset into a subject structure % % [SUBJ] = LOAD_BV_PATTERN-AA(SUBJ,NEW_PATNAME,MASKNAME,FILENAMES,...) % % Adds the following objects: % - pattern object called NEW_PATNAME masked by MASKNAME % % NEW_PATNAME is t...
92bfe1dc31ce8f742dbe087ccf341eace20e1de83507921c49a552ebe9e527b9
MATLAB
4,272
142
function [yo, fo]=mtcsd1(varargin) %function [yo, fo]=mtcsd1(x,nFFT,Fs,WinLength,nOverlap,NW,Detrend,nTapers); % Multitaper Cross-Spectral Density % function A=mtcsd1(x,nFFT,Fs,WinLength,nOverlap,NW,Detrend,nTapers) % x : input time series % nFFT = number of points of FFT to calculate (default 1024) % Fs = sampling fre...
9ac01924544c2bd79659218961c5146402f27450c1dae5ebbcf33d5d1bb7fcdd
MATLAB
4,273
108
function [subj] = scramble_regressors(subj,regsname,selname,new_regsname,varargin) % Scrambles your regressors for sanity-checking % % [SUBJ] = SCRAMBLE_REGRESSORS(SUBJ,REGSNAME,SELNAME,NEW_REGSNAME,...) % % SUBJ = the subj structure % % REGSNAME = the name of the regressors you want to scramble % % SELNAME = the sele...
c91f26dd78140ff24490425d150521fea3e6d0c9e365b3a78c53f0833c718218
MATLAB
4,276
132
% STATUS: Active(?) % % SYNTAX: % [performanceLDALedoit] = ... % calcCumSum_DiffStartT_AllChn_CompClassifiers_NoSave_LOFO(sbjNum,... % trialsTr,trialsTst,movieListTrain,movieListTest,numClasses,idxChn,... % mlActAuto) % % DESCRIPTION: % Format data and perform leave-one-channel-out classification using cross %...
0cdfabbfd16bc2f08bea9e5a24121e47aea51d19a1ceb75ae34ac81ee30795f9
MATLAB
4,280
139
clear; supPath = 'C:\Users\Noga\Documents\Vermis Data'; load ('C:\Users\Noga\Documents\Vermis Data\task_info'); req_params.grade = 7; req_params.cell_type = 'PC cs'; req_params.task = 'saccade_8_dir_75and25'; req_params.ID = 4000:5000; % req_params.ID = setdiff(4000:5000,[4243,4269,4575,4692,4718,4722]) req_params.n...
4dea763568a094a2de5b1146a126d0721d330368305d4d5164018fea8124201f
MATLAB
4,280
86
% Extract single HRF from dcNew variable, the output of GLM fitting function % save to mat file. % Update file name solely for SSBeta Prior % For sbj 12 and after function createSingleTrialHRF_SSBeta_MultiOnly(sbjNum,respData,numClasses) %saveDir = ['C:\Users\mn0mn\Documents\ResearchProjects\spatailAttentionProject\Pr...
e9edb52d0e891c18f30863aa1037befa38ea509d67bf58da119be6afac529e20
MATLAB
4,284
104
% Abffile bulk conversion script % % Goal: - convert and analyse abf files % - skip certain protocols that are not analyzable at the moment % - only analyse channels with something meaning ful associated to it: so check labbook list to see if channel % was used...
0d41fc92d42ba330a37f9828ff8bdba06a01f8aa8d0883ae3eb180fa4e791214
MATLAB
4,291
113
function model = pp_segment(sub_id, p) % function model = pp_segment(sub_id, p) % % Runs SPM segmentation on a coregistered high-res anatomical image. % % Input: % - sub_id: ID of the current subject. % - p: Structure with analysis parameters. % % Output: % - model: Structure with all SPM settings used for this ...
352168a4a6772873dce0761885e760b3333646af02fd8b623d43e6f52ed076d9
MATLAB
4,291
106
%% bulk data extraction from Abffile objects % When nr. of files is too large to be practical in one Abfbatch object, this function comes in handy. It chucks the list % of files into smaller batches of files, keeping the total number of MBs per batch roughy constant. Then creates ABFBATCH % objects for them using par...
4f7e9b70b379315c39fd65b4ffe138dd4ffcc3cb2f4679ff8f1e066b3c6bf553
MATLAB
4,291
64
clear,clc %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % This script is used to perform CCA validation % % Jin % 8/10/2022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% set the file path current_path = pwd; working_path = current_path(1:strfind(cu...
c9f15e280af1a77ac123479d34cdd01ee7619d5068117946a71a155c3f32daf0
MATLAB
4,298
191
clear; clc; opts = optimset('Display','off'); [task_info,supPath,~,task_DB_path] = loadDBAndSpecifyDataPaths('Vermis'); EPOCH = 'targetMovementOnset'; DIRECTIONS = 0:45:315; req_params = reqParamsEffectSize("saccade"); %req_params.ID = [4797]; lines = findLinesInDB (task_info, req_params); cells = findPathsToCells...
2e722e0b83f5294fa1198740a341153287e371bcd787e082b2a0afef262b95a4
MATLAB
4,303
127
function [subj] = create_blocklabels(subj,regsname,runsname,varargin) % Creates selector labels for each condition in each run % % [SUBJ] = CREATE_BLOCKLABELS(SUBJ,REGSNAME,RUNSNAME,...) % % See https://compmem.princeton.edu/mvpa_docs/TutorialAvg % % This is usually used a precursor to a function like % AVER...
b708f2518f8285ec7cfa23cd1bb1c183667cb967ddf89787eeb374b44111c262
MATLAB
4,305
91
% function [mask_vol,mask_hdr,sz,mask_vol_each] = load_mask(cfg) % % Subfunction for decoding.m % This function loads one or several masks from cfg.files.mask in which the % decoding analysis should be performed (e.g. a brain mask for a % whole-brain or searchlight analysis or a small volume for a region of % int...
4e5b5410ed97d8c60c6d126d6d36daff915280a433ed4e30d560c3fb55869581
MATLAB
4,307
125
function [output, displacementField] = thin_plate_splines3d(input, outputSize, ... inputLandmarks, outputLandmarks) % THIN_PLATE_SPLINES3D Deforms input volume according to given landmarks and thin plate splines % % [output] = thin_plate_splines3d(input, outputSize, ... % inputLandmarks, outputLandmarks) % % I...
c5f1b6a8d848db4dde26a2076b4fa957800b85cd6d1228a83c387bdd15a4b228
MATLAB
4,308
110
function pipeline_svm_state_at_cue_2nd() cfg = load('/projects/crunchie/moehring/neurovar_v2/BIDS/code/neurovar_cfg.mat').cfg; n_subs = 44; %% Specify 2nd Level AUC clear matlabbatch auc_dir = fullfile(cfg.global.deriv_dir, 'pipeline_svm_state_at_cue_2nd', 'AUC_minus_chance'); ...
1c1d73b8a2c869d032436503c35bf9401ea80e71f2d6f52c6a0cd0f9c42a8df9
MATLAB
4,309
139
function dimensions = yOCTLoadInterfFromFile_ThorlabsSRRHeader (inputDataFolder,OCTSystem,chirp) %In case this is a thorlabs file that is saved in srr format. %Make sure SRR Name convention is 'Data_Y%04d_Total%d_B%04d_Total%d_%s.srr %Specifing (by order) % - Y0001 = Y scan number % - Total5 = Total number of ...
890a875f97c9ccec19e16151834b158dab6d248c89c5bf47bd80ad41b5dd2db4
MATLAB
4,311
133
% SYNTAX: % mlActAuto = hmrR_PruneChannels(data, probe, mlActMan, tInc, dRange, SNRthresh, SDrange) % % UI NAME: % Prune_Channels % % DESCRIPTION: % Prune channels from the measurement list if their signal is too weak, too % strong, or their standard deviation is too great. This function % updates MeasListAct based on ...
b5f6bb5cf20ac265588a6d3c7d0632f6b454c72291a273f1b7444d2bd93bd32f
MATLAB
4,312
148
clear [task_info,supPath,~,task_DB_path] = loadDBAndSpecifyDataPaths('Vermis'); EPOCH = 'reward'; req_params = reqParamsEffectSize("both"); % req_params.cell_type = {'PC cs'}; %req_params.ID = 4153; lines = findLinesInDB (task_info, req_params); cells = findPathsToCells (supPath,task_info,lines); for ii = 1:lengt...
d8b223ea8b1890731af577446a3a05ed21905cb10ee2d0a835e64f07bf083548
MATLAB
4,312
160
function Duszkiewicz2024_Figure_SingleRec_Decoding % This script reporoduces panels from: % Extended Data Figure 1 % Run in folder A3705-200306 to reproduce the manuscript figure % Dependencies: % TStoolbox %TODO: script dependencies, links to external functions % Copyright (C) 2023 by Adrian Duszkiewic...
fc0dce4f6c0aaf7b5fd91def8adc4d1be63a288b9ee7df2a7e119456c2ae4653
MATLAB
4,313
86
function [all_units] =NWB_SB_extractUnits(nwbAll, load_all_waveforms) %NWB_SB_extractUnits Takes a cell array of loaded nwb files and returns all % single unit information across all the files. % nwbAll: cell array of loaded nwb files % importRange: % % mkyzar 4/27/2023 all_units = {}; for i=1:length(nwbAll)...
3406258185ec3c0aaedc68403af06059c6e85960b8200bc13552ad59424fecb2
MATLAB
4,317
72
function [h, p, ci, stats, n, stderr_spon, stderr_stim]=no_pad_ttest_210319(table1, table2) %if conduction time isnt present in both, drop time and spikes etc for i=1:length(table1) [rwtb,~]=size(table1{i}); for j=1:rwtb time_similar_1=zeros(1,length(table1{i}.("Conduction Time"){j})); ...
c997ba5e89592f6e62ef837404952fc7bd7b72b889ae0dfdeed96785e7a21ff4
MATLAB
4,321
181
clear statistic_func = @func; %statistic_func = @(smpl) var(reshape(squeeze(mean(smpl)),1,[])); T = 10; N_TRIAL = 25; %average per condition base_vals(:,1) = linspace(0,1,T); base_vals(:,2) = linspace(0,-1,T); var_vals = [0:20]; permDims = {[2],[3]}; varNames = {'reward'}; for v = 1:length(var_vals) var_fact ...
42b5aad19f35ed459ca28ac7edeadf18845c1ff1351dfb90f4fcbaf8bcc611dc
MATLAB
4,326
120
function [imfStart, imfPeriod, imfAmplitude, imfNadir] = li_upmemd_cycle(comp, fs) %LI_UPMEMD_CYCLE calculate cycle start point, period, and amplitude of each % cycle from the component extracted using LI_UPMEMD % % $Author: Peng Li, Ph.D. % $Date: Mar 24, 2023 % $Modif.: Jul 06, 2026 % Allow...
6cc8d2fa7e693cdb8e4d4554cb5a8920517b1f92ff44bea414addf86bad28472
MATLAB
4,329
130
function this = cosinorActi(this) %COSINORACTI Perform cosinor analysis on an ACTI object % based on cosinor class methods % % $Author: Peng Li % $Date: Nov 11, 2022 % $Modif.: Feb 20, 2026 % Asign fitted data to Circadian property for consistency % with Sleep and Gap % ...
d2ff773f5709cec57f8f5d11c3489746b766606a0af4f9a47ababbd2355288a8
MATLAB
4,329
146
function [spkWidth,tr2pk,halfPkW,maxIx,wave] = Make_WaveFormFeatures(waveforms,varargin) % Extract spike width, trough to peak and peak half-width from waveform(s) % The program assumes spikes are negative. Exclude positive spikes for % now. % % USAGE % % Make_WaveFormFeatures(waveforms,<Fq>) % % INPUT % ...
f31e08a1cb53307c356136b20c5498efbc4f9a323a6e848eb535c330aab20f44
MATLAB
4,342
151
function [v,D] = logistpca(x,y,v,show,lambda,eigvalratio) % [v,D] = logist(x,y,vinit,show,lambda,eigvalratio) % Iterative recurcive least squares algorithm for linear logistic model % % x - N input samples [N,D] % y - N binary labels {0,1} % % Optional parameters: % vinit - initialization for faster convergence (optio...
a6964ef91c1d4faf24db27eb5ddcc6d740904fbc9b776a643e36b7b783bb24fd
MATLAB
4,344
199
%% for axes alignment cids = Qual < qualthr; ndim = size(Y, 2); % a = CSctr; a(cids) = nan; b = BSctr; b(cids) = nan; x = log(median(a(:, ChooseClip)./b(:, ChooseClip), 2, 'omitnan')); x = x-x'; x(eye(size(x, 1))==1) = nan; x = x(:); x(isnan(x)) = []; ev_s = nan(ndim, 1); for i = 1:ndim y = Y(:, i...
8105fe36dd3ce7a11d62bee5dc694e367d5322d0b559f8d8591637f2a8320893
MATLAB
4,348
159
function [errs warns] = unit_wavestrapper_results() % [ERRS WARNS] = UNIT_WAVESTRAPPER_RESULTS() errs = {}; warns = {}; errs = very_significant_sine(errs); errs = not_significant_rand(errs); errs = varying_significant_sine(errs); % alert the user if there are any problems [errs warns] = alert_unit_errors(errs,warn...
2918ef3d9fafda6c745379acd6915e471c544b16d6833ebfc711823078ea778b
MATLAB
4,350
118
steps2run = [false false true]; %folder containing doric data and boris data %one subfolder per animal with all trials from the same animal data_folder = fullfile(pwd,'Data'); %folder used to save analyses %one subfolder per animal with all trials from the same animal analysis_folder = fullfile(pwd,'Analysis'); % ...
924de66976c35f0f5ee967a495068ef7e68fbd1aff88b23a575b3014654081f4
MATLAB
4,350
109
%% Flow Distribution Data and Plots function FlowDistributionData(fileParams, flowDistParams) %% Make Flow Distribution Data fprintf('\n\n- - - Starting FlowDistributionData - - -\n'); %% Figure Parameters distOption = flowDistParams.distOption; dataBinWidth = flowDistParams.dataBinWidth; showBinWidth = flowDistParams...
5ed5ef9485a86e1a3397aeef53acbb266d1705457135ea91c3e5cad70bbf116a
MATLAB
4,358
138
%DEMRBF1 Demonstrate simple regression using a radial basis function network. % % Description % The problem consists of one input variable X and one target variable % T with data generated by sampling X at equal intervals and then % generating target data by computing SIN(2*PI*X) and adding Gaussian % noise. This data ...
ddec5733b0e576762849a5bbc509f5c41fdc7f547fa17cde88a4603ea5071a33
MATLAB
4,358
128
% Option 1: No GLM, just use SS coefficients = 1 to get individual trials % In this option, no CV is performed here. % Option 2: Use GLM only for SS coefficients since it's the same for all % conditions. However, require building design matrix. Also not 100% % independent of class conditions, still need to know tr...
c4769b6fcc8be984ed8b93dbdace52d5cba9331fc8e9c9e7ef10f809189d6990
MATLAB
4,366
125
function regmod = getRegMod(regtype) i = 0; %number of models if strcmp(regtype,'fb-surprise-stepwise') i = i+1; %standard RL model regmod(i).name = 'splitRPE-only'; regmod(i).model = 'eeg ~ (valenceP1 * surpriseP1) + (valenceP2 * surpriseP2)'; regmod(i).identVars = {}; regmod(i).identVals = {}; ...
56d84a6b4ab57d65c018115b9680455757efd72b70107f25497eb5532dfeb584
MATLAB
4,369
124
function model = train_ridge(param, X, Y) % Trains a ridge regression or a linear regression model. % % Usage: % model = train_ridge(param, X, Y) % %Parameters: % X - [samples x features] matrix of training samples (should % not include intercept term/column of 1's) % Y ...
1897fbce554dab3d5e06955322df7b5c6bf5e252d6d61bbd404f45f931ab6526
MATLAB
4,371
95
% This script is a template that can be used for a decoding analysis on % brain image data. It is for people who ran one deconvolution per run % using AFNI and want to automatically extract the relevant images used for % classification, as well as corresponding labels and decoding chunk numbers % (e.g. run numbers...
724eecdcddb153f1723be4410cfc2f0a2afe7acd339c4fc8b2681b25bcaa2977
MATLAB
4,371
113
function varargout = write_image_afni(varargin) % write_image: % inputs: header, volume (X x Y x Z) % output: written header (normally not needed) % History: % 2019/24/01: Fixed potential issue when blank appears at end of filename % This code includes parts from the CoSMoMVPA package from the...
c15e0546ea68d34f834e243e532bb02c0ec05fd72b25fb800d7718d7bd65865d
MATLAB
4,376
119
% figure S5: measuring symmetry of the weights % last update: October 28 2022 % Amirhossein Farzmahdi close all clear clc % add path addpath(genpath('functions')) % fixed random seed for regenerating same result seed = 42; rng(seed) % load network trained_net = alexnet; % create random network untrained_net = fun_...
bcb908cc6899bd4fd673ef437985ad7c69d0cfdf8511139a5b494db7a3d83241
MATLAB
4,378
88
function [all_units] =NWB_SB_extractUnits(nwbAll, load_all_waveforms) %NWB_SB_extractUnits Takes a cell array of loaded nwb files and returns all % single unit information across all the files. % nwbAll: cell array of loaded nwb files % importRange: % % mkyzar 4/27/2023 % updated JD 01/2025 (correction of ...
d2f5dc12ca977f0e6beb6c7ae7eb027e91221c9e53b1ac62b04752d987ad3fc2
MATLAB
4,385
121
%% CLEAR AND INITIALIZE clear;close all;clc;tic; %% DEFINE THE STRUCTURE THAT WILL HOLD ALL THE PARAMETERS params = []; %% DEFINE INPUTS AND OUTPUTS params.data_folder = 'E:\NAS_SD\SuiviClient\Triffilieff\2023\Data\RWD_TestForLola'; params.analysis_folder = 'E:\NAS_SD\SuiviClient\Triffilieff\2023\Analyses\RWD_TestF...
ee06aaaf38aec0a11300e6c3f2be5f7d9037db25cd51ac281da8b1158f62af09
MATLAB
4,386
135
function [subj fn] = save_subj(subj,varargin) % This just saves the subj structure to a file. % % [SUBJ FN] = SAVE_SUBJ(SUBJ,...) % % It's useful because it does lots of book-keeping, and won't % overwrite existing files unless you tell it to % % FN = the filename it saved itself under. This is useful in cases % where...
7ba2c08b76c0c49f7f1dafd31c25e8da3c9a17efee9b65ca63cf9a54cd8cc571
MATLAB
4,391
98
% This script is a template that can be used for a decoding analysis on % brain imaging data. It is for people who neither have betas available % nor brain image files, but who want to pass their brain imaging data % directly. This also supports the use of data of other modalities, e.g. % EEG data. Labels, decodi...
eb4c29acc736af2c1a04a2286fa1ec0dd799c9d72360825d5ea9efb6763afadd
MATLAB
4,393
102
function [v, regions, params, startpoints] = velocity_segment(T, options) % [V, REGIONS, PARAMS, STARTPOINTS] = VELOCITY_SEGMENT(T, OPTIONS) % % Compute simultaneous segmentation and velocity estimation from the % spatiotemporal orientation tensor field T. The algorithm is described % in section 6.4 of Gunnar Far...
ad62d896867b249dbfc5a1f43064ae7de4388ef5d4eec6ceb27730742c620e2a
MATLAB
4,394
139
function [t,x_new,f_new,g_new,funEvals,H] = ArmijoBacktrack(... x,t,d,f,fr,g,gtd,c1,LS_interp,LS_multi,progTol,debug,doPlot,saveHessianComp,funObj,varargin) % [t,x_new,f_new,g_new,funEvals,H] = ArmijoBacktrack(... % x,t,d,f,fr,g,gtd,c1,LS_interp,LS_multi,progTol,debug,doPlot,saveHessianComp,funObj,varargin) % % ...
c5d2f1408c08eab9bedc8e9c97c9228f385f922e7a916be2c1b3e572fd444654
MATLAB
4,394
107
clear clc close all %% Load raw data and set parameters pathname = uigetdir('pick a folder that store tracking data'); pattern = fullfile(pathname,'*TNT*'); filelist = dir(pattern); framerate = 400; % in Hz ratio = 3; % the interpolation ratio inter = framerate; % how many frames to reconstruct a ...
d8a0ee0371dc198caae352661c6b58a09664bf9f300d3ff481e9da7b353d994c
MATLAB
4,405
102
% function indexindex = get_ind(cfg,mask_index,i_decodingstep,sz,sl_template,passed_data) % % Subfunction for decoding.m % This function gets the indices for the current step of the decoding % analysis (i.e. the current searchlight for searchlight decoding or the % current ROI for ROI decoding). % % Masks (e.g. ...
e0391697178318a03e3a1a667c0d7a7ce0e1ba31967d5e67be49079e68282cc7
MATLAB
4,405
131
function [errs warns] = unit_template() % [ERRS WARNS] = UNIT_TEMPLATE() % % This is the template for a unit test. Unit tests should % take in no arguments (or only varargin optional % arguments), and return ERRS and WARNS cell arrays of % error messages. If both are empty, the test has passed. % % The unit test shou...
7f0a2a208b6bc15315020328983a65c75dd160c1884d4d119212b1a7baa05812
MATLAB
4,408
101
% @title Create synaptic connection matrix for a group % @file gen_syncon.m % @author Romain Beaubois % @date 04 Aug 2021 % @copyright % SPDX-FileCopyrightText: © 2021 Romain Beaubois <refbeaubois@yahoo.com> % SPDX-License-Identifier: GPL-3.0-or-later % % @details % > **04 Aug 2021** : file creati...
89086be845a86a62c04cb48efc7234f2754bce47ff0da6d41323d1b198758920
MATLAB
4,408
137
clear all;close all;clc; % import matrix for completion Y_filepath = 'gdsc.csv'; [Y, text, alldata] = xlsread(Y_filepath); %Y = Y'; % 969*295 --to--295*969 Y_dim = size(Y); % Known_index0 = find(isnan(Y)==0); % Missing_index0 = find(isnan(Y)==1); % missing_index_1 = randperm(length(Known_index0),500); % Known_inde...
f2089f98d60180f54bcdcfd4b3ec7d46c729f28eacbfcac9a1bf9b4231cad3e4
MATLAB
4,409
114
% Script for a power simulation for the detection of correlation effects, % depending on whether variables are pre-selected or not. % Size of original sample (i.e., respondents to the VVIQ) n = 200; % Size of quartiles quart = n/4; % Number of selected samples per group (total is n_sel*2) n_sel = 20; sigma ...
9633a6659fffb26ce423e065019cb673b8c234d16d2c739b8981c0ab63510a05
MATLAB
4,414
138
clear all;close all;clc; % import matrix for completion Y_filepath = 'gdsc.csv'; [Y, text, alldata] = xlsread(Y_filepath); %Y = Y'; % 969*295 --to--295*969 Y_dim = size(Y); % Known_index0 = find(isnan(Y)==0); % Missing_index0 = find(isnan(Y)==1); % missing_index_1 = randperm(length(Known_index0),500); % Known_inde...
d4997c248ec003d247814eb0f153cb2e3042eaf44895d9105f5ecbb22217c803
MATLAB
4,420
104
function [acts scratchpad] = test_adaboost(testpats,testtargs,scratchpad) % [ACTS SCRATCHPAD] = TEST_ADABOOST(TESTPATS,TESTTARGS,SCRATCHPAD) % % Implements the testing function for AdaBoost.MH/AdaBoost.MO. See Allwein % et al. (2001) for details on the implementation of the multi-class to % binary reduction evaluatio...
dffec02f9eb28a4f58be9e55c8508414e1c71cdc2f23510ba10cd12307dedf1a
MATLAB
4,420
124
function [Y, mask] = spmReadVolsMasked(V, mask, output) % read in-mask MR image data from an array of SPM volume structs % % Y = spmReadVolsMasked(V, mask) % [Y, mask] = spmReadVolsMasked(V) % % V: array of volume structs (or filenames) % mask: logical array with dimensions matching data volumes % if not spec...
0cdab55d99f10105141eab5b201d54b84a3e10b1416dcc82e8f5736eb08dfe8f
MATLAB
4,422
120
function this = sleepDet(this) %SLEEPDET Perform sleep detection on an ACTI object % % $Author: Peng Li % $Date: Dec 02, 2020 % $Modif.: May 17, 2021 % generate window from doMask2 instead of recalculate based % on mask series % Jun 24, 2021 % see comme...
5d1005a80b62144cec2a2510e27841ccb293971bc5e52e4ebfe31964cc8688d9
MATLAB
4,422
132
%DEMHMC2 Demonstrate Bayesian regression with Hybrid Monte Carlo sampling. % % Description % The problem consists of one input variable X and one target variable % T with data generated by sampling X at equal intervals and then % generating target data by computing SIN(2*PI*X) and adding Gaussian % noise. The model is ...
b00ecd180b0bb94530b1ed782de7cb097dc1c06b5e0c8c49a7747c96fe5aa18a
MATLAB
4,431
162
function [L, model] = pure_mf_learner(param, behav_data) %% Read behav_data n_trials = behav_data.n_trials; state_switch_on_trial = behav_data.state_switch_on_trial; reward_switch_on_trial = behav_data.reward_switch_on_trial; max_reward = behav_data.max_reward; %% Parse parameter values %(transformations n...
fcb377ba032e26b60cba19351561c79ada3d5f5b44f281801cea7a6da14e3c76
MATLAB
4,431
134
% references: https://www.mathworks.com/help/matlab/ref/area.html % https://www.mathworks.com/matlabcentral/fileexchange/5105-making-surface-plots-from-scatter-data % possible alt. plots: https://www.mathworks.com/help/matlab/ref/gradient.html#bvhqkfr downsample_colormap = 1; % activate colormap downsampling downsampl...
9fd83e7907e480bb3b37976d6f8f8078b115cf276c7c93d4a90220f254c6252c
MATLAB
4,434
127
function [err,Indx] = AFNI_XYZcontinuous2Index (XYZmm, Info, CoordCode, IndexDim) % % [err,Indx] = AFNI_XYZcontinuous2Index (XYZmm, Info, [CoordCode], [IndexDim]) % %Purpose: % Change from voxel XYZ in mm to XYZindex (called Voxel Coords in AFNI) % The mm and voxel coordinates refer to the values displayed % ...
7017d451e26ea62366a0da4c3d5c63818e5a46274c097e6361b216ad2165ac52
MATLAB
4,437
101
%Group level analysis in which we contrast the brain activity of Nav>Math %of boht group withouth permutation and withouth masking the brain. %% Set up the environment clc clear restoredefaultpath SPMPath = '/Applications/spm12'; addpath(SPMPath); spm('defaults', 'fMRI'); spm_jobman('initcfg'); pmdataPath='/Users/fe...
037711a9fcce0e3fa84b432de01dd2f1b4f2fa03c9c76b35425e9281b124a0f9
MATLAB
4,439
156
%% This code is to calculate the curve using max projection image of the side view clc; clear; close all acq_number=3; imagePath = 'F:\Bingying\Curvedprops_mode\embyro1'; % load the side-view image imageName = 'MAX_Reslice of stack1.tif'; curvename=['scanning_curve_0901-' num2str(acq_number) '.mat']; % savin...
89d73b84d4cf71a8c10dd8d49759f350d8cac2067e63e6086666d3fce06b295b
MATLAB
4,445
123
function net = rbf(nin, nhidden, nout, rbfunc, outfunc, prior, beta) %RBF Creates an RBF network with specified architecture % % Description % NET = RBF(NIN, NHIDDEN, NOUT, RBFUNC) constructs and initialises a % radial basis function network returning a data structure NET. The % weights are all initialised with a zero ...
5952f8e26f49f2570089f64aff1a5ad21b10ea11a6c518a9f756e7f7fe49125b
MATLAB
4,452
166
set(0,'defaultAxesFontSize',16) set(0,'defaultAxesTickLength',[0.04,0.08]) set(0,'defaultaxeslinewidth',2) region=["EC-DG","DG-CA3","CA3-CA1","CA1-EC"]; cd 'graph' if ~exist('tunnel_cor', 'dir') mkdir('tunnel_cor'); end cd 'tunnel_cor' Anova_name=[]; Anova_cor=[]; for fi=1:9 corr=[]; title=region; for...