sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
30a4e53abeb257b816942facaf26525e26969cb4c594b074f60ac1ceddb0baa7
MATLAB
3,437
95
clear all; clc; load('vik.mat'); rdm_type = 'cosine'; % 'cosine' 'pearson' num_listeners = 100; all_correlations = zeros(num_listeners, 1); % Load speaker data once outside the loop ct_speaker_full = load('cifar100_ss20_ni1e-1_ychen_trail1.mat'); ct_speaker_data_full = struct2array(ct_speaker_full); for listener_i...
c951ed5037c9023947ebb2763382afdacf19bcbd635dec5ef508dc4f8d4e8e46
MATLAB
3,441
118
function varargout = openbci_txt(filename, hdr, begsample, endsample, chanindx) % OPENBCI_TXT reads time series data from a OpenBCI txt file % % Use as % hdr = openbci_txt(filename); % dat = openbci_txt(filename, hdr, begsample, endsample, chanindx); % evt = openbci_txt(filename, hdr); % % See also FT_FILETYPE, ...
71479410389f608b13eeeba8a1cad73bb59cbd0088bbbf2927a991372a8ca8f7
MATLAB
3,443
95
function band_signal = modwt_single_band(data, wavelet_type, level, target_band) % MODWT_SINGLE_BAND - Decompose and reconstruct a single wavelet band % % Convenience wrapper that performs MODWT decomposition and then reconstructs % only the requested band. Optimized for memory efficiency in incremental % band processi...
3d681dc2c2accd88e605de0526ac417f6a730a01ca442d2395a4f53e60f9a001
MATLAB
3,445
97
function M=timewarp(evLatency, newLatency) % TIMEWARP - Given two event marker vectors, computes a matrix % that can be used to warp a time series so that its % evlatencies match newlatencies. Values of the warped % timeserie that falls between two frames in the original %...
ad6b40d5e555a508aaed8b1da4b0752222e9f3b6af82e70435b24fd341745a6a
MATLAB
3,445
95
function fear_getSpindle_spike_PETH(basename) % basename='~/data/Fear/triple/achel180320/achel180320'; load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) load([basicMetaData.Basename '.pfcSpindle.events.mat']) load([basicMetaData.Basename '....
459139ba7a4a5cf2bd03355ae43e420d6be6e9d267d4b57d9e0402d459a29629
MATLAB
3,448
97
function this = MrImageGeometry_load_from_file(this, testFile) % Unit test for MrImageGeometry Constructor from file % % Y = MrUnitTest() % run(Y, 'MrImageGeometry_load_from_file') % % This is a method of class MrUnitTest. % % IN % % OUT % % EXAMPLE % MrImageGeometry_load_from_file % % See also MrUnitTest % Au...
cce8e10b6a6b8d140cdaf3b05da8f95621f6c3aac566c03fdd32d2096a2b331c
MATLAB
3,448
108
% POSACT - Make RUNICA activations all RMS-positive. % Adjust weights and inverse weight matrix accordingly. % % Usage: >> [actout,winvout,weightsout] = posact(data,weights,sphere) % % Inputs: % data = RUNICA input data % weights = RUNICA weights % sphere = RUNICA sphere {default|0 ...
6e08285e9346afcfaecb88ceeb9e0f3f7953d2d8a1ea0e0c0fe74b1d6ad41c68
MATLAB
3,451
114
function Meta_interactive_point_slice_plot(MC_Setup, DB) % Meta_interactive_point_slice_plot(MC_Setup, DB) % % Set up interactive point plotting on slice % % tor wager, nov 2007 % % Simple example for checking points manually, rather than setting up the interactive plotter: % load SETUP % V = DB.mas...
7b2bcef77ef9b2bf7e251c0bbf7f87ec3aa1d55c00430f29f509413da0c5cbfc
MATLAB
3,451
114
clear all spm fmri %% Demo: fMRI searchlights LDA classifier % %To run MVPA with LDA classifier, crossvalidation method % % # For CoSMoMVPA's copyright information and license terms, # % # see the COPYING file distributed with CoSMoMVPA. # clear all; %PILOT sub(1).id = 'sub-01'; sub(1)....
811af9f6ff04fec64ba3a8aa02405e3e3c2ba1630f4f722143d1397dee98eea3
MATLAB
3,452
92
%% h = sepia_handle_panel_qsm_iLSQR(hParent,h,position) % % Input % -------------- % hParent : parent handle of this panel % h : global structure contains all handles % position : position of this panel % % Output % -------------- % h : global structure contains all new and other hand...
d8fa906f2d29e51b9f8a466cb5e4276d46741c386d6569bc11891f86d4ae33a7
MATLAB
3,453
117
function fear_coact_within_oscillation(basename,varargin) % basename='~/data/Fear/triple/hoegaarden181115/hoegaarden181115'; %% load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) %% param.templateSes=2; param.targetHC=3; param.tRange=0.1; par...
0cbb356c1f6028ed95bd1be1e9089138f8deb59f78b72c4126d142e9b912ee52
MATLAB
3,454
98
function tapas_hgf_whatworld_plotTraj(r) % Plots trajectories estimated by fitModel for the hfg perceptual model % Usage: est = tapas_fitModel(responses, inputs); tapas_hgf_plotTraj(est); % % -------------------------------------------------------------------------------------------------- % Copyright (C) 2013 Christo...
bc48e0c24e91d29990062f4ad7153da0201308eaf8ace5d334af266a99cee1e2
MATLAB
3,454
87
function [t, wv] = LoadTT_openephys(fn,records_to_get,record_units) %LOADTT_OPENEPHYS MClust loading engine for open ephys data. % LOADTT_OPENEPHYS loads open ephys data and fullfils all requirement for % MClust loading engines (see MClust 3.5 documentation for details on % MClust loading engines). % % Syntax...
c65a22ce11fe3eb132a299f7709e085b0f0778ffb0c7e483ea102732b9fa0f93
MATLAB
3,455
112
function [xvec, hmat, alignspikes] = alignSpikes(spiketimes, cond, wndw,... bins, alignto,trialend) %This function takes spiketimes and aligns them to the event (cpoke, %reward, opt out, etc) specified by alignto. Timestamps are according to %open ephys computer clock. cond is the condition found in %behEvents (hi...
11aa454d3d36efe2b5cccc1ccee0c321f2d5bd81a195a2d2c7ddef3633faf31e
MATLAB
3,456
94
function this = compute_masks(this) % Segments defined input image into tissue types & thresholds to get masks % - input image can be anatomical or mean functional % % Y = MrSeries() % Y.compute_masks(inputs) % % This is a method of class MrSeries. % % IN % parameters.compute_masks. % nameInputImage...
8830e99af52d69c0b0ebb3f174503c8172d910632cee5856ddb75d394e89784f
MATLAB
3,457
96
function c = tapas_rw_binary_dual_config %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Contains the configuration for the Rescorla-Wagner (RW) learning model for binary inputs and dual % updating. % % The RW model was introduced in : % % Rescorla, R. A., and Wa...
ad2084cda6425df2e03cf19a4d7c0c688edfc81a11299a4db6180fd3fcdf7d20
MATLAB
3,457
80
%% PlotRepresentativeBehaviorData %% Version1 TANK_location = 'F:\LobsterData\#21JAN5-210716-170133_PL'; dat = BehavDataParser(TANK_location); figure('Position', [-1558, 655, 990, 254]); plot([]); hold on; startTrial = 12; numTrial = 3; for trial = startTrial : startTrial + numTrial -1 line([diff(dat{trial, 1}), ...
b96a6d656067491ba6c43242c6aa220b2fea565297dbb1f0779e71eb0097585f
MATLAB
3,457
131
%%%%% FIRST, DEFINE V1-hV4 % define zz = 1; subjid = sprintf('subj%02d',zz); % which subject cmap = jet(256); % colormap for ROIs rng = [0 7]; % should be [0 N] where N is the max ROI index roilabels = {'V1v' 'V1d' 'V2v' 'V2d' 'V3v' 'V3d' 'hV4'}; % 1 x N cell vector of strings prfang = {mod(180-cvnloadm...
258380d9b916719528b13eea65b5df28c29fd24ca34ebcbf6aefdbbb84b9ad98
MATLAB
3,459
101
function c = tapas_sutton_k1_binary_config %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Contains the configuration for the Rescorla-Wagner (RW) learning model for binary inputs. % % The RW model was introduced in : % % Rescorla, R. A., and Wagner, A. R. (1972)...
637d330a418e96a174ce5cdeac92f8e3cc8c8b2bd53bada4a40826dcc2a49cc0
MATLAB
3,459
90
function [Ax] = QSM_gradRegul(X_vector,params_in,tflag) % X_vector = vectorized Matrix of x (susceptibility in the case where the direct ) % % params_in has the following fields % kernel - k-space representation of Dipole Kernel % msk = mask represent the regions where % dims = 3d-dimension of the field map % Ex,Ey,Ez ...
fc8c2d1a1c0a9b9f3e750af04b4d081cd848247336f80bd5bb0371dc06bac3ca
MATLAB
3,460
116
function status = makessense(data, field) % MAKESSENSE determines whether a some specific fields in a FieldTrip data structure % make sense. % % Use as % status = makessense(data, field) % % See also GETDIMORD, GETDIMSIZ, GETDATFIELD % Copyright (C) 2018-2019, Robert Oostenveld % % This file is part of FieldTrip, s...
0922c4e5e897b60f6510a519b4678b9e4bc4cdd5b279f66b132c88cdc111b051
MATLAB
3,461
133
%% stats %% visDir [h1,p1]=ttest(visDir_lS1,0.5); [h2,p2]=ttest(visDir_lPC,0.5); [h3,p3]=ttest(visDir_rPC,0.5); [h4,p4]=ttest(visDir_lMTt,0.5); [h5,p5]=ttest(visDir_rMTt,0.5); [h6,p6]=ttest(visDir_lhMT,0.5); [h7,p7]=ttest(visDir_rhMT,0.5); stats.h=[h1,h2,h3,h4,h5,h6,h7] stats.p=[p1,p2,p3,p4,p5,p6,p7] % bonnstats.p=...
a8d302bf95c54a1667c85c6e2aa4baa56017462ffb66a5cb0676986035c2c3fd
MATLAB
3,461
94
function out = muscimolPhysiology(muscimolPhysDataPath) %Analyze firing rates pre and post muscimol infusion. Rat was anesthetized %for the entire recording. Bilateral infusions and recordings. % INPUTS: % muscimolPhysDataPath = path to .mat file with recording data and % spreadsheet with infusion info % OU...
7a08bdc9e37313e61bf7eaf1618a51f799e7d76949d189be743c1c8f74c5ba3e
MATLAB
3,462
113
%% ------------------------------------------------------------------------ % Texture and Fractal Feature Extraction % ------------------------------------------------------------------------ % Features: % - GLCM-based: % 1) Mean Correlation (offset-dependent) (17th offset) % 2) Variance Range (a...
7df0d8cf1ea9f870d69e3528ae28b631734544936b0940ab56fcf09388d5cfab
MATLAB
3,462
99
function esmType = getChannelType_ESM(chStruct_H) % returns string of catted ESM categories (e.g. 'motor') based on ESM label % ESM = electrical stimulation mapping % category = higher order of abstraction that ESM label % categories may overlap (-> esmType is catted into 1 string) % chStruct_H = channel structure in H...
2727e844727484684b4a040410d8142328c8dba5ee02b5824ed05c2418dc77b2
MATLAB
3,463
75
function h=subtightplot(m,n,p,gap,marg_h,marg_w,varargin) %function h=subtightplot(m,n,p,gap,marg_h,marg_w,varargin) % % Functional purpose: A wrapper function for Matlab function subplot. Adds the ability to define the gap between % neighbouring subplots. Unfotrtunately Matlab subplot function lacks this functionality...
836efd84b943803d6d56a80bb240f871a844e496ef3159a95cc358d26c0f5de3
MATLAB
3,464
100
function out = SY_RangeEvolve(y) % SY_RangeEvolve How the time-series range changes across time. % % Measures of the range of the time series as a function of time, % i.e., range(x_{1:i}) for i = 1, 2, ..., N, where N is the length of the time % series. % % ---INPUT: % y, the time series % % ---OUTPUTS: based on the...
29d3e7f086b141c8835a29ac0e00554bc1d25998cc4eb9ee366d20c14c088ad1
MATLAB
3,465
74
function [regressorScans,regressorNames] = create_fMRIregressors(tau, data, R, initialISIandSetup) % an extract of fit_happy_model_nogain_guiltenvy(mtx,happyscore,constant) % without fitting if ~exist('tau','var'); load('js_temp.mat'); end if ~exist('tau','var'); initialISIandSetup = [3 3]; end plotFlag = 0; %needs ...
416c3a8e222fb60d3e75f29655f2cc9c531ac3e73dc91113ee64318e76f05b4c
MATLAB
3,465
92
% PCSQUASH - compress data using Principal Component Analysis (PCA) % into a principal component subspace. To project back % into the original channel space, use PCEXPAND % % Usage: % >> [eigenvectors,eigenvalues] = pcsquash(data,ncomps); % >> [eigenvectors,eigenvalues,compres...
a9b5db080e55f9ad493e77b59980ec1097ba1a623319d762ce9751e2b25804d3
MATLAB
3,465
85
function plot(spikeStream, cfg, varargin) % Plot the contents of a McsCmosSpikeStream object % % function plot(str, cfg, varargin) % % Shows a raster plot of the spike timestamps. If only a single channel is % selected, produces an overlay of the spike cutouts for this channel. % % Input: % % spikeStream ...
1064dcf7761d5f5835b75e46b31ca40351c99289e575a1e2050d20c67c28fcd8
MATLAB
3,467
84
function ProcessData_Figure6(datadir, codedir, savedir) %ProcessData_Figure6 - Process raw data saved under datadir such that it can be plotted by PlotFigure6. % INPUTS: % datadir - Local directory where 'Golden_Nature/RawData_Figure6.mat' from Zenodo was saved % codedir - Local directory where code (e.g., publishe...
6394853fe18bc0b875920f464267408f5d3080f4309d15fb98adb272e293521a
MATLAB
3,469
100
function param = neuronConstants() %NEURONCONSTANTS One-stop constants for the two-layer visual cortex model. % Syntax % P = neuronConstants(); % % Description % Returns a struct P with fields describing geometry, neuron counts, % V1 (input) statistics, and V4/MT (recurrent spiking) connectivity and % synaptic...
6ebd58bef953e6ff3cb2eadd0a704ff6b7b7ad51e94407effa41bbb2d2e702e4
MATLAB
3,469
101
% EEGLAB_EXECMENU - function called to execute EEGLAB menu % % Usage: % eeglab_execmenu(label, func, parameter); % % Inputs: % label - [string] label of the menu % func - [string] name of the pop function. The function extract the % callback from the menu, find the function and add the % ...
4d16e36d7c32dc7f2419e9b7cf0f047c3ca33fc9422fd4831c05d5737698c7f3
MATLAB
3,470
106
function [SH3D,Residuals,b] = spherical_harmonic_shimming_option2(img,mask,order) dim = size(img); %% for volume fitting % find non-zero elements Indices = find(mask(:,:,:)); % get Cartesian coordinate of the non-zero elements [x1,y1,z1] = ind2sub(size(img(:,:,:)),Indices); % solutions of the linear operation R = img...
b1414de110b2e1294b550b9fb5ac47fc6ead12af4d4b079a6bc50fe12cb2c870
MATLAB
3,470
74
function preprocess_nsd_MNIandbrainmask(subjix) % function preprocess_nsd_MNIandbrainmask(subjix) % % <subjix> is 1-8 % % Starting with the prepared 1.0-mm T1, determine MNI alignment using fnirt. % On basis of the determined alignment, we backproject to the native subject space % a liberal 1.0-mm brain mask. We also ...
3f0e887702d6eaf9fdda536fa80e350b6da4b114bb146f4f99728b07b459d5d5
MATLAB
3,471
115
function vol = read_asa_vol(fn) % READ_ASA_VOL reads an ASA volume conductor file % % all data is converted to the following units % vertices mm % conductivities S/m % Copyright (C) 2002, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and...
cbf2925f08745fadbbccaf054904df08afc808927d0c8708bc3c428ad43f652b
MATLAB
3,472
77
% demonstrate usage of prior distributions % % See also priorDistributions.m. % % Copyright (c) by Carl Edward Rasmussen and Hannes Nickisch, 2022-04-04. % File automatically generated using noweb. clear all, close all % 1) specify some priors % a) univariate priors mu = 1.0; s2 = ...
73af41d90a406b09752ed0a6932be026af13fa2566a6b1f736cfd0db9932f4d7
MATLAB
3,473
96
% EEG_RETRIEVE - Retrieve an EEG dataset from the variable % containing all datasets (standard: ALLEEG). % % Usage: >> EEG = eeg_retrieve( ALLEEG, index ); % % Inputs: % ALLEEG - variable containing all datasets % index - index of the dataset to retrieve % % Outputs: % EEG - outpu...
893cf5f6406d1daa7ff04c5446218c6b4bb6b59159f5e1ab068f592f3e618537
MATLAB
3,473
87
function [cpulse, verbose] = tapas_physio_get_cardiac_pulses_manual_template(... c, t, pulse_detect_options, verbose) % Detects R-peaks via matched-filter smoothing & peak detection using a % manually defined QRS-wave (or R-peak environment) % % [cpulse, verbose] = tapas_physio_get_cardiac_pulses_manual_template(...
ca8e4ea11cc9eb84c267145e31d6c15cdef6381d9c059538b5b61a1dc12d8dbc
MATLAB
3,473
118
function [err,S] = HistoryTrace ( Opt) % % [err,S] = HistoryTrace (Opt) % %Purpose: % returns a signature/history sting, useful for keeping a log % % The trace string is formed as such % For example if script MainScript calls at line 12 % function F1 which at line 6 calls F2 wich at line 192 calls %...
772eaf4e4e79dfe1f945127dc6920d42b0770b49796c3f4df70349916cf43bc4
MATLAB
3,474
104
function [source] = fixinside(source, target) % FIXINSIDE ensures that the region of interest (which is indicated by the % field "inside") is consistently defined for source structures and volume % structures. Furthermore, it solves backward compatibility problems. % % Use as % [source] = fixinside(source, 'logical'...
b0b6977bf24d52174fde8385e2ded07e237b02fdfa059e006e884ad8d859f3e1
MATLAB
3,476
102
% clc % clear %-------------------------------------------------------------------------- spm('defaults','EEG'); % Data and analysis directories %-------------------------------------------------------------------------- Pdata = fullfile(Pbase, ['models' filesep 'DMN']); Panalysis = fullfile(Pbase, ['...
5396286dd5d2c87f806c65af433b5f7e379aadc2677fab6da84625f7e2caff85
MATLAB
3,477
101
function params = validateField(params, fieldName, defaultValue, dataType) % VALIDATEFIELD Validate and set default values for structure fields % % Syntax: % params = validateField(params, fieldName, defaultValue) % params = validateField(params, fieldName, defaultValue, dataType) % % Description: % Valid...
0034aac9d6796126ab705c44097c81fb65168e1ac366a8849cd992deec2b8ae3
MATLAB
3,478
87
%% Wrapper_SWISMWI_SMWI(headerAndExtraData,output_structure,algorParam) % % Input % -------------- % headerAndExtraData : structure contains extra header info/data for the algorithm % output_structure : structure contains output file path and output NIfTI header % algorParam : structure contains fields with a...
484b81c23992a955cc40ca16aab598dedaac860574dfa5092f6d81684dbed73f
MATLAB
3,481
94
function [H, basis] = hessianmatrix(problem, x, basis) % Computes a matrix which represents the Hessian in some tangent basis. % % [H, basis] = hessianmatrix(problem, x) % [H, basis] = hessianmatrix(problem, x, basis) % % problem is a Manopt problem structure with a manifold and cost function. % x is a point on the man...
69164bb1ed2123eb9d900a79fed59bde54de03a396eb23f0e9228ef8cdb6c70f
MATLAB
3,481
88
function [varargout] = likGauss(hyp, y, mu, s2, inf, i) % likGauss - Gaussian likelihood function for regression. The expression for the % likelihood is % likGauss(t) = exp(-(t-y)^2/2*sn^2) / sqrt(2*pi*sn^2), % where y is the mean and sn is the standard deviation. % % The hyperparameters are: % % hyp = [ log(sn) ...
c5b92aab5108cbe9a23ab75a1c4b148e041480f9bce91de27ac8a4959f1671a2
MATLAB
3,482
114
function [response, x, s, f, v, q] = tapas_huge_bold( A, B, C, D, tau, ... kappa, epsilon, R, u, L, E_0, r_0, V_0, vartheta_0, alpha, gamma, TR, ... TE, dt) % Integrates the DCM forward equations to generate the predicted fMRI bold % time series. % % INPUTS: % A, B, C, D - DCM connectivity matrices. % tau ...
00276225329ecad65da09f4b9c8ef0648539c11b81b218b78d8e954b2f082bdb
MATLAB
3,483
75
% eegplugin_eegbids() - EEGLAB plugin for importing data saved % by the finders course (Matlab converted) % % Usage: % >> eegplugin_eegbids(fig, trystrs, catchstrs); % % Inputs: % fig - [integer] EEGLAB figure % trystrs - [struct] "try" strings for menu callbacks. % catchstrs - [struct] ...
382fef5a1c08032a0b7bf15a0ea7eed9465b789b21146619f523ea526a34ffd0
MATLAB
3,483
116
function [sel1, sel2] = match_str(a, b, fullout) % MATCH_STR looks for matching labels in two lists of strings % and returns the indices into both the 1st and 2nd list of the matches. % They will be ordered according to the first input argument. % % Use as % [sel1, sel2] = match_str(strlist1, strlist2) % % The strin...
39cb98e3a72a7ededd3fbc4588026daedfdb5a5ee1724a73e7c98e32f76ce6f1
MATLAB
3,483
103
function [pdd, pddnode, meanpdd] = dyn_pdd_pleakage(data,sample,mindur,meanfreq) % Computes the phase difference derivative (PDD) wit pairwise % leakage correction/pairwise orthogonalisation % % Tewarie et al., 2019 Tracking dynamic brain networks using high temporal % resolution MEG measures of f...
8c85e39e5e2ccaf44766571b1f0bb0a9fc5afa601e607b3eb1f7c3ab5c656e0e
MATLAB
3,484
106
function [ u ] = tapas_huge_boxcar( dt, nBoxes, period, onRatio, padding ) % Generate a boxcar function for use as experimental stimulus. All % timing-related arguments must be specified in seconds. % % INPUTS: % dt - Numeric scalar indicating sampling time interval. % nBoxes - Vector indicating number of b...
c71c01bfe2307f3d5e230df2da3e5c279c6fe5a74ad92500f1f2afb184a52a55
MATLAB
3,484
103
function [Dat,stim,ops] = parse_stimuli_wrapper(ops) %decides which parse_stimuli function to use. alters stim for CPD calc. % % inputs: ops.stimwrapper decides which function to use % % switch ops.stimwrapper case 'ofc' %[stim_train,stim_test] = parse_stimuli_ofc(ops); if ops.usePseudotrial [Dat,stim]...
43c605e50db27891c19684257c9e99b8f2ef13a910856a1e49e0280872781fea
MATLAB
3,485
84
function l = IsFirstAfter(timestamps,list,varargin) %IsFirstAfter - Identify first item after each of a list of timestamps. % % For each element i of a list of test timestamps, find in a list of reference timestamps % the first element j larger than i. Returns a list of logical indices (the elements of the % test list...
a1ef596ad75d320ddcdcf1ef55caa863c7a48e4a74fa21c14fa1a527ba56167c
MATLAB
3,485
115
clc; clear; addpath('/cbica/home/lihon/code/Download/cifti-matlab-master'); res_dir = '/cbica/home/lihon/comp_space_recover/ABCD_comp/dl_prediction/pred_res_cog_abcc_bl_cv/non_dl_pnc_res'; dat_dir = '/cbica/home/lihon/comp_space_recover/ABCD_comp/dl_prediction/data_cog_pnc_cv'; num_r = 400; ro_covars = 1; out_dir...
8fbfdccc0aedcde16eefac60e3d5dfdb815fc48e6e672d0ff29de8d7a383825e
MATLAB
3,488
84
function l = IsLastBefore(timestamps,list,varargin) %IsLastBefore - Identify last item before each of a list of timestamps. % % For each element i of a list of test timestamps, find in a list of reference timestamps % the last element j smaller than i. Returns a list of logical indices (the elements of the % test list...
6fcb70cc6f0c7526c17a5c0ac2e8b227653df813ec25daa460b8a281f8527e65
MATLAB
3,489
101
function organiseTsvOnset % it is a mini function to % to change the onsets in the tactile tasks. deleteSuffix = 1; % add bids repo bidsPath = '/Users/shahzad/GitHubCodes/CPP_BIDS'; addpath(genpath(fullfile(bidsPath,'src'))); addpath(genpath(fullfile(bidsPath,'lib'))); % raw data path rawDir=fullf...
795e61b28fc88ceefa191f4091760a794f1e2fa3955750dbe4f709f4075ae097
MATLAB
3,489
99
% This function loads a single file and gathers all of the needed % information. fOutID should be the output file handle from % main_diagnostics. singleSetFile should reflect its name. function single_spect_diag(singleSetFile) % Storing what's going to be written to the csv in a variable to act as % Load: ...
9105fc9f5914aecd02bab799af2fe9f8ab07092803ffc151c4157248b1a610e1
MATLAB
3,490
69
clc; clear all; % This code calculate the vertex-level MFC/gMFC/sMFC for the demo dHCP subject(ID:sub-CC00056XX07 ses-10700) % The program includes calculating of FC, gMC, sMC, MFC, gMFC and sMFC, and visualization of brain map your_path = './data'; % Please set your file storage path load './data/Label_7net_5k.mat' ...
946cc9e75aca28257879615d8ce9eec836d5b74e471e8f31dee07665bd5c104d
MATLAB
3,491
85
function [infos, auxillary_toolboxes] = tapas_get_toolbox_infos() % Function storing information regarding toolboxes. % % Each toolbox is represented by a field with its lower-case-name. % The field has the following subfields: % init_function [character vector] % If specified, use that function to ...
836d3212f03fa186c2963142e4e8346e360aaff62c6392087eda07934f931414
MATLAB
3,492
99
% POP_REJEPOCH - Reject pre-labeled trials in a EEG dataset. % Ask for confirmation and accept the rejection % % Usage: % >> OUTEEG = pop_rejepoch( INEEG, trialrej, confirm) % % Inputs: % INEEG - Input dataset % trialrej - Array of 0s and 1s (depicting rejected trials) (size is % ...
a9a746db8e2a0ffae7febab81419eab0d823b9464256fc4d48f34b26f80dfcc7
MATLAB
3,493
108
function [A] = tapas_uniqc_spm_matrix(P, order) % Return an affine transformation matrix % copy of spm_matrix from Version 6906 (SPM12) 20-Oct-16 % FORMAT [A] = spm_matrix(P [,order]) % P(1) - x translation % P(2) - y translation % P(3) - z translation % P(4) - x rotation about - {pitch} (radians) % P(5) - y rotat...
2eac7761b6f0f4f43b3ba80632a6ccaf4fe2cccb235f75981cf33bd7fe9f86c6
MATLAB
3,494
101
function [inargs,outargs,h1] = hlp_inoutargs(filename,funcname) % Retrieve the names of input/output arguments of the given m file. % [In-Args,Out-Args,H1-Line] = hlp_inoutargs(Filename,Function-Name) % % In: % Filename : full path to an m-file % Function-Name : optional, name of a (possibly nested) functi...
5aca189fa3871115a7cc98b95a7708d290ada377eb20aeacb4c787daa3bcc2de
MATLAB
3,494
85
% STD_PRECOMP_WORKER - allow dispatching ERSP to be computed in parallel % on a given cluster. % Usage: % >> feature = std_precomp_worker(filename, varargin); % % Inputs: % filename - STUDY file name % % Optional inputs: % Optional inputs are the same as for the std_precomp function. Note...
ab9f98fafa9920b4ce4f601ca77b7a47bdcebaf2218519b40a8c9724860e4018
MATLAB
3,494
109
function [results] = bias_analysis(config) % Evaluates the bias in psi / mutual information estimates of the % populations evolved in analysis01A and plots results. % Fix cpu limit (relevant for cluster), and seed maxNumCompThreads(config.cpu_limit); rng(0); % load evolved populations populations = loadPopulations();...
b7024dbacc44229495ac08c2e2581531065c0a0c83a3f6a43bd21035b052346d
MATLAB
3,497
94
function nirs = fieldtrip2homer(data, varargin) % FIELDTRIP2HOMER converts a continuous raw data structure from FieldTrip format to % Homer format. % % Use as % nirs = fieldtrip2homer(data, ...) % where the input data structure is formatted according to the output of % FT_PREPROCESSING and the output nirs structure ...
46a81728dd41386ee0aa84a8c7a025b5a2585d409d57c23fb2195e195701361d
MATLAB
3,498
144
function movie_in = sh_denoising(movie_in, options) % update the movie in place to save the memory windowsize = options.windowsize; [m,n,p]=size(movie_in); startno = 1:windowsize:p; tau = 0.015; % why? lambda =20/sqrt(m*n); % why? rank = 10; % why jsut the 10 first components? tic; for i=1:numel(startno) disp([...
604d75ce84368de1c5c1e6f0d2adab38eea22b18ef0787d3a721f8d7a1444065
MATLAB
3,498
123
function run_permuanova2_examples %RUN_PERMUANOVA2_EXAMPLES Run permutation two-way ANOVA examples. % Generates random data for 5 groups along the columns of X and 3 groups % along the rows of X, each with 2 replicates. Each group has a mean % value of 0, except for the first two columns which have a mean value ...
28813126d5f1e3c8afdd0144b299fab25fc33becb16d544d71c6201fbe36c6df
MATLAB
3,501
91
load bs_results.mat load Hippo_data_ASB_norm.mat load cm17.mat load dk_labels.mat load power_data.mat % lmedata = removevars(lmedata, {'age','CDR','MMSE','ZPHG'}); pa=["Amplitude", "Phase"]; sides=["L", "R", "L+R"]; for PhaseAmplitude=["0","1"] dataPA = lmedata(lmedata.PhaseAmplitude == PhaseAmplitude,:); f...
eb10d03eb999121e0111f12b2b6df23dc9571a5869e4c8894604fab33644886d
MATLAB
3,501
114
%% Methods parameters pars.sr = 1; % Hz pars.bin = 0.02; % seconds pars.dc = 0.01; % cut-off for distances pars.ishalo = 1; % not using halo refinement of the clusters pars.npcs = 5; pars.maxmem = 8*10^9; % maximal Gb of RAM pars.minspk = 3; % minimum 3 spikes per pattern pars.nsur = 10; % surrogates for core-cells, s...
8c99275968fdb287a768e7d2b9a7bdcbf0c0f3720b3494a674f08df97be11260
MATLAB
3,502
120
function [R, M, config] = loadData(mouseName, sessionDate, prefix, suffix, folder, verbose) % loadData Load an R/M neural-behavior dataset given identifying info. % % Inputs: % mouseName - animal ID string % sessionDate - date string (YYMMDD) % prefix - file prefix (default 'R') % suffix - fil...
506449a9d2a2c7c5a297ad045d8e144ac94ec6e35ce6cf1c68e4b2b89c7f6542
MATLAB
3,503
92
function MRSCont = osp_senseRecon(MRSCont) %% MRS_struct = osp_senseRecon(MRS_struct) % Loads complex coil sensitivity reference scans, converts them into % NIfTI format, co-registers with MRS voxels, and determines complex coil % sensitivities following the SENSE formalism. % % This is usually only used to rec...
e132e787d65537d6378edc50bf8969630f4d74caf55f389942da8a8f3cec00a6
MATLAB
3,503
93
function [refShift, refFWHM, refSinglets] = osp_PhantomReferencing(dataToFit) %% [refShift, refFWHM] = osp_PhantomReferencing(dataToFit) % Identify appropriate reference signals then derive reference shift % accordingly, using the osp_XReferencing implementation. % % Handles three possible phantom scenarios: % % ...
e35d6fa44ea2b81bd5f421346a661bf253d03adadad6c4fdee655e4acc96961c
MATLAB
3,505
103
function plotSkeletonEulerAngles(data, tPt, plotParams, view) % Plots a single time point posture and annotates the angles around which % we computed the major joint angles (mostly proximal due to over clutter % if all are plotted) % Figure fig; hA = gca; axis off axis equal hold on; set(gca,'View', view); hA.ZLim = [...
fba02ffa596e325d610adb3725deb74506f5bf34571e31f26b5f605df8ba7435
MATLAB
3,505
110
function ah = add_panel_title(text1,text2,varargin) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% ################################################################# %% DESCRIPTION %FUNCTION short desc. % % USAGE: % out = template(in) process with default settings % % out...
2068ab0e0f90539b7da297c87009d4e5afec97a13185cad41d11f37f69072126
MATLAB
3,506
107
function [cost, grad] = getCostGrad(problem, x, storedb, key) % Computes the cost function and the gradient at x in one call if possible. % % function [cost, grad] = getCostGrad(problem, x) % function [cost, grad] = getCostGrad(problem, x, storedb) % function [cost, grad] = getCostGrad(problem, x, storedb, key) % % Ret...
b4f39148a383c76f292ec4b982c39dd8b54b8dfbc30c5cae80fc6fdb95ce1555
MATLAB
3,507
77
function osp_updatemeanOvWindow(gui) %% osp_updatemeanOvWindow % This function updates the mean spectra overview tab. % % % USAGE: % osp_updatemeanOvWindow(gui); % % INPUT: % gui = gui class containing all handles and the MRSCont % % % AUTHORS: % Dr. Helge Zoellner (Joh...
48bd8ebf2dae0c2735a31d16d89b57cc7c8b80bed3abae9a3e40786a5194aef9
MATLAB
3,509
89
function arg = ptparsevarargin(varargin) %PTPARSEVARARGIN Parse input arguments of PERMUTOOLS functions. % [PARAM1,PARAM2,...] = PTPARSEVARARGIN('PARAM1',VAL1,'PARAM2',VAL2,...) % parses the input arguments of the main PERMUTOOLS functions. % % See also PTVALIDATEPARAMIN. % % PERMUTOOLS https://github.com/mick...
d6a8f3627c19649e39a866ff910510c4405f3fa9ed9d6dcf6690ede48b479bd4
MATLAB
3,509
81
% This function loads all .ctr files in a user-selected directory into a DATA array % Additional comments added by WF 8/7/2022 to help us newbies function ARTwarp_Load_Data(is_cli_mode, input_folder) global DATA numSamples tempres % user selects folder that contains .ctr files and changes the active % directory to...
49cd76a5416f0d9c72891bce1077041ea6b46facd4c9713d7ff50aeed0e14578
MATLAB
3,510
106
function [oo,ooo] = meansembar(varargin) % function hh = meansembar(varargin) % does barplots with SEM of input matrix. % % INPUTS % if one input: the data. That's the minimum input, rest is optional. % if >1: % input 1: the x positions of the bars or sets of bars % input 2: the data matrix (1 to 3 dimensions, seco...
232d12b90614c108141aeca23535775acf844ef8136f19aa8b2d67bb1a9541e2
MATLAB
3,512
164
function Pipeline_registerStack(params) % This function performs motion correction on in vivo images by performing % image registration analysisDir = getAnalysisDir(params); ExpInfoFn = getFileName(params, 'ExpInfo'); load(fullfile(analysisDir, ExpInfoFn)); for i = 1:numel(fn.si) imfn = fullfile(fn.pth, fn....
4bbd4cdfea8f3dfa54facf9ba435c5c15a08a707f898ba69f0c0f0f4538160ca
MATLAB
3,512
115
function plotStack(obj,key) channel = 'ch2'; global ind global data global pointi global isAOD name = fetch1( Experiments*Scans(key),'file_name' ); isAOD =strcmp(fetch1(Scans(key),'scan_prog'),'AOD'); if isAOD if ~strcmp(fetch1(Scans(key),'aim'),'stack') display('Detecting volume..') u_ind = str...
5f3e957b74ae876bc4ac6c2197ecc029e89b73db5c23bf97b601be4990d4d771
MATLAB
3,513
112
function linidxsrs=surfing_coords2linvoxelidxs(coords,voldef,dim,mask) % maps coordinates to linear voxel indices % % I=SURFING_COORDS2VOXELIDXS(C,VOLDEF) % INPUTS: % C: A 3xN matrix or 3xPxQ array with (x,y,z) coordinates % VOLDEF: Struct with fields .mat (4x4 voxel to coordinate transformation matrix % ...
7247b68b17e64a4f658cc142139c05c1568bbc47500ebe1e6d1543df280c16e4
MATLAB
3,513
107
function [P,Z,order]=hcluster(D,link) %function [P,Z,order] = hcluster(D,link) % %PURPOSE % %To perform a hierarchical agglomerative clustering on a distance %matrix. Returns partition vectors for each level of the clustering %hierarchy and information for visualizing the clustering hierarchy %as a dendrogram. % %INPU...
88d979596b3c504230292d6866482532154491d9227831b1dfe97b1a2938be8c
MATLAB
3,513
97
function FCAsymIndex % path = '/mnt/NCPL09/TMSRobustArticle/CBTRTData/FunImgARTCSFW' % outdir = '/mnt/NCPL09/TMSRobustArticle/CBTRTData/CFHReliability/' rThr = 0.25 ; path=uigetdir; outdir=uigetdir; [TMSPath, fileN, extn] = fileparts(which('TMStarget.m')) ; maskdir = [TMSPath, filesep, 'mask', filesep, 'GreyMask20BG...
83f6186fd38c0593254edbedd1d3899fe6ba792278c2b4339c4704c06d56ce80
MATLAB
3,514
109
function batchResultsFolder = run_QAMPER_IVIM(img_nii,bval_file,roi_nii,save_folder,optionS) % function batchResultsFolder = run_QAMPER_IVIM(img_nii,bval_file,roi_nii,save_folder,optionS) % Inputs: image_nii (char): path to 4-D NIfTI DWI volume with all b-values % bval_file (char): path to .bval te...
1edbf81914d059923dcdd3d638c913710d215d5970e552aa8061bcb8d86789b3
MATLAB
3,515
101
% fastregress - perform fast regression and return p-value % % Usage: % [ypred, alpha, rsq, slope, intercept] = fastregress(x, y); % [ypred, alpha, rsq, slope, intercept] = fastregress(x, y, plotflag, plotleg); % % Inputs % y - y values % x - x values % plotflag - [0|1] plot regression and legend. Default 0. % plot...
19eccfcd01d32056fa6d631966166f35742e09613500463911fbf994b88fec17
MATLAB
3,516
90
function result = TS_GetFromData(dataSource,dataField) % TS_GetFromData Load a given field from either a data file, or data structure % (loaded from file). % %---INPUTS: % dataSource: either a .mat filename or a structure generated from loading an % HCTSA file, e.g., % da...
21d63a3df161ec4ff25fdbf6f983cea1109f146ff312982c496626fa581810ae
MATLAB
3,516
101
function [nt2, Phi, lambda, omega, time_dynamics, X_dmd, Cv] = DMD_exact(X, dt, p, tde, r, var) % DMD_EXACT Exact (or standard) Dynamic Mode Decomposition with optional % time-delay embedding. % % [nt2, Phi, lambda, omega, time_dynamics, X_dmd, Cv] = ... % DMD_exact(X, dt, p, tde, r, var) % % Inpu...
94026f8f1153919b4b7abebca3f374f8510a766d20c71f9fe6ae068863c4d5b3
MATLAB
3,516
131
function [header,m,channels] = MEA_load_bin(binfile,plt, convertOption) % Convert bin files to mat files for MEA data % This function takes txt file output from MC_Datatool (Multichannel % Systems) and converts it into a matlab matrix. % Parameters % ----------- % binfile : str % path to the bin file to be conve...
39df0d3c264059829d42ff67fbfa47bdca629fd32161841ed2392eb2603d6568
MATLAB
3,517
114
function [outmap, cfg] = nmri_interpolate_map(cfg,inmap) %[outmap, cfg] = nmri_interpolate_map(cfg,inmap) % % cfg = config struct % .layout = fieldtrip layout to use a reference % .neigh = fieldtrip neighbourhood structure (will auto-determine % if not set) % .dist ...
7796e1acd60a1c47a7faf45811b0efaf66a053458e1af3a9c8d275599c03abf3
MATLAB
3,517
89
function imageCombined = combine(this, varargin) % Combines multiple MrImages into a single one along specified % dimensions. Basically MrDataNd.combine with additional % affineTransformation-check % % Y = MrImage() % imageCombined = Y.combine(imageArray, combineDims, tolerance) % % This is a method of class MrImag...
a6d0db64adc57c124e93868b7b9b1e00fbb21b9d1cfa198d936f138ad048f976
MATLAB
3,517
118
function fear_icaReac(basename,varargin) % method used in % Lopes-dos-Santos et al., 2013 J Neurosci Methods % Trouche et al., 2016 Nat Neurosci % Giri et al., 2019 J Neurosci % basename='~/data/Fear/triple/karmeliet190901/karmeliet190901'; load([basename '.basicMetadata.mat']) fprintf('%s start %s with data of ...
08c6b985e3fe3ced82d62fb961f59c3c98fc1e688b2cc4d3bc3dc6d621d0af05
MATLAB
3,519
88
% GETIPSPH - Compute "in place" (m by n) sphering or quasi-sphering matrix for an (n by t) % input data matrix. Quasi-sphering reduces dimensionality of the data, while % maintaining approximately the "original" positions of the axes. That is, % quasi-sphering "rotates back" as ...
2fcf943400ef0a519859e303735bd548b097cdc35aa51625d917b45651164bdc
MATLAB
3,519
93
%% plot values (SNR, DA) of different anatomical areas % from different: % - neuronal features (data_info.neurVars) % - kinematic variables (data_info.trajVars) % - subjects (subjList) % (c) Jiri, Jun17 %% settings: SNR pathBeg = 'G:\dox\proj_carGameAnalysis\data\kinVars_tuning'; figDir = 'G:\dox\proj_carGameAnalysi...
72e274ce136066280375379cf7162c80b3aa8113e20545a352a7e1bc728c6514
MATLAB
3,519
101
function output_txt = BrainNet_Output_txt(obj,event_obj) % Display the position of the data cursor % obj Currently not used (empty) % event_obj Handle to event object % output_txt Data cursor text string (string or cell array of strings). pos = get(event_obj,'Position'); output_txt = {['X: ',num2str(pos(...
a6c17d9a0a7e16fd258731b9a316e8e2f886d7c34f7cde2de76bc8794c59aaf9
MATLAB
3,520
151
function M = spheresymmetricfactory(n) % Returns a manifold struct to optimize over unit-norm symmetric matrices. % % function M = spheresymmetricfactory(n) % % Manifold of n-by-n real symmetric matrices of unit Frobenius norm. % The metric is such that the sphere is a Riemannian submanifold of the % space of nxn symme...
31bb713a2087153ae59818bdbdc2eb9101d9aa6547fd8a9e54b8ab748f129f29
MATLAB
3,522
81
function [b,r,SSE,SSR, T, TF_ForContrast] = TMSregression(y,X,Contrast,TF_Flag) % [b,r,SSE,SSR, T, TF_ForContrast] = y_regress_ss(y,X,Contrast,TF_Flag) % Perform regression. % Revised from MATLAB's regress in order to speed up the calculation. % Input: % y - Independent variable. % X - Dependent variable. ...
57e1621344fe9b076fc670b0f849a3679fe8baddaacb8f46b5478ac2af72f87b
MATLAB
3,523
106
function val = ft_getopt(opt, key, default, emptymeaningful) % FT_GETOPT gets the value of a specified option from a configuration structure % or from a cell-array with key-value pairs. % % Use as % val = ft_getopt(s, key, default, emptymeaningful) % where the input values are % s = structure or cell...
7c6dd5aeae0806a98abd25fb487f232ec8fc6e2d08c944e0e43de3949992b5bd
MATLAB
3,524
102
function ButtonOpen_Callback(source,eventdata,h,field) % get directory and display it on GUI % global h % default output base name prefix = 'Sepia'; switch field case 'mask' % only read NIfTI file for mask [maskfileName,pathDir] = uigetfile(sepia_get_nifti_uigetfile_filter(),'Select mask file'); ...
01a43c0d5b71df91418a5235596b531d2ad4a6b772524de809c1cee9046b1920
MATLAB
3,525
82
function [numClust, clustInd, centInd, haloInd, delta,predbounds] = densityClust_fast(dist, rho, isHalo, autosel) % DENSITYCLUST Clustering by fast search and find of density peaks. % SEE the following paper published in *SCIENCE* for more details: % Alex Rodriguez & Alessandro Laio: Clustering by fast search a...