sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
52e3de1017ca35fde6c25d41d79eff6ee2b83b6cd3be159e64dc5bddcc3478d4
MATLAB
2,434
67
%% when done with all subjects, write out inflated views % these images are our final inspections and quality assessments % OBSOLETE %mkdirquiet('~/Dropbox/KKTEMP/floc-faces-raw'); outputdir = '~/Dropbox/KKTEMP/floc-facesandwords'; mkdirquiet(outputdir); todo = {{'floc-faces' 'flocfacestval'} {'floc-words' 'flo...
dbaa84d33361adbe754cfcd4581c2b720d02e839a05453c4f03f6cc3004ce41a
MATLAB
2,434
74
function main(cfg) % MAIN Entry point for Myelin–FC Coupling analysis (MATLAB) % addpath(genpath(fileparts(fileparts(mfilename('fullpath'))))); % cfg = config.default_config(); if nargin < 1 cfg = config.default_config(); else % window for user to set FC modality cfg_default = config.default_config(); ...
321909521a101972026a844556e37266af02b64047047ecbd8c4a87647b7e9a4
MATLAB
2,437
56
%% this raster script is for use with MClust files rather than spike 2 Neuron = 9; %%total number of neurons Set = [1];%%%[0 2 4 5 6 7]; %% number your electrodes according to oep channels as needed oep 1, 2, 3 NeuronsInset = [9]; %%%[2 1 4 2 2 2]; %%represents the number of neurons that was sored for each for each...
862ca643e9cc224490c33378d39660e8aee74bc0567629af1d9ef37dbbe435c9
MATLAB
2,437
129
function Pipeline_plotInVivoData(params, plt) % This function plots in vivo data, filtered for photobleaching. analysisDir = getAnalysisDir(params); ExpInfoFn = getFileName(params, 'ExpInfo'); tsFn = getFileName(params, 'TS'); load(fullfile(analysisDir, ExpInfoFn)); load(fullfile(analysisDir, tsFn)); for i = 1:nume...
86a65fd503a25872b891e0f0e5047aebdbb46822c83806782e40a53fe3b8fbf0
MATLAB
2,437
62
main_path = './'; % MEG and MRI mat files can be downloaded from: % https://osf.io/pd4h9/overview % should be placed in the 'Dataset' folder under main_path % Required Toolboxes to run the code: %fieldtrip toolbox is required for anatomy transformation and preprocessing steps % https://www.fieldtriptoolbox.org/ %b...
c47829ad5319c43219b36f3920a3e6642fac95fa77892e8ccff38abbfb4117ca
MATLAB
2,437
68
% Here, we create some simple "probabilistic ROIs" % whereby we transfer manually defined ROIs in each of the 8 NSD % subjects to fsaverage and then compute the fraction of subjects % that are labeled at fsaverage vertex. % % We save both fsaverage .mgz files and also create some visualizations. %% %%%%% Compute and ...
728dded94e2303564b11a900a9b046379f1ee2a7dd1e64cedf2d4c1f4d5ed3f1
MATLAB
2,438
82
%% unitTest.m % This function performs a command line unit test based on the jobTesting.m file in the % ci folder. All Osprey modules are tested in dependence of the % included dataset. You can change the jobTesting.m file according to your desired % needs. The results unittest class includes detailed informati...
50d435f3ea6f7f4ea58b960182d10a19039fc71fd79bd7f920f85eeebf36f539
MATLAB
2,439
55
%% Figure 5 analysis % Runs regression analysis for all model configurations, for RADICaL rates % and for smoothed-deconvolved events % Model configurations: % Instantaneous, proximal-distal partial, spout-distance partial, causal % Wiener filter, acausal Wiener filter %% Preprocess data % Before running this script,...
c3320d16775e01367626074850c8500548c22e2636246fa38722ba8ffd23c778
MATLAB
2,440
69
function [encoderNet, decoderNet] = train_vae(encoderNet, decoderNet, XTrain, XTest) numTrainImages = size(XTrain, 4); executionEnvironment = "auto"; numEpochs = 250; miniBatchSize = 128; lr = .25e-3; numIterations = floor(numTrainImages/miniBatchSize); iteration = 0; avgGradientsEncoder = []; avgGradientsSquaredE...
2d23d8165294ce79093ec4d27275d081d9ae0ad106c50ebc688a0ebeb5fd4ed7
MATLAB
2,441
66
function SaveRippleEvents(filename,ripples,channelID,varargin) %SaveRippleEvents - Save hippocampal ripple (~200Hz oscillations) events. % % USAGE % % SaveRippleEvents(filename,ripples,channelID,options) % % filename file to save to % ripples ripple info as provided by <a href="matlab:help FindR...
d7cff186e9218432e916749be129130d10d30c3e275f4349129a43ab0e51980b
MATLAB
2,441
76
function pick = bbox_nms(boxes, overlap) % top = nms(boxes, overlap) % Non-maximum suppression. (FAST VERSION) % Greedily select high-scoring detections and skip detections % that are significantly covered by a previously selected % detection. % % NOTE: This is adapted from Pedro Felzenszwalb's version (nms.m), % but a...
0aceae470ae1a56a5af14682f94c8e9829fd102d80426c0740743bd3f038018a
MATLAB
2,442
101
function hout=suptitle(str) %SUPTITLE Puts a title above all subplots. % SUPTITLE('text') adds text to the top of the figure % above all subplots (a "super title"). Use this function % after all subplot commands. % Drea Thomas 6/15/95 drea@mathworks.com % Warning: If the figure or axis units are non-default, ...
274cde9fa91049e4c803458253de1e2042344fab83eaef3ea458fb1a9cf21212
MATLAB
2,442
92
% op_combinesubspecs.m % Jamie Near, McGill University 2014. % % USAGE: % out=op_combinesubspecs(in,mode); % % DESCRIPTION: % Combine the subspectra in an acquisition either by addition or % subtraction. % % INPUTS: % in = input data in matlab structure format. % mode = -"diff" adds the subspectra togeth...
aa732633b38e23f891ada0dd706f761311ac2aa8232312fe4a08f81db17a770b
MATLAB
2,444
57
% VL_NNROIPOOL CNN region of interest pooling. % Y = VL_NNROIPOOL(X, ROIS) pools each feature channel in X in % the specified regions of interest ROIS. ROIS is a 5 x K array % containing K regions. Each region has five coordinates `[t, u0, % v0, u1, v1]` where `u0`, `v0` is the upper-left corner of a ROI, % ...
c93e1549cf8ebf9073e78786fdee2e92ef4fdd89302288700c720910165ecbc3
MATLAB
2,444
71
function [K,dK] = covDiscrete(s, hyp, x, z) % Covariance function for discrete inputs. Given a function defined on the % integers 1,2,3,..,s, the covariance function is parameterized as: % % k(x,z) = K_{xz}, % % where K is a matrix of size (s x s). % % This implementation assumes that the inputs x and z are given as i...
e40b4f47248ae1260078672c8b736d5016b06474ce5c05615c5ff7e678732497
MATLAB
2,445
51
% calculate dFoverF for a response window and for a moving window, taking % the maximum response for each location function [DF_reponse,DF_master,DF_movie] = dFoverF(movie,offset,framerate,plot1,plot2,DF_movie_yesno,f0_window,response_window) % figure(66), plot(squeeze(mean(mean(movie,2),1))) % xy = ginput(4); xy = [ ...
fd617d56c807ea115e9eb80bb73041c70d77f348eb54a5c2600036e005b6d1ea
MATLAB
2,446
70
function diff = getDirectionalDerivative(problem, x, d, storedb, key) % Computes the directional derivative of the cost function at x along d. % % function diff = getDirectionalDerivative(problem, x, d) % function diff = getDirectionalDerivative(problem, x, d, storedb) % function diff = getDirectionalDerivative(problem...
2d66ef85d5fbaa5f53449917f3ae013ce2f886a66f085ba8eda3444dfcb25e25
MATLAB
2,447
87
function splitc = splitcode(code) %SPLITCODE Split a line of Matlab code in string, comment and other % SPLITC = SPLITCODE(CODE) splits line of Matlab code CODE into a cell % array SPLITC where each element is either a character array ('...'), % a comment (%...), a continuation (...) or something else. % Note that ...
1a2e7939c8f57f1ef11baa359a02e45e58343938ca030148537c878ad7b4d0ec
MATLAB
2,448
90
function [ DCM ] = tapas_ceode_synData_cmc() % [ DCM ] = tapas_ceode_synData_cmc() % % Sets parameters and function handles to create a synthetic DCM % structure. The resulting structure can then be used to generate % artificial data with tapas_ceode_gen_erp.m % % INPUT % % OUTPUT % DCM struct DCM st...
a30ea205545e513cfce42204cd42e22e475c2772c14f54579c5064df55e74152
MATLAB
2,448
60
function osp_ProTabChangeFcn(src,~,gui) %% osp_ProTabChangeFcn % This function is triggered when the process tab is changed. It refreshes % the figure. % % % USAGE: % osp_ProTabChangeFcn(src,~,gui); % % INPUT: src = handle of the fit tabs % gui = gui class containing all handles and t...
e97c73feb289691843be701b08de033b30fbf53cdabb58a77d440089434b8db2
MATLAB
2,448
50
% POP_STDWARN - check memory options and issue warning for studies. % % Usage: >> pop_stdwarn; % % Author: Arnaud Delorme, CERCO, 2007 % % See also: EEG_OPTIONS % Copyright (C) Arnaud Delorme, CERCO, 2007, arno@salk.edu % % This file is part of EEGLAB, see http://www.eeglab.org % for the documentation and details. % %...
f633d09f432fe5dd83208a5dbc0a40d5e7e385df609148e452e1264353868576
MATLAB
2,449
101
function plotSpectra(params, spectralData) % plots spectra for channels % spectralData = % info: [1x1 struct] % xVals: [60x1 double] ~ time % yVals: [129x1 double] ~ freq % cVals: [129x60x125 double] ~ time x freq x chnls % (c) Jiri, May16 %% basic check nCh = size(spectralData.cVals,...
e90f5b5988a4b3d81aabd39035c0136caf3da8e5d87b60bc97f0bce3af499419
MATLAB
2,450
67
function [embedding, scaled_eigval] = diffusion_mapping(data, n_components, alpha, diffusion_time, random_state) % DIFFUSION_MAPPING Diffusion mapping decomposition of input matrix. % embedding = DIFFUSION_MAPPING(data,n_components,alpha,diffusion_time) % computes the first n_components diffusion components of ma...
0649839a165e37a59d513735a66836a6305b9d3071564b3e21c1dec54a372523
MATLAB
2,451
95
function [S_m_noise]= Phantom_Simulation_BiExp_Relax_Pixel(Phantom,N,b_values,TE,TR) % This function creates a 2D IVIM phantom dataset using the input % parameters in the phantom struct and input parametrs % % USAGE: % [S_m_noise]= Phantom_Simulation_BiExp_Relax_Pixel(Phantom,N,b_values,TE,TR) % % INPUTS: % ...
805250fb17e334519e5746bd391cae39f43e4a2c0f09be88a2aa07de80f88596
MATLAB
2,451
90
dirname = '~/proj/networkFVMsims/examples/'; %% total flux out of holes filename = [dirname 'example1_ca.out']; [fluxsim,tvals] = loadTotFluxSim(filename); if (tvals(1)~=0) tvals = [0; tvals]; fluxsim = [fluxsim(1); fluxsim]; end vals = sum(fluxsim,2); integ = (vals(2:end)+vals(1:end-1))/2; dt = diff(tvals); ...
aea2c5dc5807f852264c3d7e5b70bd01fdb7a8df5e3a6a8510cac6403f483b81
MATLAB
2,451
69
function tapas_rw_binary_dual_plotTraj(r) % Plots the estimated or generated trajectories for the binary HGF perceptual model for multi-armed % bandit situations. % % Usage example: est = tapas_fitModel(responses, inputs); tapas_rw_binary_dual_plotTraj(est); % % --------------------------------------------------------...
57b8a6565c5359ecaca6b20bf3bc5b4bcb77450ab4e481a828d69413803757dc
MATLAB
2,452
72
function grad = fif2grad(filename) % FIF2GRAD constructs a gradiometer definition from a Neuromag *.fif file % The resulting gradiometer definition can be used by Fieldtrip for forward % and inverse computations. % % Use as % grad = fif2grad(filename) % % See also CTF2GRAD, BTI2GRAD, MNE2GRAD, ITAB2GRAD, YOKOGAWA2GRAD...
9cd3b74f72aaa0050b69d6a01c5adbceecbdc5fb6139fcd67306186b97d41e5b
MATLAB
2,452
71
function continuous_tone_cursor % Global variables to share state between callbacks. global currentFreq phase ap dt fs fig ax; % Initialize frequency and phase. currentFreq = 200; % Starting frequency (Hz) phase = 0; % Initial phase for continuity % Audio parameters. fs = 4...
d4a8fa18f97909617df8f7be908b2af95da73f81f053367fe9a26ecb29752886
MATLAB
2,452
71
function map = tab20(N) % Qualitative colormap from MatPlotLib, for plots using the line ColorOrder. % In MatPlotLib 2 it is named VEGA20, for MatPlotLib 3 was renamed TAB20. % % Copyright (c) 2017-2020 Stephen Cobeldick % %%% Syntax: % map = tab20 % map = tab20(N) % % For MatPlotLib 2.0 improved colormaps were creat...
635e6aab3d5c55752c8ae1f4468db60262d943a41df40a76ea873f9e0f2d9d28
MATLAB
2,454
100
function result = GGclust(data,param) %checking the parameters given f0=param.c; %data normalization X=data.X; if exist('param.m')==1, m = param.m;else m = 2;end; if exist('param.e')==1, e = param.m;else e = 1e-4;end; [N,n] = size(X); [Nf0,nf0] = size(f0); X1 = ones(N,1); % Initialize fuzzy partition matrix rand...
a20df7949f63f743df35b37ce32b9f0b3f6588dc2008ee2d4629bb56ec7de65e
MATLAB
2,455
89
function [swf] = read_besa_swf(filename) % READ_BESA_SWF % % Use as % [swf] = read_besa_swf(filename) % % This will return a structure with the header information in % swf.label cell-array with labels % swf.data data matrix, Nchan X Npnts % swf.npnt % swf.tsb % swf.di % swf.sb % Copyright (C) 2...
20150215d02c56bbfe08dec79beea4bd71ff6280de4241b61ff1d0f673b0700e
MATLAB
2,458
100
function test95() % function test95() % % Test for symfixedrankNewYYquotientfactory geometry (low-rank PSD matrix completion) % This test is different from 'test98'. We use the tuned geometry, % symfixedrankNewYYquotientfactory. % % This file is part of Manopt: www.manopt.org. % Original author: Bamdev Mishra, Dec. 30...
e10af9cfdee256348eea50318c0cf81460519760714278eca81a44afe10bc306
MATLAB
2,458
41
function B1Tx_GroupAverage(myelinFile, myelinAsymmOutFile, phaseFile, phaseAsymmOutFile, myelinCorrOutFile, myelinCorrAsymmOutFile, fitParamsOutFile) %Orig Myelin, with receive corr if applicable MyelinMap = cifti_read(myelinFile); surfasymmnorm(MyelinMap, myelinAsymmOutFile, 'Group Myelin Asymmetry');...
50d3a76f0bdcc376ae2951fcb75004b4b8d3c8233e9d80a9491f982194b58aeb
MATLAB
2,460
85
function p = PlotSamples(X,varargin) %PlotSamples - Plot samples (multiple time series). % % Plot columns 2...M of a matrix as a function of its first column. % % USAGE % % p = PlotSamples(X,<options>,<options2>) % % X <a href="matlab:help samples">samples</a> to plot % <options> optional l...
5b029280137512daf358785ac39aa209813d9f00a23d4eb8cdd0f97eaeedee74
MATLAB
2,460
80
function flt = constructsmoothingfilter(sd,thresh) % function flt = constructsmoothingfilter(sd,thresh) % % <sd> is [A B C] with standard deviations of a 3D Gaussian filter along the % first, second, and third dimensions. you can also specify [A B] in order % to obtain a 2D Gaussian filter. % <thresh> is threshol...
6fc9bdd588bf22cd5a5857fc84188a2b973f0e69289371715471cb6b36469507
MATLAB
2,460
60
% STD_SAVEDAT - save measure for computed data % % Usage: std_savedat( filename, structure); % % Authors: Arnaud Delorme, SCCN, INC, UCSD, 2006- % Copyright (C) Arnaud Delorme, SCCN, INC, UCSD, October 11, 2004, arno@sccn.ucsd.edu % % This file is part of EEGLAB, see http://www.eeglab.org % for the documentation and ...
d9299c559d0de6db6fe4a948aebd6819d60c3b99d11bcf9f0601e03ced97bdf1
MATLAB
2,460
61
function CORnet_vs_Neural_Dissimilarity(IT_Fam_FR,HC_Fam_FR,IT_Fam_VE,HC_Fam_VE,IT_Lure_FR,HC_Lure_FR,IT_Lure_VE,HC_Lure_VE,HC_Fam_FV,HC_Lure_FV,IT_Fam_FV,IT_Lure_FV,times_analyze) %This function compares the neural similarity of CORnet to that of the %recorded neural population. It fits both a linear and a quadratic f...
e4cf6dabc1611025abbf7b8393a812369f5bc14fd891add8f732f185ed0fdb8c
MATLAB
2,460
87
%USER_STRING Get/set a user specific string % % Examples: % string = user_string(string_name) % saved = user_string(string_name, new_string) % % Function to get and set a string in a system or user specific file. This % enables, for example, system specific paths to binaries to be saved. % % IN: % string_name - ...
0407cc6e78f05b14a55b1b31b64e6462a6efc1837def443b22c4371459e9dd40
MATLAB
2,461
71
function map = tab20c(N) % Qualitative colormap from MatPlotLib, for plots using the line ColorOrder. % In MatPlotLib 2 it is named VEGA20C, for MatPlotLib 3 was renamed TAB20C. % % Copyright (c) 2017-2020 Stephen Cobeldick % %%% Syntax: % map = tab20c % map = tab20c(N) % % For MatPlotLib 2.0 improved colormaps were ...
fe12a00daeb9f04551bceedf5fdaa97e246a3b64f6407e47b2e6086a661e0a99
MATLAB
2,461
71
function map = tab20b(N) % Qualitative colormap from MatPlotLib, for plots using the line ColorOrder. % In MatPlotLib 2 it is named VEGA20B, for MatPlotLib 3 was renamed TAB20B. % % Copyright (c) 2017-2020 Stephen Cobeldick % %%% Syntax: % map = tab20b % map = tab20b(N) % % For MatPlotLib 2.0 improved colormaps were ...
9e68911854f4aff6b5d86eccce741bbea68f80595ea162fb3125b5cbcd5e7e8a
MATLAB
2,462
61
function savefig_pdf(h,filename,orientation) %% ######################################################################## % - Save plot as vector image in .pdf format % ######################################################################### % [Note:] As I keep forgetting the function and criteria, here's a simple % fu...
842d3aa957750051e5a7df4c4398127871a990448e28e956c857939c7ebbc8fa
MATLAB
2,463
78
function make_clicky(infig,outfig,hsi_img,wavelengths) % %function make_clicky(infig,outfig,hsi_img,wavelengths) % % adds a callback to a given figure to display spectra for a pixel when % clicked % % infig - figure handle of figure to add click ability % outfig - figure handle of figure to display spectra % hsi_img - ...
3c20be84b283f3b1d9161b50cef66acda4692d54e45691527d8eedc5cd863509
MATLAB
2,464
84
function [dimInfo, NewAffineTrafo] = ... perform_world_space_operation(this, operation, parameters, dimInfoIn) % Computes new dimInfo and affineTrafo % % Y = MrImageGeometry() % [dimInfo, NewAffineTrafo] = Y.perform_world_space_operation(operation, ... % parameters, dimInfoIn) ...
78a50f6ac118dd06e1840f696843912e1e90b92a663acd8ac70e065d6408fee1
MATLAB
2,465
97
%perm difference plotter addpath("~/ER_Ca_rot/networkSpreadFVM-main/scripts/"); addpath("~/ER_Ca_rot/networkSpreadFVM-main/examples/"); dirname = "~/ER_Ca_rot/networkSpreadFVM-main/examples/inf_Perm_op/mesh_4"; dirname1 = "~/ER_Ca_rot/networkSpreadFVM-main/examples/200_perm_op"; ar = [0.0001,0.0005,0.0024,0.0111,0.0500...
cb2d9d27f54ee4a18dce216060e702f2b3777f867213016848d5d33dcb861d14
MATLAB
2,465
84
function gcdf = palm_gcdf(G,df1,df2) % Convert a pivotal statistic computed with 'pivotal.m' % (or simplifications) to a parametric p-value. % The output is 1-p, i.e. the CDF. % % Usage: % cdf = palm_gcdf(G,df1,df2) % % Inputs: % G : G or Z statistic. % df1, df2 : Degrees of freedom (non infinite). % ...
5b8c9c856bc13b95cc27681132e9e8ea924cbfd0fa69a168fb28887c072a1ce1
MATLAB
2,467
60
% RSGET - get the p-value for a given collection of l-values % (Ramberg-Schmeiser distribution) % % Usage: p = getfit(l, val) % % Input: % l - [l1 l2 l3 l4] l-values for Ramberg-Schmeiser distribution % val - value in the distribution to get a p-value estimate at % % Output: % p - p-value % % Autho...
04411938a9eb15b22029560c7157ca657574d9523d3edc34e466545e2c4a65ad
MATLAB
2,468
51
% pop_checkdatasetinfo() - Check for consistency between STUDY and ALLEEG % Fields covered: filename, subject, condition, % group, session, run. % % Usage: % >> [STUDY, ALLEEG] = pop_checkdatasetinfo(STUDY, ALLEEG); % % In...
439cbfb33911dee4e508154a44c59da1e9be52032e7d863673a008ce5b92c7c1
MATLAB
2,468
79
function clout = weighted_knn(data,clas,k) % function clout = weighted_knn(data,clas,k) % used in tor_knn % % this function gives class assignments weighted by the reciprocal of prior class % probabilities, so that smaller classes are not penalized. % this is expected to optimize sensitivity (d-prime) to class membersh...
55da53e7677b4da29fe6cb9e5d1241fbf748772136888559e9e9490b706ed84e
MATLAB
2,468
72
function [adjMs, F1] = generateAdjMs(spikeTimes, ExN, Params, Info, oneFigureHandle) % Create AdjM for a series of lag values % % Parameters % ---------- % spikeTimes : % ExN : % Params : struct % MEA-NAP Parameter structure % Info : struct % % Returns % ------- % adjMs : % F1 : figure handle ...
f15af889b21f2b82c4e01a3ce8819cb4fcba148559da104bc8af9972e6710f3f
MATLAB
2,468
97
%% === compare timings for MULT choice = questdlg('Run full comparison (several minutes)?', ... 'Performace Comparison', 'Yes','No','Yes'); if strcmp(choice,'No') return end % number of repeats (to increase measurement accuracy) R = 10; % what sizes of (square) matrices do we want measure? (log spacin...
6677676fbbf9376bd1d74861f5447857a119986c40dbfc505a046ea6906d25c8
MATLAB
2,469
54
function [Operations,MasterOperations] = TS_LinkOperationsWithMasters(Operations,MasterOperations) % TS_LinkOperationsWithMasters Link Operations with MasterOperations using Label field % ------------------------------------------------------------------------------ % Copyright (C) 2013-2026, Ben D. Fulcher <ben.d....
822a3c5e8e83a9535262f1f81064722a935825b72f0d8db39069f49041366bfa
MATLAB
2,470
93
function fear_getHfoFrMod(basename) % basename='~/data/Fear/triple/hoegaarden181115/hoegaarden181115'; load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) %% load([basicMetaData.Basename '.okUnit.spikes.mat']) load([basicMetaData.Basename '.se...
b6f3aa969a6dfa1f102201fa5cb2cb32510fe709a1c6b339222073fc5c308580
MATLAB
2,470
72
function matchFigureAspectRatio(varargin) % MATCHFIGUREASPECTRATIO Match figure window to paper aspect ratio % % Syntax: % matchFigureAspectRatio() % matchFigureAspectRatio('Name', Value, ...) % % Description: % Adjusts figure window size to match paper dimensions for accurate preview. % % Inputs (Name-Value pair...
30457b96e956d68257a8852305cb4c3a3f3369a5b76fe468c814c30dbbb74298
MATLAB
2,471
90
function this = append(this, otherImage) % appends other MrImage (of same 3D geometry) via 4th dim to end of MrImage % % Y = MrImage() % Y.append(otherImage) % % OR % % Y.append(fileName); % % OR % Y.append(dataMatrix); % % This is a method of class MrImage. % % IN % % OUT % % EXAMPLE % Y = MrImage()...
b813352f6281d460bb8bd36e5c0efcf847b1a23a7cc2dadc987328d2831fa59b
MATLAB
2,471
73
function [Wrr,Wrf] = generate_weights_random(Ne,Ni,Nx,Prr,Prx,varargin) % GENERATE_WEIGHTS_RANDOM Random (Erdos–Renyi) connectivity without spatial/tuning structure. % % Syntax % [Wrr, Wrf] = generate_weights_random(Ne,Ni,Nx,Prr,Prx, Name,Value, ...) % % Description % Constructs random connectivity lists according...
1089a86c9ed9df0b75226238ff2778bdff361970e74b83484b6cb81b0756ab59
MATLAB
2,472
90
function [ DCM ] = tapas_ceode_testData_erp() % [ DCM ] = tapas_ceode_testData_erp() % % THIS IS A SCRIPT SOLELY FOR TESTING THE SPM/TAPAS SETUP. DO NOT CHANGE! % % Sets parameters and function handles to create a synthetic DCM % structure. The resulting structure can then be used to generate % artificial data with tap...
e06f8d8a6dbf6c34883e17dde627aadd57c20eaf41866388461875a6e026f569
MATLAB
2,472
101
% op_averaging.m % Jamie Near, McGill University 2014. % % USAGE: % out=op_average_extra(in,which); % % DESCRIPTION: % Combine the averages in a scan by adding the averages together and then % dividing by the number of averages. % % INPUTS: % in = input data in matlab structure format. % % OUTPUTS: % out = Output...
189a89647765227dda0eab169e279b57f23352879a9588a4968fcb4f87d2ac03
MATLAB
2,474
109
function FigureS13(datadir, codedir) %FigureS12 Males and females have comparable wait time ratios (top) and % trial initiation time ratios (bottom) % datadir = directory of dataset % codedir = director of code %% Set up paths s = pathsep; pathStr = [s, path, s]; onPath = contains(pathStr,... codedir, 'Ignor...
b3da556fb4eb32663dac40dfd2139d003e3f324e72f65c08201df2b1d4e88a08
MATLAB
2,474
54
%% load libraries run('set_library_paths.m'); addpath(SPM_PATH); % per spm docs, do not genpath it addpath(genpath(CANLABTOOLS_PATH)); %% VARIABLES THAT MUST BE DEFINED BEFORE THE SCRIPT IS SOURCED % THIS SCRIPT IS DESIGNED TO RUN ACROSS A SINGLE TASK % aggregating over subject-level 1st-level SPM beta or contrast sta...
bd6108371b23678256b4016b61207a9387acd146ee3b266f366228f66f8c80fc
MATLAB
2,474
76
%% draw the fig5a clear; working_dir = 'G:\CEST-fMRI'; % the actual directory to put the codes gen_figure_path = [working_dir,'\gen_figures']; addpath(genpath(gen_figure_path)); load_dir = [working_dir,'\scripts\loading']; load([load_dir,'\Fig5_map.mat']); set(0,'defaultfigurecolor','w'); figure; set(gcf,'...
5736f274b14c39fa29a0e2daa3e4bc5c6779018b1ae4c39e9bb6f62d243ffc27
MATLAB
2,475
90
function [dimLabels, resolutions, nSamples, units, firstSamplingPoint] = ... read_nifti(~, fileName) % Reads nifti files and extracts properties for dimInfo % % Y = MrDimInfo() % [dimLabels, resolutions, nSamples, units] = Y.read_nifti(fileName) % used in Y.load(fileName) % % This is a method of class MrDimIn...
709ced415bcbe042317a125dc3c0ae588776e435b8dcb86675212dcdd4e58b76
MATLAB
2,478
63
% Mean functions to be use by Gaussian process functions. There are two % different kinds of mean functions: simple and composite: % % Simple mean functions: % % meanZero - zero mean function % meanOne - one mean function % meanConst - constant mean function % meanLinear - linear mean function...
ccbc7ff595e1345adbd4fb6084170ea64606196cce5ddb574e652713a5ffeab9
MATLAB
2,478
62
% BIDS �ļ���·�� BIDS_folder = '/mnt/e/Neuroimage/Projects/QSM_process/YT_QSM_BIDS'; % ���������ļ���·�� derivatives_folder = fullfile(BIDS_folder, 'derivatives'); % ��������� derivatives �ļ��У��򴴽� if ~exist(derivatives_folder, 'dir') mkdir(derivatives_folder); end % SEPIA ����ļ���·�� SEPIA_output_folder = fullfi...
11e8eeef73221ba4bf2e8f362067df360bc99b69a17696aedddced5251ded08c
MATLAB
2,479
57
% TRIAL2EEGPLOT - convert eeglab format to eeplot format of rejection window % % Usage: % >> eegplotarray = trial2eegplot(rej, rejE, points, color); % % Inputs: % rej - rejection vector (0 and 1) with one value per trial % rejE - electrode rejection array (size nb_elec x trials) also % made of 0 and ...
3186ac4bc333049ea641c7045f05fbe93c3d38a0e5e268c2d88f18a1a1057e58
MATLAB
2,479
103
function test07() % function test07() % % Computes a robust mean of angles % % This file is part of Manopt: www.manopt.org. % Original author: Nicolas Boumal, Dec. 30, 2012. % Contributors: % Change log: % Generate the data N = 250; theta_true = pi*(2*rand(1)-1); thetas = zeros(N,1); p_true ...
a1f1605561ce99ae40d0dc9efa50d97b3369c872cf0c2cacd0a405d2661f1b6d
MATLAB
2,479
57
function cleanExtractFiles(path) % figure position for home workstation [1383,953,1920,970] / lab workstation [6,1241,1920,970] options.skipCleanFile=true; filelist = dir(fullfile(path, '**\DemixingEXTRACT')); if isempty(filelist) error('no extract output file detected in any subfolder') else k=1; w...
340cdd94ca70ce4e6cd30a0a04581afd006c8b0f194ac7e09f6f1372c0a9bd46
MATLAB
2,480
74
function [corr_results, p_values] = BinderRSA(varargin) % RSA correlation analysis between concept and semantic RDMs % % Usage: % [corr_results, p_values] = rsa_correlation_analysis() % [corr_results, p_values] = rsa_correlation_analysis('RandomConcept', true, 'Alpha', 1e-3) %% Setup p = inputParser; addP...
53d7bf1f104c0687ebf03bf141936c8666e7138f8a3d48285c259efa2d44422f
MATLAB
2,480
83
function [folderStructure,summary]=preprocPaths(preprocessedRoot,varargin) % % HELP % Creating folder structdure for preprocessing outputs. % SYNTAX %[folderStructure,summary]= preprocPaths() - use 1 if no arguments are allowed %[folderStructure,summary]= preprocPaths(preprocessedRoot) - use 2, etc. %[folderStructure,s...
212ab08af33c9e78313e4468c0fb8c94c286967bdd16443909a3681898d4b7d6
MATLAB
2,481
90
function [cellList,figH]=extractCheckCellManual(output,varargin) % can input your own cell list. % % options.cellList=[]; options.waitForUser=true; options.frameRate=700; options.positionFig=[100,100,800,400]; %% UPDATE OPTIONS if nargin>1 options=getOptions(options,varargin); end %% if isempty(output.temporal_...
c1c733fb10207e349e8f9ae8dae5e5f3231638ac8eb32011cc216850b37d049a
MATLAB
2,481
59
function merged = MergeStructures(structure1,structure2,dim) %MergeStructures - merge two structures into a single structure % % This function concatenates each of the fields of structure1 and % structure2 along dimention 'dim' (default = 1). % If the sizes of the field contents are not compatible (e.g. cannot % c...
f314ce67e605d50c7e9d3e9ec98e1b7aed1b8048e13286f85384e886676a2af2
MATLAB
2,481
78
function [fList,isFine] = tapas_diagnose(toolbox_names,options) % TAPAS_DIAGNOSE Checks if toolbox uses functions which are overloaded % % IN % toolbox_names [character vector or cell array of character vectors] % Toolboxed to be diagnosed. If no toolbox is specified, all toolboxes % are checked. This can take a wh...
20612db11abd87a56da62cf5b65eb0acd3c28703f556ca68a82036c8866d3668
MATLAB
2,484
53
%% tb = sepiatest.discover_toolboxes() % % Description: reports which of SEPIA's optional external toolboxes/add-ons % are actually installed and reachable on this machine, by reading the % same SpecifyToolboxesDirectory.m that sepia_addpath.m uses (auto-created % from the template on first call if missing, all paths e...
855bbf15e6de123b7574e501d86417a1390f5c2ec9ece639ea5a5691b6bfe534
MATLAB
2,484
65
%% clear;clc; [mask,vox,header] = rest_readfile('E:\matlabtool\DPABI_V8.2_240510\Templates\GreyMask_02_61x73x61.img'); %% load input and average patterns = {'Yumodel_*_concept','*Yumodel_*_cdp1', '*Yumodel_*_cdp2', '*Yumodel_*_cdp3'}; FolderName= {'CA1','CA2','CA3'}; RootPath = 'E:\YuLab\fMRI_results\Searchligh...
3330ee584becf99ecfbe2bae16d39e2287bed4a5f00e5116bc8aaf14a7d69143
MATLAB
2,486
63
%% ============================= % PALM Analysis: extinction CS × TUS % ============================= % --- Locate repo root (relative to this script) thisfile = mfilename('fullpath'); [scriptdir, ~, ~] = fileparts(thisfile); cd(scriptdir); % Ensure consistent working dir % Navigate up to FEARTUS root % palm_code -...
37aa4d9229ba6401c5f870613b011a7e1a195c95f09845aa24827753624df0bc
MATLAB
2,486
79
clc; clear; atlas = cifti_read('C:\Users\lihon\Desktop\abcd_study\atlas\Schaefer\Schaefer2018_400Parcels_17Networks_order.dlabel.nii'); atlas_parcel = atlas.cdata; atlas_label = unique(atlas_parcel(atlas_parcel>0)); num_parcel = length(atlas_label); % load regionwise prediction accuracy on PNC and HCP-D pnc_dir = 'C...
425b26b6c70302dadfceb809dca734ca39fdbbaf37983748ce1f6fdbc0b63d2e
MATLAB
2,486
63
%% ============================= % PALM Analysis: extinction CS × TUS % ============================= % --- Locate repo root (relative to this script) thisfile = mfilename('fullpath'); [scriptdir, ~, ~] = fileparts(thisfile); cd(scriptdir); % Ensure consistent working dir % Navigate up to FEARTUS root % palm_code -...
17d5cf6ae3eb2d37f0b56c470c8acfdfe4a42c1f3a5eb6dcb8107c56dd75c860
MATLAB
2,487
63
%% ============================= % PALM Analysis: Acquisition CS × TUS % ============================= % --- Locate repo root (relative to this script) thisfile = mfilename('fullpath'); [scriptdir, ~, ~] = fileparts(thisfile); cd(scriptdir); % Ensure consistent working dir % Navigate up to FEARTUS root % palm_code ...
29c2260591e78907266f44cc87b6ec3428f5563418d781cad724773209ebe0cf
MATLAB
2,487
75
% EEG_FINDBOUNDARIES - return indices of boundary events % % Usage: % >> boundaryIndices = eeg_findboundaries(INEEG); % >> boundaryIndices = eeg_findboundaries(INEEG.event); % % Inputs: % INEEG - input EEG dataset structure. Used to check if event % types are string or numerical. % % Out...
2a9264ee93506c78282716416530b68cf6f2b60c3b4965fbf0140a2576420f29
MATLAB
2,487
59
function [event_frames,onset_delays,video_event_times,juv_present_frames] = load_align_dlc_events(paq_paths,dlc_paths,dlc_fd_name,Fs, varargin) % onset delay > 0 if miniscope was started after video num_sessions = numel(paq_paths); % load dlc_struct and align to paq recording_duration = 0; event_frames = cell(1,nu...
5bfc6358a373fb703e53300e869630e9f523da6ce7f67a40a4f4409c92a07ac2
MATLAB
2,487
90
function analyzebehavior_floc(datadir,num_TR,stimulus_delay) % <num_TR> = 312; % total number of TRs desired % <stimulus_delay> = 12; % delay in seconds at beginning ppdir = regexprep(datadir,'rawdata','ppdata'); mkdirquiet(ppdir); % load behavioral files stimulusfiles = matchfiles([datadir '/mat_files_from...
804261ad3ed31ea92d541f234c23fff76f45e77d397db2e59ae583929d884f3e
MATLAB
2,487
63
%% ============================= % PALM Analysis: Acquisition CS × TUS % ============================= % --- Locate repo root (relative to this script) thisfile = mfilename('fullpath'); [scriptdir, ~, ~] = fileparts(thisfile); cd(scriptdir); % Ensure consistent working dir % Navigate up to FEARTUS root % palm_code ...
8962afd3a3980fbf17763eda6d18b1f69da1d92a13aec24a1c18bf4d1d0f6ff6
MATLAB
2,487
54
function varargout = gpr(hyper, cov, x, y, xs) % gpr - Gaussian process regression, with a named covariance function. Two % modes are possible: training and prediction: if no test data are given, the % function returns minus the log likelihood and its partial derivatives with % respect to the hyperparameters; this mod...
32a0ebcb7269d4d90240d602dd997b7caae06761f77be023e665a9dc9db5d7a0
MATLAB
2,488
64
%% Standard script to validate input sepia header % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 22 Jan 2021 % Date modified: 12 August 2021 (v1.0) % Date modified: 4 July 2025 % function sepia_header = validate_sepia_header_4wrapper(sepia_header, outputNiftiTemplate) sepia_universal_variables; dis...
8f1d41b46e7a706d848d9d7724f92cef3c4dcded743a9eedca759b80eddbfe13
MATLAB
2,488
79
function tor_spm_mean_ui(P,varargin) %tor_spm_mean_ui(Pinputnames,[outputname]) % promts for a series of images and averages them % FORMAT spm_mean_ui %_______________________________________________________________________ % % spm_mean_ui simply averages a set of images to produce a mean image % that is written as typ...
2ada4a622fb6f7bc3af81005918b11564fb47cce85df611b9383391e3a45a714
MATLAB
2,489
74
function [K,dK] = covFBM(hyp, x, z) % covFBM Fractional Brownian motion covariance with Hurst index h from (0,1). % % [K,dK] = covFBM(hyp, x, z) % % The hyperparameters are: % % hyp = [ log(sf) % -log(1/h-1) ] % % For h=1/2, this is the Wiener covariance, for h>1/2, the increments are % positively correlate...
51d9e924d46fae1bbc98ffcf45788f5e46528aa3e475cbcd6b34e09d5d690617
MATLAB
2,489
81
function [times,id,group] = CCGParameters(varargin) %CCGParameters - Reformat time series for CCG computation % % USAGE % % [times,id,group] = CCGParameters(series1,group1,series2,group2,...) % % series1... time series (one column) with optional IDs (in the second % column, such as obtaine...
9a2b0e82f82b3d8ce77f198f00f7fadfc552a9d56724c7be41564c08fe87a825
MATLAB
2,489
85
function [ DCM ] = tapas_rdcm_generate(DCM, options, SNR) % [ DCM ] = tapas_rdcm_generate(DCM, options, SNR) % % Generates synthetic fMRI data under a given signal to noise ratio (SNR) % with the fixed hemodynamic convolution kernel % % Input: % DCM - model structure % options - estimation opt...
d42148420322e6c0bc2b5eddab4b26836897a79a41df6997c92dc42dc525afe5
MATLAB
2,489
76
%% stats = sepiatest.mask_stats(img, maskLogical) % % Description: computes a small set of summary statistics of img inside % maskLogical, used as the regression-comparison payload instead of a % full-resolution array diff (which is brittle across MATLAB/BLAS/FFT % library versions for iterative solvers). Also returns ...
1a203f2a7f651e52fca6a4afefe4d1d344291ba2894a025401788c5afe4147ec
MATLAB
2,490
69
function X = lyapunov_symmetric(A, C, tol) % Solves AX + XA = C when A = A', as a pseudo-inverse. % % function X = lyapunov_symmetric(A, C) % function X = lyapunov_symmetric(A, C, tol) % % Matrices A, C and X have size nxn. When the solution exists and is % unique, this is equivalent to sylvester(A, A', C) or lyap(A, -...
4692b7c40e517624f89f864a5d2a8fbcbc7242b181040e258df96aa1828dc488
MATLAB
2,490
67
function osp_onRightExp( ~, ~ ,gui) %% osp_onRightX % Callback function on process click on left x voxel direction button. % % % USAGE: % osp_onRightX( ~, ~ ,gui); % % INPUT: gui = gui class containing all handles and the MRSCont % % OUTPUT: Changes in gui parameters and MRSCont are written...
7299b53e07eb078631850e04942e9ac502b8ff6d93486dc7b0913858e921d76e
MATLAB
2,491
77
function names = osp_import_Tarquin_metabolite_names(filename, startRow, endRow) %IMPORTFILE Import numeric data from a text file as a matrix. % names = IMPORTFILE(FILENAME) Reads data from text file % FILENAME for the default selection. % % names = IMPORTFILE(FILENAME, STARTROW, ENDROW) Reads % data from rows ...
cb07383cfd059ad5f32b68f112f13bfa2269df2de2128816f4a359190a1948cf
MATLAB
2,491
63
function [this_avg_activity,event_frames] = get_photo_episode_mean(mat_activity,event_frames,photo_on_frames,photo_off_frames, this_programs) if ~iscell(this_programs) this_programs = {this_programs}; end fds = fields(event_frames); for i = 1:numel(this_programs) this_program = this_programs{i}; [t...
0850662ad9955888281498f3d9901503ccdc1b3074933a10af7c09082f60bdfc
MATLAB
2,492
72
function this = extract(this, image, mask) % Extracts data within mask from given image % % Y = MrRoi() % Y.extract(image, mask) % % This is a method of class MrRoi. % % IN % image MrImage of which data shall be extracted within mask % mask MrImage (binary mask), of which voxels shall be extracted ...
24b7a5b6e817b06089b5ce7d861632bea955815b65078e0d926077e193bfa841
MATLAB
2,492
101
function [WUinit] = init_template(ops) nt0 = ops.nt0; Nchan =ops.Nchan; Nfilt = ops.Nfilt; Nrank =ops.Nrank; tps = [1 5 10 25 40 50 61]; tps = round(tps * nt0/61); vs = [0 0 0 -2 1 0 0]; fs= interp1(tps, vs, 1:nt0, 'linear', 'extrap'); W(:,1,1) = my_conv(fs, 2); tps = [1 5 10 25 40 50 61]; tps = round(tps * nt0/...
9c78d33764a728680e098faf149045810f5efc94e4a03b61f6240e78afd371dd
MATLAB
2,492
67
%function ch2roi_selFreq(params, groupInfo) % groups channels into defined ROIs (anatomic areas), averages & plots % based on the following criteria: % - selected anatomical areas (groups) % - selected freq. band % - significance (difference of conditions, from baseline (TO DO), or all) % settings (subjects, dire...
f8d8ad7f1339eeb4d2e4e3c1f0317f500349dc759b900d6a9d16c4a8b2874a94
MATLAB
2,493
82
%% unitTest.m % This function performs a command line unit test based on the jobTesting.m file in the % ci folder. All Osprey modules are tested in dependence of the % included dataset. You can change the jobTesting.m file according to your desired % needs. The results unittest class includes detailed informati...
394a6311af6c76116411c3a1512a7befeacbbb9701874a6fb0fc488f8b61b627
MATLAB
2,494
83
function y = vl_nnsoftmaxloss(x,c,dzdy) %VL_NNSOFTMAXLOSS CNN combined softmax and logistic loss. % **Deprecated: use `vl_nnloss` instead** % % Y = VL_NNSOFTMAX(X, C) applies the softmax operator followed by % the logistic loss the data X. X has dimension H x W x D x N, % packing N arrays of W x H D-dimensional...
fd11738503fe8bfe00b61475057f9863c3e2f56e6d26af0637f00b5045ded132
MATLAB
2,494
59
function [outdata, outsform1, outroi] = cifti_struct_dense_extract_volume_all_data(cifti, cropped, dimension) %function [outdata, outsform1, outroi] = cifti_struct_dense_extract_volume_all_data(cifti, cropped, dimension) % Extract the data for all cifti volume structures, expanding it to volume frames. % ...
7d863400b50ae2042402e8bdc15029bf7007b281c4823d2eb68ec1b7db1fb588
MATLAB
2,495
78
function h = plotpval(ax, xpos, ypos, pval, color, pexact,pname,minp,plotline,numonly,minifz,fz,numsigdig) % h = plotpval(ax, xpos, ypos, pval, color, pexact,pname,minp,plotline,numonly,minifz,fz,numsigdig) % add pval next to significance bar in a figure % adapted from mysigstar.m, written by Anne Urai % (in turn adap...
99fd5ce8b14cfda5dc5b219cc77f933a1fad0fce8239f46bc61e2c2bebf3c11a
MATLAB
2,495
55
% STD_CHECKDESIGN - Check if STUDY design is compatible with EEGLAB % 2-categorical factor statistics % Usage: % >> [STUDY] = std_checkdesign(STUDY, designind); % % Inputs: % STUDY - EEGLAB STUDY set % designind - [integer] design index % % Authors: Arnaud Delorme % Copyright (C) Arnaud...