sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
62bae92563635497ddbbb30f52779b6eeea66ce95ec3d7cee1c46562d4f2019b
MATLAB
4,264
171
function RDMs = averageRDMs_subjectSession(varargin) % RDMs = averageRDMs_subjectSession(RDMs): returns the input unchanged (no % operation). RDMs = averageRDMs_subjectSession(RDMs, 'subject'): computes % the subject-averaged RDMs. RDMs = averageRDMs_subjectSession(RDMs, % 'session') RDMs = averageRDMs_subjectSession(R...
63a888300e42e047a150688b1292358a0b83bd897d69e36dd7a02fae494952fa
MATLAB
4,264
101
%% TestBFRMatrix - Tier 3 real-dataset background-field-removal method regression matrix % % Mirrors TestQSMMatrix.m: runs the one-stop SEPIA pipeline on a real % dataset once per background-field-removal method in methodBFRName % (sepia_universal_variables.m), holding phase unwrapping ('None') and % QSM dipole inversi...
01012cbcaf795b655a904e650bd33d7ef1a9028791133c45e9915bc565e81c77
MATLAB
4,265
103
function [realignedImage, realignmentParameters] = realign(this, varargin) % Realigns all 3D images in 4D data to each other using SPM's realign... % estimate+rewrite functionality; interfaces all options of spm_realign % % Y = MrImageSpm4D() % [realignedImage, realignmentParameters] = Y.realign(... % 'spmPar...
3276e7ab4483972944d40cbefb49577a0b8084bc353cd7439e890095e4c05fb3
MATLAB
4,265
113
% EEGDRAWG - subroutine used by EEGPLOTGOLD to plot data. % % Author: Colin Humphries, CNL, Salk Institute, La Jolla, 7/96 % Copyright (C) Colin Humphries, CNL, Salk Institute 7/96 from EEGPLOT % % This file is part of EEGLAB, see http://www.eeglab.org % for the documentation and details. % % Redistribution and use in...
d576b83182ebeda53873f2451e1b9b0ec12cfaa32b79ae55240842a4a1b2df4e
MATLAB
4,266
123
function MS = createMesh3D(varargin) % MeshStructure = buildMesh3D(Nx, Ny, Nz, Width, Height, Depth) % builds a uniform 3D mesh: % Nx is the number of cells in x (horizontal) direction % Ny is the number of cells in y (vertical) direction % Nz is the number of cells in z (perpendicular) direction % Lx is the domain len...
ed46116c91189b3afa017bdc6d74dbd4d9a6f5a54a377504ebaad4bbba39e523
MATLAB
4,267
119
%% get_set_qsm_heidi(h,mode,input) % % Input % -------------- % h : structure contains all handles of SEPIA % mode : 'set' - extract information from GUI to config file % 'get' - extract information from config file to GUI % input : if mode is 'set' then input should be fid ...
859ada67a484a18dc084c7b6c47077c88bb6ac72380825d30fa86e0fa97e1082
MATLAB
4,268
98
function [varargout] = likPoisson(link, hyp, y, mu, s2, inf, i) % likPoisson - Poisson likelihood function for count data y. The expression for % the likelihood is % likPoisson(f) = mu^y * exp(-mu) / y! with mean=variance=mu % where mu = g(f) is the Poisson intensity, f is a % Gaussian process, y is the non-negativ...
3b293cca9d66df507e55447bdb77b0e3dcdeb51a996d1a05cd1d9d0eaff820bc
MATLAB
4,270
175
function [Xi,alltasknms,condf,allti,testfield,prop_by_condition,num_by_condition] = Meta_Task_Indicator(DB,varargin) % [Xi,alltasknms,condf,allti,testfield,prop_by_condition,num_by_condition] = Meta_Task_Indicator(DB,[data]) % % Get task indicators and number / proportion of activating contrasts from DB % % needs to se...
2a47424e109bb3890010d4b40a06cf3bd99c984a314b1721f509b3502b16cbba
MATLAB
4,271
105
function hessfd = getHessianFD(problem, x, d, storedb, key) % Computes an approx. of the Hessian w/ finite differences of the gradient. % % function hessfd = getHessianFD(problem, x, d) % function hessfd = getHessianFD(problem, x, d, storedb) % function hessfd = getHessianFD(problem, x, d, storedb, key) % % Returns a f...
4e090b4671acfe9e45ba4533fba0da9bd7d5fdbd8690b0bf71bc2828db8eae7d
MATLAB
4,275
117
%% MOTION CORRECTION SCRIPT close all clear all % fname = 'Z:\Scanbox\Data\rbp6_3\20210707_rbp6_3\20210707_rbp6_3_000_004'; Directory = 'Z:\Scanbox\Data'; cases = {'rbp6_3'; 'rbp10'; 'rbp11'; 'rbp12'; 'rbp13'; 'rbp16'}; % MC_values = cell(6, 6); % % x_y_coord = cell(6, 6); load('Z:\CLOOSE_benchmark_tests\MC\MC_v...
258f1aa7290558dca6ccee77f6a8af75dd1c3ce941aa262fb26956cac8e388d5
MATLAB
4,276
135
function stats = anova2_repmeas(Y,S,F1,F2,FACTNAMES) % % function stats = anova2_repmeas(Y,S,F1,F2,FACTNAMES) % % Two-factor, within-subject repeated measures ANOVA. % For designs with two within-subject factors. % % Parameters: % Y dependent variable (numeric) in a column vector % S grouping va...
a3bc099e460ce74481af73d0cc37e1eb627fe8c37dbc56b4f2e1fed2a5c2b7e5
MATLAB
4,276
131
function data = eventLockData(R, M, eventName, tPts, rois) % data = eventLockData(R, M, eventName, tPts) % data = eventLockData(R, M, eventName, tPts, rois) % % Resample deconvolved calcium events into a new time base. For example, % instead of having a time base that's set inconveniently to 32.17 ms by % our scan rat...
b6b641cef837b6681a5bc58e1a7414cf71591204fb8c51d45f8d0579b92190ac
MATLAB
4,276
130
function [str,H,p,STATS,stars] = ttest_nice(a,b,type,plotFlag,fontsize4text,printOutFlag,statsInTitleFlag,inputNames) if ~exist('plotFlag','var') || isempty(plotFlag) plotFlag = 0; end if ~exist('printOutFlag','var') || isempty(printOutFlag) printOutFlag = 1; end if ~exist('statsInTitleFlag','var') || isempty(stat...
c57882c404bbeb920be35d83c3f5bd34a1112b149640a0a00272b805039bdbe5
MATLAB
4,279
106
function tapas_hgf_binary_condhalluc_plotTraj(r) % Plots the estimated or generated trajectories for the binary HGF perceptual model % Usage example: est = tapas_fitModel(responses, inputs); tapas_hgf_binary_plotTraj(est); % % --------------------------------------------------------------------------------------------...
a66ca725b97242e8668b96820e48cf7ae7093db5ecf6b20f8356ca194b20e735
MATLAB
4,281
101
%% Encasing.m % Written by Julia Becker January 2020. Minor edits Alex Winkel % Instructions: copy this file from the GIT folder to somewhere else (e.g. % a folder in the Matlab path), then edit the varibles ui2 to ui7. Run the % script and choose an over-arching folder - it will search for subfolders % called '...
b8ec58ebb15ddde34f5a6edea6fecfddb03c3177ce536265b0044b3cc22ea031
MATLAB
4,281
124
function run_booteffectsize_examples %RUN_BOOTEFFECTSIZE_EXAMPLES Run bootstrapped effect size examples. % Generates random multivariate data for 2 samples X and Y. Each sample % has 20 variables, each with a mean value of 0, except for the first 10 % variables of Y which have a mean value of -1. Each variable h...
fc3e86b42be74ecda9e7a1d33d90da3763d86edad89ea6b9fd14f73f6fc787f8
MATLAB
4,281
118
function [dcurve_mag_clust1_avg,dcurve_eig_clust1_avg,length_x1]=diversity_curve(M,dsym,L,VoxelSize,Avg_mag,Avg_eig) % This srcipt computes the diversity curve for each streamline % The are all in cropped space % The gradient magnitude is symmetrized % Load the group everaged eigenmap and gradient magnitude [~,avg_m...
7c3fe7016fafea930cec31b727f33899833cc3e69ad0059461cb2c6a982481d9
MATLAB
4,282
141
%% Morris screening % Author: MJ Colebank % Last edited: 3/10/2022 % % THIS CODE COMES WITH NO GUARANTEES clc; clear; %% Qdat = dlmread('DP1_inflow.dat'); % inflow_param = Qdat(13:end,:); % get_inflow(Qdat,16385,inflow_param); dlmwrite('inflow.dat',Qdat,'delimiter','\t') load ('DP1_opt.mat'); param_values = x.*sc; %%...
1dba5faa5344a73984ebba52e1fda950e752ed6041b9395e4f23249290b2ebad
MATLAB
4,286
57
function current_results_out = outputHNMPAResults(current_results,csv_outdir,modality,roiType,resultsCell) current_results_out = current_results; struct_string = [modality '_' roiType]; % current_results = outputHNMPAResults(current_results,'IVIM',roiType,{bval_arr,dwi_arr,[f_arr;D_arr;Dx_arr;s0_arr]...
8a96a956b60164df7a11c82ecf1e5524ecf0e47b0e90db7c2d67824994b773b4
MATLAB
4,287
138
function [X,a]=indicatorMatrix(what,c) % function X=indicatorMatrix(what,c) % Makes a indicator Matrix for the classes in c % INPUT: % what : gives the type of indicator matrix that is needed % 'identity' : a regressor for each category % 'identity_p' : a regressor for each category, except for...
29cc49e810ef50e1c50b871b04e55ad49559da88c1bbacbf90f39ea37d8470b2
MATLAB
4,288
126
% exp 1 uses 6 pcs and 0.035 on the global centroid clustering % exp 2 uses 6 pcs and 0.022 on the global centroid clustering % exp 3 uses 5 pcs and 0.015 on the global centroid clustering and manual % exp 4 uses 5 pcs and 0.015 on the global centroid clustering and manual % selection %% Testing centroid detecting with...
62478660978830d3ae5610da7d8fadcf6f9a759c94b41e9429dca417811f664b
MATLAB
4,289
113
function brain = getBrainData(params, plotInfo) % loads 3D brain volume (MRI, CT, anatomic areas, ...) = brain % interpolates % SPM package MUST be included in Matlab path % (c) Jiri, Jan17 % old implementation (as of Nov21), use: brainVolumes_load.m %% defaults if ~isfield(plotInfo, 'plottingStyle') plotInfo.plo...
9d8ae86710c6ff1ded88edfa96f8da99c1a6b763ea472867212d10c4e0654e50
MATLAB
4,289
134
% Script for WMH segmentation using LST toolbox in SPM % Youjie Wang, 2025-08-31. % Dependencies: % - SPM12 % - LST (https://www.applied-statistics.de/lst.html) clear; FLAIR_path = '/this/is/for/nipype/flair'; T1w_path = '/this/is/for/nipype/t1w'; % can be empty '' threshold = '/this/is/for/nipype/threshold'; output...
0c8e80874395068b8d6184539ba89c3bd98ca41be6f27cd959111f17bcdb4eb7
MATLAB
4,290
100
%% h = sepia_handle_panel_qsm_FANSI(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...
1c0bb13f28e9f2252ec7f61cd983974d4f4e369d4cd80208c182a5b79180d5d8
MATLAB
4,291
132
function [y1, y2] = vl_nnpdist(x, x0, p, varargin) %VL_NNPDIST CNN p-distance from target. % VL_NNPDIST(X, X0, P) computes the P distance raised of each feature % vector in X to the corresponding feature vector in X0: % % Y(i,j,1) = (SUM_d (X(i,j,d) - X0(i,j,d))^P)^(1/P) % % X0 should have the same size as X;...
5319560ae5301a1dbd7ea7deaf4e6e58de82d9e6f39d12a6f366750147fe4e0c
MATLAB
4,292
112
function [dataheat, ind_lim] = get_norm_rsc_simfile(sim_file, ind_lim) % GET_NORM_RSC_SIMFILE % Syntax: % [dataheat, ind_lim] = get_norm_rsc_simfile(sim_file, ind_lim) % Description: % From a simulation file and its *_1/*_2 siblings, compute per-neuron % ratio (rate_1+rate_2)/rate_3, select neurons within percent...
555e436244bd6279fdcb644b72873cc638f8b3651cd36a3e9059e7863da43846
MATLAB
4,292
132
function [opts, args] = vl_argparse(opts, args, varargin) %VL_ARGPARSE Parse list of parameter-value pairs. % OPTS = VL_ARGPARSE(OPTS, ARGS) updates the structure OPTS based on % the specified parameter-value pairs ARGS={PAR1, VAL1, ... PARN, % VALN}. If a parameter PAR cannot be matched to any of the fields % ...
440b4a48c4b9a42b2dd380e487373e0021413a5433d1a7814df4ca1fc91acbc2
MATLAB
4,293
145
%% Phantom.fslow = .64; Phantom.finter = .29; Phantom.ffast = .10; Phantom.Dslow = .0015; Phantom.Dinter = .0052; Phantom.Dfast = .08; Phantom.S0 = 184; ffast = Phantom.ffast; % T1_tissue = 900:20:1700; % 900 to 1700 % T1_blood = 1500:20:2100; % 1500 to 2100 % T2_tissue = 70:10:90; % 50 to 90 % T2_blood = 220:...
dd163b9ee65a73f07df549a312d9eae3d48ea32a56f813f318ebf4165e83a972
MATLAB
4,293
132
function [y1, y2] = vl_nnpdist(x, x0, p, varargin) %VL_NNPDIST CNN p-distance from target. % VL_NNPDIST(X, X0, P) computes the P distance raised of each feature % vector in X to the corresponding feature vector in X0: % % Y(i,j,1) = (SUM_d (X(i,j,d) - X0(i,j,d))^P)^(1/P) % % X0 should have the same size as X;...
011758ac207cc7e86fd806f9aebc127ced6bd4e990d51851ef2781f98424c5c0
MATLAB
4,295
149
function [output]=runEXTRACT(h5Path,varargin) %% OPTIONS options.diary=true; options.plotFigure=true; options.diary_name='diary'; options.verbose=true; options.frameRange=[]; options.polarityGEVI='pos'; % 'neg' 'dual' options.rank=100; options.binning=[]; options.partition=[1 1]; options.cellRadius=20; %% UPDATE OP...
22fd1de6fb2f08636d0bd47605dd927a40b43ba9c367de44b6e501d62f1cddef
MATLAB
4,295
128
function autoqc_nsd_grandfinale(glmdirname,curix) % setup nsdsetup; alltempfiles = {}; switch glmdirname case {'glmdata' 'glmdataLOW'} if isequal(glmdirname,'glmdata') min0 = -620; else min0 = -340; end % what is the 1-index of the max nsd session we have? if ~exist('curix','var') || isempty(cur...
267fc133c2adf02d1789d0f8427ec61dd871ec9b59c50a85c6f47668528177eb
MATLAB
4,297
108
%% %%%%%%%% Generate maps of floc results % define resultsdir = [nsd_datalocation '/ppdata/subj%02d/func1mm/']; files = ... % 1 is R2, 2 is mean, 3-7 is domain [t], 8-17 is subdomain [t], 18-22 is domain [a], 23-32 is subdomain [a], 33 is all betas ...% name fname mgz name color r...
c6a15a3ac35c377eb2c8b6799ffcfa99b88622415f880cd3a743c06f518be28f
MATLAB
4,298
128
%% Place to save reduced data structures YOURDATAPATH = ''; savePath = [YOURDATAPATH '/' 'locked' '/']; %% Individual datasets mouseInfoAll = {{'cfa17', '200825'}, ... {'cfa17', '200827'}, ... {'cfa19', '200820'}, ... {'cfa19', '200826'}, ... {'cfa20', '201114'}, ... {'cfa20', '201118'}, ... {'...
bdd33d07305efa75423c2d1b5e930edf996022c3f78b749f0f2837b2b6e35179
MATLAB
4,302
121
function [ EEGOUT, command ] = pop_cwregression( EEG ,varargin) % UNTITLED1 Summary of this function goes here % Detailed explanation goes here command=''; % keyboard; if numel(varargin)==0 % probably can be removed.. % cfg.cwregression.srate = EEG.srate; %srate=1000; % cfg.cwregression.wi...
3d9d10e1d627e8db131f9f1ee220b504b19afb13db7f73ec71038f2cbf952b22
MATLAB
4,303
96
function PseudoTransmit_GroupAverage(myelinRCFile, avgPTFieldFile, ReferenceValOutFile) %asymmetry stuff is only for display, moved to phase 4 to simplify %"Orig Myelin" MyelinMap = cifti_read(myelinRCFile); AvgPTField = cifti_read(avgPTFieldFile); [leftmyelin leftroi] = cifti_struct_dense...
cd1c2182ef0985d3e408c9b9d86d2f24464df77e26f991c16e486db7c4d66939
MATLAB
4,303
124
% ENTROPY_REJ - calculation of entropy of a 1D, 2D or 3D array and % rejection of odd last dimension values of the input data array % using the discrete entropy of the values in that dimension % (and using the probability distribution of all columns). % % Usage: % >> [entropy r...
6787ff616b30c12ef6447d2af75e05ce3f60a38c4e2a4567d9921e71ec4d8114
MATLAB
4,304
171
function test_suite = test_checkParameters %#ok<*STOUT> % (C) Copyright 2021 CPP visual motion localizer developers try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> catch % no problem; early Matlab versions can use initTestSuite fine...
e4dcc8a0e2adbe6f518759c82bf1e21ddbd0478b1a4092f65c0e869ec1f3f9a7
MATLAB
4,305
119
function F = spm_Fcdf(x,v,w) % Cumulative Distribution Function (CDF) of F (Fisher-Snedecor) distribution % FORMAT F = spm_Fpdf(x,df) % FORMAT F = spm_Fpdf(x,v,w) % % x - F-variate (F has range [0,Inf) ) % df - Degrees of freedom, concatenated along last dimension % Eg. Scalar (or column vector) v & w. Then df=...
0cdd3db10fc52e38853b742e79fed1cd8f956fe7dd7ddcda237de89f1fc710aa
MATLAB
4,306
107
% EEG_DIPSELECT - select component dipoles from an EEG dataset with % reisdual variance (rv) less than a selected threshold % and equivalent dipole location inside the brain volume. % Usage: % >> selctedComponents = eeg_dipselect(EEG, rvThreshold, selectionType, depthThreshold) %...
293cfb4fb60bc7a55b97aeafa7bdb4f7e99326984bffb169d49312a69246ef97
MATLAB
4,309
135
function [result] = fit_happy_model_basic(mtx,happyscore,constant) %assumes that each row of the cell array is a different subject rptfit = 5; %repeat N times jittering the betas tempf=fieldnames(mtx); for n=1:length(tempf), eval(sprintf('mtx.%s=double(mtx.%s);',tempf{n},tempf{n})); end; data = mtx; data.happyscore =...
4eaaed04ba69a6ea8fa22a58c17fbd267f0b619326a864882204a1aa5e4df825
MATLAB
4,309
171
function [incong_offer, incong_rew, incong_opt, cong_offer, ... cong_rew, cong_opt] = getIncongruentTrials(S) % find incongruent trials bchange = diff(S.Block); allChange = find(bchange); ltom = find(bchange == -2)+1; %first mixed trial post low ltom_incong_offer = nan(size(ltom)); ltom_incong_rew = nan(size(ltom)...
1ca0fb2144e2c58f2d38db73c18622a700e892a5e892f0c497a2a22234ea6b40
MATLAB
4,310
100
%% h = sepia_handle_panel_swismwi_SWI_2DHamming(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 an...
2845b919b0fd63a08d409601c76a66c2ae4b7753b1a034aa3aba87d68a5a1007
MATLAB
4,310
170
function Pipeline_plotPatchData(params) % This function plots data acquired from whole cell recordings and % simultaneous voltage imaging of single neurons sm = 1; analysisDir = getAnalysisDir(params); ExpInfoFn = getFileName(params, 'ExpInfo'); tsFn = getFileName(params, 'TS'); wsFn = getFileName(params, 'WSData');...
f4a3f2252a26d820734d0b0302fedb0f7c5d1bb6ca34b242a38d5952d86f3fc5
MATLAB
4,311
110
function out = MF_StateSpaceCompOrder(y, maxOrder) % MF_StateSpaceCompOrder Change in goodness of fit across different state space models. % % Fits state space models using n4sid (from Matlab's System Identification % Toolbox) of orders 1, 2, ..., maxOrder and returns statistics on how the % goodness of fit changes ...
5b456a5f6968162f325e8d00b0644b818cc8aef5031cb464a701d842b73a65fd
MATLAB
4,312
104
% This MATLAB script can be used to reproduce the result of EEG spectral power increase and decrease % % Please download BBCItoolbox to 'MyToolboxDir' % Please download dataset to 'NirsMyDataDir' and 'EegMyDataDir' % The authors would be grateful if published reports of research using this code % (or a modified version...
7ba55c4d28dd0830fb557f5303ae2cb1610a0a250d8b26ee85114674e48030d6
MATLAB
4,312
144
function tapas_uniqc_new_struct(varargin) % Creates a new script (e.g. tests/examples) including header. % tapas_uniqc_new_struct(funname) opens the editor and pastes the content % of a user-defined template into the file funname.m. % % Example % tapas_uniqc_new_struct myscript % OR % tapas_un...
ee6d3b547073e472fc88d7c1409a7d6dcdd16e3a33f49ee154c20ffadac533b7
MATLAB
4,313
146
function [nTestFailed,nTestTotal] = tapas_test(toolboxes,level) % TAPAS_TEST Run tests of TAPAS toolboxes % % IN % toolboxes % Names of toolboxes to test (including their dependencies)- % If empty, all toolboxes are used. % level % Detail of the test (per toolbox). % 0: Rough...
b976dcfd0ca936cae4bd5d107c6e814de3208d96a723b0b103315d8ce1ac98bb
MATLAB
4,314
108
function filter = tapas_physio_gui_filter() % Creates sub-part for preproc filter options in Batch Editor GUI % % tapas_physio_gui_filter % % % See also % Author: Lars Kasper % Created: 2019-07-05 % Copyright (C) 2019 Institute for Biomedical Engineering % University of Zurich and ETH Zurich ...
e8e1ad0531edc01727543521c7cd215bab39dc1aa18acba21c52895b632a97d2
MATLAB
4,314
132
function [mesh] = prepare_mesh_iso2mesh(seg, tissue, maxvoxelvol, dofix, ... downsample) % % Input: seg <nx x ny x nz matrix> segmented MRI scan % tissue <list> of tissue types, e.g. {'brain', 'skull', 'scalp'}, % or something lik...
d321240254601349c0f0df59ac3ce79a726748bc07309f313d2049f274061f86
MATLAB
4,315
141
function [fet_proc,fet,fet_sem,fet_legend,fet_inds,xvec] =... createFeatures_ofc(ops) %generates features from OFC data. %The running history of the many %types investigated, but pulled and made on the fly % includes preprocessing steps such as denoising via PCA %% load data and siz...
3085ea1a3bd509611818d750035b8e560842dff3804e05970e779c1869873a6d
MATLAB
4,316
87
% this script generates, for all subjects, a depiction of tsnr results for one run. % this includes tsnr related stuff (i.e. mean and valid). % define massiveim = []; for subjix=1:8 sessix = 20; runix = 1; % setup dirs0 = nsdallsessfun2(subjix); ppdir = regexprep(dirs0{sessix},'rawdata','ppdata'); % loa...
6179534f0fa9410aecf2874a354e5c2e364c3dbd9c723118688119051423598f
MATLAB
4,317
109
% Bonferroni-Holm (1979) correction for multiple comparisons. This is a % sequentially rejective version of the simple Bonferroni correction for multiple % comparisons and strongly controls the family-wise error rate at level alpha. % % It works as follows: % 1) All p-values are sorted in order of smallest to largest....
d22fbad0e6e52dba7f6a368f2b99fc93bf2cb97c5e68883407feda71303177a5
MATLAB
4,318
116
function BF_AnnotateRect(featureVector,groupLabels,cfnParams,colors,ax,underOrLeft) % BF_AnnotateRect Annotates rectangles under distributions for group classification % %---INPUTS: % whatCfn, the classification method to use % featureVector, the values given to each observation % groupLabels, the class labels assigned...
48ad221ae8aa793b9bfa918c327fa7ce4c4e784032dacae6d8c609ec577d6a18
MATLAB
4,319
155
function [value] = test21(epsilon, A, B, C, D) % test for complex sphere % See notes October 11, 2012. % % fzero(@(x) test21(x), [.1 1]) searches the value of epsilon such that we % barely destabilize the system with a norm epsilon perturbation. % % This file is part of Manopt: www.manopt.org. % Original author: Nicol...
f377a53e95ca8be4286715e1b6c59b68a47e70271d89f4d901c70737c40e0850
MATLAB
4,319
118
% Script demo_change_geometry % How to change the gemetry parameters (shift, rot, zoom, shear) in % MrImageGeometry or MrDimInfo (axis-parallel shift and zoom only) % % demo_change_geometry % % % See also % Author: Saskia Bollmann & Lars Kasper % Created: 2019-12-03 % Copyright (C) 2019 Institute for Biomedical ...
dc68824e348b64a1159ad31ed7a377ecbba287c876aad62ba38c304fa765857e
MATLAB
4,320
155
function coactPaper_figureS09() labelWeight=true; labelCase=false; labelSize=9; letGapX=5; letGapY=6; fontsize=6; close all fh=initFig('width',8.9,'height',3,'font','Arial','fontsize',fontsize); x=18; y=2; panel_01(x,y,fontsize); drawnow(); end %% function panel_01(x,y,fs) width=20; height=18; xGap=14; cellInfo=po...
f341d4d97c1440f764c0ac6d57442500efd83e98bf941a79336ea2f644333431
MATLAB
4,320
102
function f = TS_PlotLowDim(whatData,whatAlgorithm,showDist,annotateParams,cfnParams) % TS_PlotLowDim 2-dim feature-based representation of a time-series dataset % % The low-dimensional representation is computed using PCA by default. % %---INPUTS: % whatData, the hctsa data file (or structure) to use (input to TS_Loa...
43707643c44f0431063b99c82c4c89e014d3dd16941fa7a7f32d9474fac9a3cb
MATLAB
4,322
139
%Detrend - Detrend signal. % % USAGE % % [detrended,model] = Detrend(samples,<options>) % % samples <a href="matlab:help samples">samples</a> to detrend % <options> optional list of property-value pairs (see table below) % % ======================================================================...
b02c8576dc8a3749a3237308743e0eb6caec669ecd688f9bc830e21bf3f230a9
MATLAB
4,323
127
classdef nnconvt < nntest properties (TestParameter) depth = {1 2 3} numImages = {1 2 3 4} numFilters = {1 2 3} upx = {1 2 3} upy = {1 2 3} padx1 = {1 2 3} padx2 = {1 2 3} pady1 = {1 2 3} pady2 = {1 2 3} up = {1 2} fsx = {1 2} crop = {1 2 3 4 5 6 7 8} numGroups = {1...
802aaf4855c614caf95d603445361405bdf043ee6fb2cfae17b5fded7111c3f1
MATLAB
4,324
112
function f = ba_interp3_wrapper(vol,coords,interptype) % function f = ba_interp3_wrapper(vol,coords,interptype) % % <vol> is a 3D matrix (can be complex-valued) % <coords> is 3 x N with the matrix coordinates to interpolate at. % one or more of the entries can be NaN. % <interptype> (optional) is 'nearest' | 'linear...
7030ac74f3142f184af8b1de7645eacc98ed0406e64add7f2b0aec72f1562c43
MATLAB
4,328
89
% Copyright 2025 Laura Schmid % Permission is hereby granted, free of charge, to any person obtaining a % copy of this software and associated documentation files (the % “Software”), to deal in the Software without restriction, including % without limitation the rights to use, copy, modify, merge, publish, % distribu...
28c0201728edee698e0c229ac89c3998233711d5a357a2a04f7d679cb640ceb1
MATLAB
4,330
119
% Seed ROI to Cortex PAC Analysis % This script computes phase-amplitude coupling (PAC) between a seed region of interest (ROI) % and multiple cortical ROIs using bispectral analysis. % The results are saved for each subject in a specified directory. resultsDir = [main_path 'Results/source/']; % Directory containing s...
469cbaecc08604c86468dedcc2be58d67ae8691658e39fdc8b8603198ab33f88
MATLAB
4,330
133
function rgb_map = getColorMap(cTag, nRows) % based on 'cTag', returns nRows x 3 RGB colormap % (c) Jiri, Mar13 %% how many rows? if nargin < 2 nRows = 256; end %% select colormap switch cTag case 'bwr' N = ceil(nRows/4)-1; rgb_bw = cat(2, linspace(0,1,N)', linspace(0,1,N)',ones(N,1)); ...
4a2cd1acfe5e52bf6eb741c79746f8c6fcfb0f9f9e1e8ac8f11fece4ee99052e
MATLAB
4,333
137
function stats = CalculateStats(I,windowsize,noverlap,nfft,SampleRate,Box,EntropyThreshold,AmplitudeThreshold,verbose) if nargin <= 8 verbose = 1; end %% Ridge Detection % Calculate entropy at each time point stats.Entropy = geomean(I,1) ./ mean(I,1); stats.Entropy = smooth(stats.Entropy,0.1,'rlowess')'; if Ampl...
515e6776f6fd43a4dea42a6e65cd37175b9912b893d8a14cc20b4bd868fe3be3
MATLAB
4,334
120
classdef McsVideo < handle %UNTITLED Summary of this class goes here % Detailed explanation goes here properties %(Access = private) playing = 0; environment = []; imageCube = []; framerate = []; curFrame = 1; framehandl...
73739d1ea8b63d608f5d2a3a0b930b2dcd0f5445fef641ec41279512c27fe859
MATLAB
4,335
109
% logging_log() - logging_log logs messages if required by the current_level % or LOG_LEVEL current_level superceeds log_level. if neither % are set 'NOTICE' is used levels are ERROR, WARN, NOTICE, % INFO, DEBUG from least verbose to most by default warning % ...
90c5d9e9195038451967eb91a18959a62432a1ce1ea205321a47d8b36e19a58f
MATLAB
4,335
112
function [FIT3D,Residuals,b]=PolyFit(Data3D,Mask,order); dim=size(Data3D); %% for volume fitting Indices = find(Mask(:,:,:)); [x1,y1,z1]=ind2sub(size(Data3D(:,:,:)),Indices); % x1 = cast(x1,'like',Data3D); % y1 = cast(y1,'like',Data3D); % z1 = cast(z1,'like',Data3D); R=Data3D(Indices); ...
6e4f915f6d831618eec07790e83b2a51c534b92bee81388a260a43d3b9daf78e
MATLAB
4,340
148
function plot_fig3d_left(datadir) % Plot dopamine AUC at the offer cue (0-0.5 s) and model predicted RPE % regressed against reward offers in the last 15 trials during mixed % blocks. For visualization, only 7 trials back are shown. N = 10 rats. % % INPUTS % datadir: file path of data downloaded from Zenodo. Link to do...
12d54c1f7daab13812c3d2fa9f4dc72940fbb92b44f1e3dac6d27345f08598e6
MATLAB
4,341
148
%% load in mesh output by fortran file meshfile = '../../networkFVMsims/test/circpolyresv.mesh.txt' MSH = MeshObj(meshfile); %% load snapshots snapfile = '../../networkFVMsims/test/circpolyresv.snap.txt'; [fields,snaptimes,vels] = loadSnapshotFVM(snapfile); %% plot field on triangular mesh % for this to work, n...
4768a431deef76f4622df4f9d5f3c6613ba01c57cb237f2ea0abcd31c6ad299d
MATLAB
4,341
105
% REJTREND - detect linear trends in EEG activity and reject the % epoched trials based on the accuracy of the linear % fit. % Usage: % >> [rej rejE] = rejtrend( signal, winsize, maxslope, minR, step); % % Inputs: % signal - 3 dimensional signal (channels x frames x trials) %...
df4f95d65fcf3d08f6746d191a1666779810b935b6aefbeb37a97687dda4c281
MATLAB
4,341
124
% SPEC - power spectrum. This function replaces PSD function if the signal % processing toolbox is not present. It uses the TIMEF function. % % Usage: % >> [power freqs] = spec(X); % >> [power freqs] = spec(X, nfft, fs, win, overlap); % % Inputs: % X - data % nfft - zero padding to length nfft...
19498be5c52e1265419799ac5e5508389ace101ffc8ea5074bb6a4c38f0c893d
MATLAB
4,345
156
function test19() % Test for complexcircle geometry (Phaseless signal reconstruction) % Based on formulation by Waldspurger, d'Aspremont and Mallat, 2012, eq (4) % % This file is part of Manopt: www.manopt.org. % Original author: Nicolas Boumal, Dec. 30, 2012. % Contributors: % Change log: reset(RandStream.get...
bdb430a339bf53cae02882c5ad4735b719b923056983686f8abd55ac3b54f569
MATLAB
4,345
112
% SETFONT - Change all the fonts properties of a figure. % % Usage: % >> newdata = setfont( handle, 'key', 'val'); % >> [newdata chlab] = setfont( handle, 'key' , 'val', ... ); % >> [newdata chlab] = setfont( handle, 'handletype', handletypevalue, 'key' , 'val', ... ); % % Inputs: % handle - [gcf,gca] ...
3469d611a816e8ef79358d665020e85e3b38501fc5bb574d9a2f39eace09f5f7
MATLAB
4,346
129
%{ # Optical Flow for all frames using Lucas-Kanade method -> movies.OpticFlowOpt -> stimulus.MovieClip --- orientation : mediumblob # mean phase angle of optical flow magnitude : mediumblob # Magnitude of optical flow %} classdef OpticFlowFine < dj.Computed properties keySour...
2805cbf0db93108c575e733e0a301fd279967c4632637497eaf2b82aa8ac2915
MATLAB
4,347
148
function nmri_check_seg(subject) %nmri_check_seg(subject) % % Function to visually check (and edit if needed) the segmented MRI that % is the basis for the headmodel step. % Wraps around FSLeyes for the editing and deals with updating the % mri_seg.mat if needed % check for fsleyes [cstat,cout]=system('whic...
7c18ebd95db5ec7d1f675209675a356a23664201dbe34e98753102c41fa9ac56
MATLAB
4,349
96
function plot3B() %% b % Pooled context (green) or % stimulus (red) decoding accuracies from context (left) and stimulus (right) % neurons, for cross-validation or generalization across pictures (red), contexts % (green) and serial picture positions (blue). load fig3Bdata.mat YP=0.2...
cd49fe7e6181e0b1c26057f42fbe319319558b2b298de9c885e89c82f255efc1
MATLAB
4,349
98
% STD_MERGECLUST - Commandline function, to merge several clusters. % Usage: % >> [STUDY] = std_mergeclust(STUDY, ALLEEG, mrg_cls, name); % Inputs: % STUDY - EEGLAB STUDY set comprising some or all of the EEG datasets in ALLEEG. % ALLEEG - global EEGLAB vector of EEG struct...
d0dc2340de4c6a83e0430e6c88559deab05ed3deefa3b5a312cae38639d8d7a8
MATLAB
4,350
103
% IMAGESCLOGY - make an imagesc(0) plot with log y-axis values (ala SEMILOGY) % % Usage: >> imagesclogy(times,freqs,data); % Usage: >> imagesclogy(times,freqs,data,clim,xticks,yticks,'key','val',...); % % Inputs: % times = vector of x-axis values % freqs = vector of y-axis values (LOG spaced) % data = matrix o...
d7c3ac1d0038350f729afe84ee23f8cee3a8b9f7ff369f51185ae3198ff9e7f0
MATLAB
4,351
126
function tileCoef = sttc_m(N1v, N2v, dtv, Time, spike_times_1, spike_times_2) %sttc calculates the spike timing tiling coefficient % Originally written in C by Cutts and Eglen % https://github.com/CCutts/Detecting_pairwise_correlations_in_spike_trains/blob/master/spike_time_tiling_coefficient.c % See their 2014 p...
e263f3e59eb0aa26598e504cdadebd49e9aa866ffaed715dccbd4fde192cac55
MATLAB
4,351
175
function [Mu, Cov, P, Pi, LL] = ZG_hmm(X,T,K,cyc,tol) % Gaussian Observation Hidden Markov Model % % X - N x p data matrix % T - length of each sequence (N must evenly divide by T, default T=N) % K - number of states (default 2) % cyc - maximum number of cycles of Baum-Welch (default 100) % tol - termination tolerance ...
26f36eaf184f1f9fdd5eb01829a11ddd1a32b804d4e346f78f1cb76c1aa1b006
MATLAB
4,352
117
function opt=defaultOpt(optIn,defVal,defRange,strictClass) %function opt=defaultOpt(optIn,defVal,defRange,strictClass) % % This takes in a option flag structure [optIn] and the default % values of each of the fields [defVal]. It will set the option % fields to the default value when the field in [optIn] does not % exis...
c9d1c0c109d249dd5d6b79ca2f56761cdac951646e691c54dc0a8c1b79a289df
MATLAB
4,357
130
function run_permuranova2_examples %RUN_PERMURANOVA2_EXAMPLES Run two-way permutation RM ANOVA examples. % Generates random 3D repeated-measures data (Subjects x Factor A x % Factor B). Factor A has 2 levels and Factor B has 3 levels. Main % effects and an interaction effect are injected along with a subject % ...
bfa8c759990bd015009f726f9a13eaf7775b46123cdd6211ff3dacbc6a0c1074
MATLAB
4,359
98
%% %%%%%%%% Generate maps of prf results % define resultsdir = [nsd_datalocation '/ppdata/subj%02d/func1mm/']; files = ... ...% name fname mgz name color range color map transform function circular { ... {'R2' 'prfR2' 'prfR2' [0 1] ...
592330f3ca5bb4fd56be8cd98abab869ca4d00e0bed196cad5aa63d1c725092d
MATLAB
4,361
135
function DebugBatch(mfile,bfile,item,varargin) %DebugBatch - Help debug a batch job. % % This function can be used to help debug a batch. It retrieves the parameters % corresponding to the required item from the batch file, and either starts % the batch function with these parameters in debug mode, or simply assign...
c8bc3ed091865053c810c3e9c99f44f17c3caf19fbbdd9a30db460c9d9692335
MATLAB
4,363
120
function ch2roi_plot_AUC_allFB_allROI(GRUP, groupInfo) % plots AUC (area under the curve), or sum in certain time window, for % - clz 1 vs. baseline % - clz 2 vs. baseline % - clz 1 vs. clz 2 % (c) Jiri, Jun23 %% settings: AUC if ~isfield(groupInfo, 'AUC_settings') groupInfo.AUC_settings.baselineWindow =...
b0dbba322077877e1379aa9a7a632c3b9773158f9153d012255ba9496da43fcf
MATLAB
4,365
163
function varargout=shadedErrorBar(x,y,errBar,lineProps,transparent) % function H=shadedErrorBar(x,y,errBar,lineProps,transparent) % % Purpose % Makes a 2-d line plot with a pretty shaded error bar made % using patch. Error bar color is chosen automatically. % % Inputs % x - vector of x values [optional, can be left em...
4562717ad53fb609b313ad1cd374e378385f41c2e36f42fa5c8cdb74b0e73eee
MATLAB
4,366
118
function x = gen_gamma_integer_array(alpha, theta, L, N) % ATTTREC_GENERATE_GAMMA_INTEGER_ARRAY Allocate N integers via Gamma-proportional rounding. % % Syntax % x = atttRec_generate_gamma_integer_array(alpha, theta, L, N) % % Description % Draw L i.i.d. Gamma(shape=alpha, scale=theta) samples, convert them into a...
7a7b84361f306f9822aab51fc2e9bdfecaf6362f9de207adb803957ee8f97045
MATLAB
4,368
93
function plotHeatMap(fig, coordinates, heat, sensorDimension) %plot all rectangles into fig onto all coordinates and sets face color to %the value specified in heat fig; clf(fig); data = guidata(fig); %create custom grid g_y = 0:1:sensorDimension(1)+1; % user defined grid Y [start...
bc01bb1153c15863d2d93e4541d42e247adb3515071ce5522feebce1de0c10da
MATLAB
4,369
143
function run_permuvartest_examples %RUN_PERMUVARTEST_EXAMPLES Run one-sample bootstrap chi-squared test examples. % Generates random multivariate data for samples X. Each sample has 20 % variables, each with a standard deviation of 1, except for the first 10 % variables of X which have a standard deviation of 2....
723cd8995e4d98652bdc4cf67fda4d8c1cad149ceab75092810b5039d7698e82
MATLAB
4,372
128
% POP_READSEGEGI - load a segmented EGI EEG file. Pop up query % window if no arguments. % Usage: % >> EEG = pop_readsegegi; % a window pops up % >> EEG = pop_readsegegi( filename ); % no pop-up window % % Inputs: % filename - first EGI file name % % Outputs: % EEG ...
ce9923d42942f60e26e7de5c560813b13d63a1cbf2046e370e0e92d2f3620b5c
MATLAB
4,372
153
function plot_fig3e_right(datadir) % Plot dopamine AUC at the offer cue (0-0.5 s) vs -delta trial initiation % time, averaged across rats. N = 10 rats. % % INPUTS % datadir: file path of data downloaded from Zenodo. Link to download can % be found in README. fname = fullfile(datadir, 'data-published/deltaITI_vs_AUC.ma...
154f0c7b4aef3b7b8b43794d377175ec79d371a8681d2fffd0ba5e4cc318414e
MATLAB
4,373
153
function [deltaCVnLL, deltaAIC, deltaBIC, pvals, ratList] =... model_comparison(mdl1_projectname, mdl1, mdl2_projectname, mdl2,... nll_arg, aic_arg, bic_arg, plotarg, varargin) % Performs model comparison. All differenes are mdl2 - mdl1. % Inputs: % mdl1_projectname - Project name for model 1 % mdl1 - Model...
531ba290cd51e0390aa89558cca7158935fb16e66b90feabbfb4998325840ac9
MATLAB
4,373
110
% Convert feature prediction results fot deep image reconstruction % % Output files: % % decodedfeatures -+- imagery --- matconvnet -+- cnn1 -+- Subject1 -+- FFA --- Mat files % | | | | % | | | +- LOC...
f4b35b0ffe6d1cc0868ba0b9d59179de13ecbaa86070789fa1374be207acdb48
MATLAB
4,374
92
%% create MT = part of hMT+ which is not MST %this script create rois MT = part of hMT+ which is not MST by impleenting %rhMT minus rMst % MOST UPDATED and CORRECT feb 2024 % it is important to use these masks so that we identify the clusters which are not connected to other regions % hMT+: from visual Motion Local...
0565c3bf56096ed131507591728e1ee72cbeddd50367abbfe29dff833f2f1be5
MATLAB
4,375
137
function [result] = fit_happy_model_inequalitySimple(mtx,happyscore,constant) %assumes that each row of the cell array is a different subject rptfit = 5; %repeat N times jittering the betas tempf=fieldnames(mtx); for n=1:length(tempf), eval(sprintf('mtx.%s=double(mtx.%s);',tempf{n},tempf{n})); end; data = mtx; data.h...
0621fe3302c0c3ea010f0cd6a172582853b0700406c3c81e2e778d4b2a686d92
MATLAB
4,375
126
function varargout = raster2D_ani(s0, t0, t1, Ne1) %RASTER2D_ANI Animate a 2‑D raster from spike times. % RASTER2D_ANI(s0, t0, t1, Ne1) animates spikes binned in 2 ms steps % between times t0 and t1 (inclusive). If s0 has two rows, it is % interpreted as [t; linearIndex]; if it has three rows, it is % interpret...
4c931fa328424f57bf067fb9f29c1aa376e4e59978c4d23daf3a591144e862dd
MATLAB
4,375
137
function obj = setup_data(obj, terms) % obj = setup_data(obj, terms) % % Given a meta_dataaset object and terms, do the following: % 1) Select contrasts and voxels that meet cutoffs % 2) Load term text files % 3) Select studies that involve only one term % % % Parameters used, with default values from meta_dataset cons...
5fa0548031925619826f38b98734a0855c56066dc3ee2a029084666c15da6609
MATLAB
4,376
124
function outputImage = remove_clusters(this, varargin) % Removes all voxel clusters within a given range of voxel counts, and/or % a given range of percent of the area that is (approximately) filled; % either slice-wise or volume-wise (8 or 26 neighbours) using Matlab's % bwareaopen % % Y = MrImage() % clusterRemov...
7416d706cfe94c84d984b44c252f449cae7380922e7599754361adf821a8850d
MATLAB
4,376
127
% (C) Copyright 2020 CPP visual motion localizer developpers function [cfg] = expDesign(cfg, displayFigs) % Creates the sequence of blocks and the events in them % % The conditions are consecutive static and motion blocks % (Gives better results than randomised). % % Style guide: constants are ...
9c11169a3c2d004c68b7a8ce514b0889220718e02cb5215dfd8aeeb50d7d4036
MATLAB
4,376
126
% FILLCURVES - fill the space between 2 curves % % Usage: % h=fillcurves( Y1, Y2); % h=fillcurves( X, Y1, Y2, color, transparent[0 to 1]); % % Example: % a = rand(1, 50); % b = rand(1, 50)+2; b(10) = NaN; % figure; fillcurves([51:100], a, b); % % Author: A. Delorme, SCCN, INC, UCSD/CERCO, CNRS % Copyright (C...