sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
1f6f4fb1704bf0a572a158682c612b91ccc5d755e9fd32e4dc2c0993874c9511
MATLAB
2,152
71
function [S, W, B] = segregation(M, Ci, varargin) % DESCRIPTION: % The degree to which edges are more dense within communites and more % sparse between communities, which quantifies the segregation of a % weighted network (Chan et al. 2014). % % USAGE: % S = segregation(M,Ci) % [S, W, B] = segregation(M,...
3c723c5bd54a2a5a348bafc7cb6a6691f9482e9bda6cb7146c4cb9519ebe379a
MATLAB
2,152
57
function [C_calc] = LCN_calc2_model_2T4k(params, midscantimes, frameduration, CA_FINETIMES,FINETIMES,calc_option,STEP) % % calculates the output value for the model_2T4k_Vbfixed (with parameters params) % % params: values for [K1,k2,k3,k4] % midscantimes = list of midscan times of each frame (in min p.i.). % framedura...
5b92d211eddd32a061d540b2922cb37db014dc6ac787a738b3568aeca12a874b
MATLAB
2,152
57
function dist = ComputeDistBetweenLabels(surface, orig_surface, label1, label2) % e.g. ComputeDistBetweenLabels('<SUBJECTS_DIR>/<SUBJECT>/surf/lh.sphere', '<SUBJECTS_DIR>/<SUBJECT>/surf/lh.white', 'lateraloccipital_gt', 'lateraloccipital') % e.g. ComputeDistBetweenLabels('<SUBJECTS_DIR>/<SUBJECT>/surf/lh.sphere', '<SU...
667f5921aef29d2b98b5e3efd4e11b98b5b3e6f50f39a3f07de56c92a63dde2b
MATLAB
2,153
64
function [lh_cov_mat, rh_cov_mat, dim] = CBIG_hMRF_build_prod_matrix(lh_input_file, rh_input_file,... lh_output_file, rh_output_file) % CBIG_hMRF_build_prod_matrix(lh_input_file, rh_input_file, lh_output_file, rh_output_file) % % This function generates the premultiplied matrix with the input concatenated time seri...
833bcb6e1fb298421290b6f31eb98564aa9fdf237ecf4958f4e9974e3e6ee586
MATLAB
2,153
48
% Read time data and reorganize them % Reorganize the data to fit the catplot function folder = ("C:\Users\yh19218\OneDrive - University of Essex\OneDrive - University of Essex\PG Research\0A_Journal\202004_unknown Journal_Probability Score\1_Results\0_Final Results\TimeNew\"); classes = ['OvsC';'HvsW';'OvsH';'OvsW';'...
af0de78a969e99b94316cf7c609473b55909bea99ec21389ed4fa25f384cda7b
MATLAB
2,153
64
function [Serrp,Serrj]=uispecerr(S,J,err,trialave,numsp) % Function to compute lower and upper confidence intervals on the spectrum % Usage: [Serrp,Serrj]=uispecerr(S,J,err,trialave,numsp) % Outputs: Serrp (Serrp(1,...) - lower confidence level, Serrp(2,...) upper % confidence level), similarly for Serrj % % Inputs: %...
12afe91986a29bddafb546679f516869447f55480a8a710c877fd1bc7d624793
MATLAB
2,156
64
% FDLA and FMMC solutions for a 64-node, 95-edge cut-grid graph % S. Boyd, et. al., "Convex Optimization of Graph Laplacian Eigenvalues" % ICM'06 talk examples (www.stanford.edu/~boyd/cvx_opt_graph_lapl_eigs.html) % Written for CVX by Almir Mutapcic 08/29/06 % (figures are generated) % % In this example we consider a g...
f9d017262e3793d02b36f280c056e0ea1e6be4910a38a38ac244e0eba25b0abb
MATLAB
2,156
44
function ea_get_prob_fiber_states_for_multisource(options,settings,outputPaths,axonStateFolder,resultfig) % convert PAM samples from multiple sources to prob. PAM % IMPORTANT:this is a special case for multisource prob. PAM % By Butenko, konstantinmgtu@gmail.com arguments options % Lead-DBS options fo...
91379cebb2ceb7d01d4fb760e63b365de7788df49617984c28aa1fbf50803d88
MATLAB
2,157
44
% Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions % %========================================================================= % % Copyright (c) 2008 Thomas Yeo and Mert Sabuncu % All rights reserved. % %Redistribution and use in source and binary forms, with or without %modification, a...
1d9fb0a1fb7ad63e1df1d481deec7035febb7d22e64092d6e490b00010d4e7ae
MATLAB
2,159
58
function m_full = getFullMask(m,frame_d,delay,kernel) %GETFULLMASK Convert frame rate mask to a sample-by-sample mask % % M_FULL = IOSR.BSS.GETFULLMASK(M,FRAME_D) expands the time-frequency % mask M, which has one unit for each frequency channel and frame of % length FRAME_D (in samples), to a sample-by-sample m...
48820fe3aa2f0f029e1ad9c0c96fe951ec370e5e5b2b0e55f404fe71b7e66eef
MATLAB
2,159
57
function [img,V] = LCN12_read_image(filename,Vref) % LCN12_read_image % % this script will read an image in matlab. % % INPUT % filename = name of the file (either full path or name if you % are in the correct directory). If the file is a 4D % file, you have to specif...
0dbc690d905f3c4a32979af998801ef4f59e8d65b500193ba483c671058acaeb
MATLAB
2,160
44
%% readLabels - read ITK-Snap label file % % Florian Bernard, Andreas Husch % Centre Hospitalier de Luxembourg, Dep. of Neurosurgery / % University of Luxembourg - Luxembourg Centre for Systems Biomedicine % 2014 - 2017 % mail@andreashusch.de, husch.andreas@chl.lu function [labelNames, rgbColors, labelId]=readLabe...
6f7f54554fb2a54475af563d2f28df28dcc28fd508309fead86ea1fe80a27a26
MATLAB
2,161
49
function Z = CORE_pxcorr(x,y,maxlag) %CORE_PXCORR Core computational routine for PXCORR. % Z = CORE_PXCORR(X,Y,MAXLAG), where X and Y are length M and N % vectors respectively, returns the length (2*MAXLAG+1) vector % Z such that Z(i) = #(X(j)-Y(k) == i), |i| <= MAXLAG. % % CONDITIONS (including requireme...
f246f42e1295b2c1f2cda421cfc9817b6ee5067f0b8600fa44fc556366b2d09a
MATLAB
2,162
59
function ea_save_networkmapping_model(obj, ExternalModelFile) % this function is called from the GUI % we want to define the model outside of cross-validation if ~exist('patsel','var') % patsel can be supplied directly (in this case, obj.patientselection is ignored), e.g. for cross-validations. pa...
fde0cef67c5c6fd0d70ea3d09021881abbdf94b29067aae36c1b245bdb279b2a
MATLAB
2,162
62
%% Detection of novel (reconfigured) sequences load('result_reconfigured.mat'); % load actual and reconfigured dataset %% Figures % ordered probability matrix subplot(3,6,9); x_sum_col = sum(x2_pMat_LR); [sum_sort,idx_col] = sort(x_sum_col,'descend'); x2_pMat_sort = zeros(100); for i_ne = 1:100 for j_n...
0d84f480d99c87d49884446e1303b225c8679270443219984b060d043f2d614c
MATLAB
2,163
53
function str = hyperlink(url, label, msg) %HYPERLINK create a string that is displayable as hyperlink in Matlab console % % Usage examples: % fprintf('Search on %s\n', hyperlink('http://google.com','Google')); % fprintf(hyperlink('http://google.com','Google','Search on Google\n')); % % HYPERLINK converts the speci...
32e14b3b2f226ac99a0111e776f1c3e2ddf131d02b785ee025510728b28e62c8
MATLAB
2,165
73
function self = FixPos(self, max_allowed_flips) % Fixes large jumps in position and interpolates missing values % % Takes all 0,0s and large jumps in position (greater than % jitter_threshold=15 pixels/sample) that persist for less than % max_allowed_flips (default = 5) and linearly interpolates the missing % data. Smo...
900d6382d774a53d530de6f79842704308c1bc7c6316f22a6d731799cd715378
MATLAB
2,165
60
function CBIG_MSHBM_Epilepsy_check_example_results(out_dir) % ==================================== %% Help % ==================================== % % CBIG_MSHBM_Epilepsy_check_example_results % % Checks that the individual-specific parcellation and language laterality % index (LI) produced by CBIG_MSHBM_Epilepsy_wrapp...
3d8629a61c615827daac3986e5b499a3ddee4087ab20190f8b483cc92b1d2523
MATLAB
2,166
47
function CBIG_ArealMSHBM_generate_radius_mask_Schaefer(resolution, mesh, out_dir) % CBIG_ArealMSHBM_generate_radius_mask_Schaefer(resolution, mesh, out_dir) % % This script will generate radius mask for Schaefer2018 parcellations in a given % surface space <mesh>. % % Input: % - resolution: (string) % The resolu...
6abe82e189519d4716b2fdb01febe576dccad7fc9f2a4c41ca043ebae5362256
MATLAB
2,167
57
% this script runs through an analysis testing whether patterns of brain % activity generalize across different psychological domains %load data, this contains an fmri data object called 'obj', a 'design' matrix %specifying group membership of each image in the data object (columns 1-18 %indicate study, columns 19:27 ...
89b8f66ca6b0a518d27b6c4c5735dae9afe65624f461f2c91dd343ba6a622918
MATLAB
2,168
71
function z = triumtriu(x,y,K) % z = triumtriu(x,y,K) % % TRIUMTRIU Computes y = x * y % Both r and u should be upper triangular. % % ********** INTERNAL FUNCTION OF SEDUMI ********** % % See also sedumi % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko % Copyright (C) 2005 McMaster University, ...
b5dbf0bfcc9fd2ba77a35c23cf8458502470b59032f10896e287d99b8a514349
MATLAB
2,168
54
function stimParams = extractStimParams(triggerParams,pulse) %write in DRC logic %organizes 'TriggerParams' and 'Stim' into relevant params %relevant params: stimParams.trigDelay = triggerParams.stimDelay; pre = regexp(pulse.pulsename,'_\d$','split'); stimParams.rawPulse = pulse.pulsename; %PulseID stimParams....
24b50f85334866a03be6c84dfa7a6aa50c08d5c3472e5c7e799b3a24a20d8fa5
MATLAB
2,169
43
% Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions % %========================================================================= % % Copyright (c) 2008 Thomas Yeo and Mert Sabuncu % All rights reserved. % %Redistribution and use in source and binary forms, with or without %modification, a...
98dc7bb7f68de8f3faec72ea765d1aa0d86a91645759102b39c3f64ee9563964
MATLAB
2,170
49
% Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions % %========================================================================= % % Copyright (c) 2008 Thomas Yeo and Mert Sabuncu % All rights reserved. % %Redistribution and use in source and binary forms, with or without %modification, a...
e2def4fff893446d6f058fcfb48d96e863beb05ee024977fa34b7810ecbdca2d
MATLAB
2,172
56
function [ cfg ] = formatconfig( fname ) % This file is a part of the MDSINE program. % % MDSINE: Microbial Dynamical Systems INference Engine % Infers dynamical systems models from microbiome time-series datasets, and % predicts biologically relevant behaviors of the ecosystems. % Copyright (C) 2015 Vanni Bucci, Georg...
0365d62c41c9ab686a56ff2e59e119f17463cc8fe1cd3bce9c753bec9f447bed
MATLAB
2,173
66
function element_node = mesh_base_one ( node_num, element_order, ... element_num, element_node ) %*****************************************************************************80 % %% MESH_BASE_ONE ensures that the element definition is one-based. % % Discussion: % % The ELEMENT_NODE array contains nodes indices ...
301aab34034f8feb0db78fbf508ad21e829a95cd1b6f73e5ae43ac0cb581a964
MATLAB
2,173
47
function [pkResp,sigPkResp,sig,pkIDX,pkIDXsig] = ... pkF_alt(Ftrace,frameStart,nFrameWindow,sigRespSDthresh) % pkF_alt output peak response of input Ftrace within nFrameWindow from frameStart. % % [pkResp,sigPkResp,sig,pkIDX,pkIDXsig] = pkF_alt( % Ftrace, --> fluorescence traces (cell,vector or ...
62f7042bcda3505efd0f4a81c78f446fd18903fe91627e100be3989e5f051ef6
MATLAB
2,173
61
%% Examples on the "General Heuristic" of 0.2V/mm as proposed in the literature % % Andreas Husch, University of Luxembourg, 2019 % andreas.husch(at)uni.lu % function pointHandle = plotModelAndGeneralHeuristic(ax) load('astrom_table3_3v.mat'); %#ok<LOAD> % loads PW, D, T for 3V %[activation_model_3v, gof] = fitMode...
d29cea2995a3ed531a83b5f52ec2727df8ebc080cb3c20289c1e0efc0980d682
MATLAB
2,173
71
function [cmdout, tempf] = ea_dcm2nii(inputimage, outputimage) % Wrapper for dcm2nii, only used for reorientation and cropping % % dcm2ii is not stable enough in some cases (will write out corrupted file % with 1KB size). Use 'ea_rocrop' instead to do reorientation and cropping. % Save to a new file, when 'outputimage...
070ea955b18c67ab99657dd674e6712ad67ce47f32424e2193744952d62fbf49
MATLAB
2,174
62
function [blocks,k,dag] = graphComponents(A) % GRAPHCOMPONENTS : Connected or strongly connected components of a graph. % % blocks = graphComponents(A); % [blocks,dag] = graphComponents(A); % % Input: A is the n by n adjacency matrix for an n-vertex graph. % % Output: blocks is an n-vector of intege...
ee4a1c1b3577c3d2ac8e579d781799f43148c74ee536b451e4a5b48e012ae7f3
MATLAB
2,176
65
function ea_unifiedmapping_save_settings(explorer,save_as) % Saves the relevant settings of the tractset object to a mat file % Properties can't be saved as variables :( % Or with the struct flag because tractset is % a class and not a struct :( % Convert to variables first and then save c...
20af533a4042fd0035b658b891769ff0183a22cc7bde926ccb7bd8a3024792a6
MATLAB
2,177
41
%% applyANTSTransformToPolyCoeffs - transform polynomial coefficient matrix in world coordinats of sourceRefImage to % world coordinates in targetRefImage applying a ANTS affine transformation % % Parameters: coeffs - Nx3 matrix, coeffs(end,:) is the bias term (x^0) % antsTransformFileStrings - '[antsTra...
ac0c5a4a36788a724dd4641dafe6b1c5b3ad0adb236ac3118a8913affd1ddeb8
MATLAB
2,177
63
function extractObjectFeatures(params) % extractObjectFeatures(params) % % ---------------------------------------------------------------------- % Matlab tools for "Predicting human gaze beyond pixels," Journal of Vision, 2014 % Juan Xu, Ming Jiang, Shuo Wang, Mohan Kankanhalli, Qi Zhao % % Copyright (c) 2014 N...
b49a214fbff97a69a1f437efce567eed814b5a7aa5e730453eec3531f5143ffa
MATLAB
2,177
45
% Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions % %========================================================================= % % Copyright (c) 2008 Thomas Yeo and Mert Sabuncu % All rights reserved. % %Redistribution and use in source and binary forms, with or without %modification, a...
4fb8a364833cecfeea7fe15c5b2729346eaae8e94942bad5ed192c6300d201cf
MATLAB
2,178
60
function fileNames = splitTifChans(mergedChanTif,varargin) % splitTifChans Split ScanImage .tif with multiple channels into .tif files with single channels. % fileNames = splitTifChans(mergedChanTif,varargin) % % Additional input arguments: % '1' --> saves only tif with specified channel, replace with ...
539a74d4fb92671de191ca2cadb60d1bbdcb6234544e4ef1a207494fbcc853cd
MATLAB
2,178
72
function [peakTheta, peakLowGamma, peakHighGamma] = peakFrequencies(lfp) %Determines the peak frequencies in theta, low gammma, and high gamma bands %of significant theta epochs in an lfp. %check to see if valid LFP channel if ~all(lfp.signal == 0) %determine theta epochs [thetaEpochs, ~, ~] = ThetaEpochs(lfp)...
f503381ed4ae5c7d40e0b32145b45665042ad9177d17d574d39a377cb63803ed
MATLAB
2,178
66
function res = PC_response_de(params,inputs,initcond) % This function generates a vector of intensity values over time for one % half of the PB innervated by PFNp_c, to a sequence of single-modality % experience (either AF or OF). % Setup with arguments. % inputs are sensory info thetavec = inputs(1,:); % ra...
5dc9c27ac4b15a52dc685f144a4544cfbb22ca380bc7b12ecdf1fa094c24735d
MATLAB
2,179
52
% SOFA API - demo script % Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences % Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "License") % You may not use this work except in compliance with t...
b784b11962c631a30e26f2810fd6c6dcc610cee6a252ca4c9e35aaa8901ec386
MATLAB
2,180
69
function com = pop_expevents(EEG, filename, unit) % pop_expevents() - export events to CSV file % % Usage: % >> pop_expevents(EEG); % >> pop_expevents(EEG, filename); % >> pop_expevents(EEG, filename, unit); % % Inputs: % EEG - EEGLAB dataset % filename - text file name % unit - display latency and...
5f8c9a860196e6c78a990af78f1398953bc35b4bc77de1eb154c6a2f29cc5c3d
MATLAB
2,181
60
function CBIG_ASDf_plotFactorsThresholded_wrapper(output_dir) % CBIG_ASDf_plotFactorsThresholded_wrapper(output_dir) % % Wrapper function to plot bootstrap thresholded factors % % Input: % - output_dir: % Absolute path to directory where output results will be saved % % Example: % CBIG_ASDf_plotFact...
6c852e6902fa75f0387c21516bddab8321305286fc73b6f578bd3875a0494dcb
MATLAB
2,181
47
% Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions % %========================================================================= % % Copyright (c) 2008 Thomas Yeo and Mert Sabuncu % All rights reserved. % %Redistribution and use in source and binary forms, with or without %modification, a...
cee38c525f693fad5c60376785a8da19e185f25a2d0468552abab4bc468cc03e
MATLAB
2,181
49
function stress_tensor = calc_stress(V, C, topo, tensions, cell_pressures, strain) % CALC_STRESS Compute the tissue-level (Batchelor/virial) stress tensor % from edge tensions and cell pressures, under Lees-Edwards (sheared) % periodic boundary conditions. % % stress_tensor = CALC_STRESS(V, C, topo, tensions, cell_p...
564784c6faa4013c8697ef91b518193825c49e0bd64b71fab01a241ab41d5859
MATLAB
2,182
60
function dice = ComputeDiceBetweenLabels(surface, orig_surface, label1, label2) % e.g. ComputeDiceBetweenLabels('<SUBJECTS_DIR>/<SUBJECT>/surf/lh.sphere', '<SUBJECTS_DIR>/<SUBJECT>/surf/lh.white', 'lateraloccipital_gt', 'lateraloccipital') % e.g. ComputeDiceBetweenLabels('<SUBJECTS_DIR>/<SUBJECT>/surf/lh.sphere', '<SU...
dfa420ae81281b4f2b0dedcdc5a6051fa67c43719737191cc3210c5b0ffd1c41
MATLAB
2,182
63
function BFoutput = monotonicityCalc(BFoutput,PkResponseVar,varargin) %could write this up as a cell function, but meh tempMap = reshape(BFoutput.(PkResponseVar)',numel(BFoutput.dBlist),... numel(BFoutput.freqList),size(BFoutput.(PkResponseVar),1)); [~,maxLvlIDX] = max(BFoutput.dBlist); if ~isempty(varargin)...
0202a9227568a9a620d2e7b09b2c33f64947706a14ca2745b9ef7278417e74a2
MATLAB
2,183
56
function smooth_image = LCN12_smooth(image,smooth_kernel,mask) % LCN12_smooth.m % % This function will smooth an image with a 3D Gaussian kernel optionally % within a mask % INPUT: % image = 3D matrix % smooth_kernel = array of Gaussian kernel size (in voxels) % Optional input: mask = 3D binary mask % OUTPUT: %...
4935f8f99757fde2d5fd3effa9c2dcd39aef80ea9234dd11caa72be7a1f9a4e6
MATLAB
2,183
43
function data_out = importvelocity(filename, dataLines) %IMPORTFILE Import data from a text file % M001HBASELINE1VELOCITY = IMPORTFILE(FILENAME) reads data from text % file FILENAME for the default selection. Returns the data as a table. % % M001HBASELINE1VELOCITY = IMPORTFILE(FILE, DATALINES) reads data for ...
7e887b8ff997bfcebafa289d2f77d82a013f223467d44f20638a24371677d6fc
MATLAB
2,183
82
function [] = fig2pdf3d(ax, filename, options, media9_or_movie15, pdforxelatex) %FIG2PDF3D Convert axes to PDF with embedded interactive 3D image. % % usage % FIG2PDF3D(ax, filename, media9_or_movie15, pdforxelatex) % % input % ax = axes object handle % filename = file name string (default = 'surface') % media...
8d255c802954c0098b6e59a42807ba4be92773329e74cf8c48032fc976cfe37f
MATLAB
2,183
69
function data = AFOFdata_struct_CL_2(inputdata, filenames) % USE THIS FOR EXP8 (CEM) % how it works: % fly = AFOFdata_struct_CL_2(data,filenames) where data and filenames are % outputs from AF_OF_importer() for e = 1:length(inputdata) for t = 1:size(inputdata{e}{1},1) trial.filename = filenames{e};...
0efc6f93348bf967e38a38888688751b6efb50ea9328436f552f7d682f823c31
MATLAB
2,185
79
function ea_deletePL(varargin) if nargin == 1 % Used in ea_stimparams.m PL = varargin{1}; else % Used in convis resultfig = varargin{1}; varname = varargin{2}; mode = varargin{3}; PL = getappdata(resultfig, [mode,varname]); setappdata(resultfig, [mode,'fibersfile'], 'nan'); setappdata(resul...
659c18ae755c7679c55b468e61ed910712f7bd8017107cd6283214e7607dc0cb
MATLAB
2,185
71
function [] = idtf2u3d(fn) %IDTF2U3D Convert IDTF to U3D file. % % usage % IDTF2U3D % IDTF2U3D(IDTF_filename) % IDTF2U3D(IDTF_filename, U3D_filename) % % optional input % idtffile = filename string for IDTF file (default = 'matfig.idtf') % u3dfile = filename string for U3D file (default = 'matfig....
e39bfd0fc71aae80de2213227418cd1a7386b1afde1987f8618038ed663e93d9
MATLAB
2,186
55
function [ci, sizes]=CBIG_ArealMSHBM_find_components(avg_mesh, ini_labels) % [ci, sizes]=CBIG_ArealMSHBM_find_components(avg_mesh, ini_labels) % % This script will find all distributed components for parcels of a given parcellation % label <ini_labels> and reorder the parcellation labels of each components. For exampl...
73299ed58ff5085676210d825855ccfe5349a540526e944dc2eb617a6dd1550c
MATLAB
2,188
83
function A = fast_ica(x,pcomponents,nit) % Originally written by the Finish (Aapo) team; % Modified by the PIB team in Aug. 21, 2007 % PIB - Biological Information Processing Lab - UFMA - Brazil % Modified by V�tor Lopes dos Santos Aug. 2011. if nargin < 3, nit=100; end % fprintf ('Removing mean...\n'); ...
1c1b630ec9469f97a04ff1accbec639d6720b9797b950fb2e38de7a63089ba34
MATLAB
2,189
85
%XMLDEMO2 Demonstrate how to read an XML file, modify it and save it % % Description % This script demonstrates the use of the xmltree class to % open an XML file, access data stored in it, modify a value % and save the new XML file. % % This demonstration script need the file 'example.xml' created % ...
478574624ea2145db4e11a4e8f5e92a352bd4c9cbd77864257d9224ee9d9c564
MATLAB
2,189
74
function interVal=ea_diode_interpimage(img,yx,zpad) % BiLinear interpolation using 4 pixels around the target location with ceil convention % RGB = 1 for gray scale images. % img can be a single layer matrix or a RGB layer colored image % yx =[y_value, x_value]; It can be either horizontal or vertical vector % % zpad i...
a01ceb6a95063974cf48ed40e492d5cf3eae23acbf0c03e8bcccd73e1dc58d85
MATLAB
2,189
57
function self = FixDir(self, max_allowed_flips) % Corrects errors in headdirection tracking % % Assumed root.b_headdir is in degrees % % Max allowed flips is the maximum number of consecutive lost samples % (default = 5) % % Neuralynx head direction recordings often have missed samples, registered % as either 0 or NaN....
08fd96f0f74a4443be5aa79b90bbd6fe54f9323afb0dd1bde0a48e806920d297
MATLAB
2,190
68
% Script for testing the string array feature of SOFA %% Test Strings as application-specific variable % Load some arbritrary HRTFs hrtf = SOFAload(fullfile(SOFAdbPath, 'database','ari','dtf_nh2.sofa')); % Add a string array str={}; for ii=1:hrtf.API.M str{ii,1}=['String' num2str(round(rand(1,1)*10000))]; ...
0ccbef444d9e9f6a5044837515233744f986c2c9740fea3de50b835d4691a6f3
MATLAB
2,190
62
function ea_export_ls_index(serverdir,options) % very simple static dir2html export function. fid = fopen([options.prefs.ls.dir,'index.html'], 'w+'); fwrite(fid,'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'); fwrite(fid,'<html xmlns="http:...
795a8f25509aefc31853c17cb2d896e12dcceaece4a784a30658191620b4d746
MATLAB
2,190
70
% pop_expica() - export ICA weights or inverse matrix % % Usage: % >> pop_expica( EEG, whichica); % a window pops up % >> pop_expica( EEG, whichica, filename ); % % Inputs: % EEG - EEGLAB dataset % whichica - ['weights'|'inv'] export ica 'weights' or ica inverse % matrix (...
0d1fbbad653a88cf15ddd0d529a3b2499618275b6408a25c6b7553021dd32392
MATLAB
2,191
73
function task_contrasts = get_HCP_task_contrasts tasks = {'SOCIAL', 'MOTOR', 'GAMBLING', 'WM', 'LANGUAGE', 'EMOTION', 'RELATIONAL'}; %% SOCIAL task_contrasts.SOCIAL = {'social_random'; 'social_tom'; 'social_tom_random'}; %% MOTOR task_contrasts.MOTOR = {'motor_cue...
9f9c18750336e7f915660020a9bc25f3eaf4231afb6bbfc4ec8b9ae4d4fa693f
MATLAB
2,191
65
function parcel2surf = parcel_to_surface(parcel_data, parcellation, fill) % % Usage: % parcel2surf = parcel_to_surface(parcel_data, parcellation, fill) % % Description: % Map parcellated data to the surface (authors : @MICA-MNI, @saratheriver) % % Inputs: % parcel_data (double array) - Parcel vector, size = [p x ...
ad83c86c67f34a26cd65f2351412a022928f601b9ad94c392070dd6e60b3d005
MATLAB
2,191
67
function [betas, stats] = CBIG_fitGLM_4t(subInfoFile, GMICVFile, q) % [betas, stats] = CBIG_fitGLM_4t(subInfoFile, GMICVFile, q) % What is the subtype order? % Offset by 1, the RID column % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md SUB_COL = 1+2; FRO_COL = 1+3; P...
c5e6514ea3b1f266a22808a6e721cda9a55d855c33032a9d1e55c33ca9d5f839
MATLAB
2,193
81
%% Precompute distributions for special word retrieval model (SWR) % %% % Choose the dataset dataset = 1; % 1 = psych review abstracts 2 = NIPS papers if (dataset == 1) % Set the hyperparameters BETA1 = 0.000001; BETA2 = 0.000001; % load the psych review data in bag of words form...
87bddf88f31e46415291eb37a3f06458b504c9524dac75e6e30b7a0afd123fb9
MATLAB
2,194
94
%MRSTRUCT_WRITE save mrStrut to file. % outFileStr = mrstruct_write(mrStruct,fileStr) % % Save mrStruct of file. If nargin==1 or fileStr is not valid % a dialog box will prompt the user for input. % % Examples: % fileNameStr = mrstruct_write(myExperimentStruct); % mrstruct_write(myExperimentStruct,'c:\my_...
347f9d11b69787d28b13de7474d636b5d304c873c1f12f27dd30c161b8e18289
MATLAB
2,195
49
%% Mutual Information Demo 1 % This demo goes through calculating the mutual information for time locked % trials from two discrete time series. % Data Type: Discrete % Number of Variables: 2 % Information Analysis: Mutual Information % Trial Based or Single Trial: Trial Based % Significance Testing: Off % Delays: Off...
0fa0baf2afe3fc5343a1840e150bf3be2e819962b4cb6e5c487e31561c71e456
MATLAB
2,196
59
function keydata = readSvnKeyword(filename,keyword,crop) %READSVNKEYWORD Read data from a file tagged with an SVN keyword % % The function takes an input filename and searches that file for a % Subversion keyword. The data associated with the keyword are returned % in a character array. Keyword data are placed...
9b2a387713ff2ba8657d34922254a57682b070c9b8fdd8eaef14bfbe209df9cc
MATLAB
2,196
49
function [blockInfo] = PL2ReadFirstDataBlock(filename) % PL2ReadFirstDataBlock(filename): read first data block, return block info % % example: % % blockInfo = PL2ReadFirstDataBlock(filename) % while blockInfo.Type > 0 % % process data from the block % % ... % % read the next data block % blockInf...
9e0636308885f60c28c26857212441d75f67bf84ecdf73ca7c3786d3440b9f9f
MATLAB
2,197
60
% adjustcylinder() - Adjust 3d object coordinates to match a pair of points % % Usage: % >> [x y z] = adjustcylinder( x, y, z, pos1, pos2); % % Inputs: % x,y,z - 3-D point coordinates % pos1 - position of first point [x y z] % pos2 - position of second point [x y z] % % Outputs: % x,y,z - up...
bf0764537ccbeb16798a03326e30e0dba8c36f92b32aac6f0cc359079447ddda
MATLAB
2,198
73
function [a,C] = biconnected_components(A,varargin) % BICONNECTED_COMPONENTS Compute the biconnected components and % articulation points for a symmetric graph A. % % [a C] = biconnected_components(A) returns a list of articulation points % a and the component graph C where each non-zero indicates the connected % comp...
ed6bd0c2b0dbc723880c534c4291f19a8024a74088b90a059bc0787fc2ba3d39
MATLAB
2,199
73
function varargout = GetBatch(batch) %GetBatch - Get batch job output. % % USAGE % % [output1,output2,...] = GetBatch(batch) % % batch batch parameter returned by <a href="matlab:help StartBatch">StartBatch</a> % % OUTPUT % % output1... one matrix or cell array for each output parameter of the ...
4c1c80aa7c25f6dfa6b1ffdd203965aa0b92e0826438785f3ce0dde140d1478d
MATLAB
2,200
56
function [keep_species_merge,species_names_filtered_merge] = mergeData(experimentBlocks,keep_species,data_counts,species_names,intervene_matrix_filtered) % This file is a part of the MDSINE program. % % MDSINE: Microbial Dynamical Systems INference Engine % Infers dynamical systems models from microbiome time-series ...
567689c27d66f0fc0036ca4851efd42c16ded8e602f6c01bd4f418cbd3a98c01
MATLAB
2,202
99
%% Preprocess % Perform ICA on raw data Step1_Preprocess_Export_Active; Step1_Preprocess_Export_Passive; Step1_Preprocess_Export_ActiveExt; % ISI=400,700, include Step2 % Re-reference: for raw wave analysis Step2_Preprocess_Rereference; % Subtract by ERP: for GC analysis Step2_Preprocess_Granger; % Exclude bad chann...
6a619332ddb4505272b8d6c6d26a4e8c432eec243a6160ded4422e1e36d38751
MATLAB
2,202
49
function ADA = getada1(ADA, A,Ajc2,perm, d, blkstart) %#ok % ADA = getada1(ADA, A,Ajc2,perm, d, blkstart) % % GETADA1 Compute ADA(i,j) = (D(d^2; LP,Lorentz)*A.t(:,i))' *A.t(:,j), % and exploit sparsity as much as possible. % Ajc2 points just beyond LP/Lorentz nonzeros for each column % blkstart = K.qblkstart par...
4ff6981fe72b606ece8dcc53533723ff9e2b49eb6238ef30ed3fbe87e34396dd
MATLAB
2,203
74
clc; close all; clear; Start = tic; %% Inputs numSig = 5; t = linspace(0,1,1000); % Time vector nbins = 5; methods = {'Euclidean', "CityBlock", "Minkowski", "Chebyshev", "Sorensen", "Gower", ... "Soergel", "Kulczynski", "Canberra", "Lorentzian", 'Intersection', 'WaveHedges', ... 'Czekanowski', '...
17adb22cef4ae6c38958b828ec75da2d898e26b323c0d32a528cd8128b922196
MATLAB
2,204
119
function a= rotation_xyz(dim,forty) % Takes the dimensions of a cube as argument and returns the array a which contains the indices to rotate a cube of that dimension. %% Rotate over the X axis X90=[]; for i=dim:-1:1 for t=0:(dim-1) X90=[X90, i+t*dim^2]; end % Use i as starting value for next loop y=i; for j=1...
175ee0d4417ed0cb24612b464327f6db6cb00633d00b05e7923dbe38cf2b18ee
MATLAB
2,205
79
function o = nifti2struc % Create a data structure describing NIFTI-2 headers %__________________________________________________________________________ % Copyright (C) 2005-2012 Wellcome Trust Centre for Neuroimaging % % $Id: nifti2struc.m 6314 2015-01-23 17:00:51Z guillaume $ persistent org; if ~isempty(org) ...
739cba1660f2a1691e10883e9e459deb72816795d55f7d2d6c0b4e645b5abcea
MATLAB
2,205
49
function [rec, diag_hist, vertical_hist, rad_final,A] = set_radius(data,a,radius_start,radius_end,threshold,type,iter) % Find the radius to provide target percent recurrence % If radius_start is too small [rec, ~, ~, ~] = line_hist(data,a,radius_start,type); while rec == 0 || rec > thres...
d758c1237d8104b51889ba3da19a521f2dacdaf0aa770fdcd5ca0311286f7a0c
MATLAB
2,205
119
function a= rotation_xyz(dim,forty) % Takes the dimensions of a cube as argument and returns the array a which contains the indices to rotate a cube of that dimension. %% Rotate over the X axis X90=[]; for i=dim:-1:1 for t=0:(dim-1) X90=[X90, i+t*dim^2]; end % Use i as starting value for next loop y=i; for j=1...
159f1e7f2b0bdb675cbf6b004f933ad11c11a21e9473f2ca22c6b6b42b459dc9
MATLAB
2,207
54
function [node,elem]=vol2restrictedtri(vol,thres,cent,brad,ang,radbound,distbound,maxnode) % % [node,elem]=vol2restrictedtri(vol,thres,cent,brad,ang,radbound,distbound,maxnode) % % surface mesh extraction using CGAL mesher % % author: Qianqian Fang, <q.fang at neu.edu> % date: 2009/01/06 % % input: % vol: a 3D vo...
3105c1e37db7acc9e48dd5351757a7651baac210936a13cca7907337d81b3650
MATLAB
2,208
92
% rri_xhair: create a pair of full_cross_hair at point [x y] in % axes h_ax, and return xhair struct % % Usage: xhair = rri_xhair([x y], xhair, h_ax); % % If omit xhair, rri_xhair will create a pair of xhair; otherwise, % rri_xhair will update the xhair. If omit h_ax, current axes will % be used....
6f8f197ac6082d19472c754e315bc508813b33a0844953be209aa7865b1376ed
MATLAB
2,208
77
function hm=plottetra(node,elem,varargin) % % hm=plottetra(node,elem,opt) % % plot 3D surface meshes % % author: Qianqian Fang <fangq at nmr.mgh.harvard.edu> % % input: % node: a node coordinate list, 3 columns for x/y/z; if node has a % 4th column, it will be used to set the color at each node. % ...
5ab1bf7ff7869754cc06272011fcb92550b48210a5f98698b11080bc01a4be8e
MATLAB
2,209
62
% pcexpand() - expand data using Principal Component Analysis (PCA) % returns data expanded from a principal component subspace % [compare pcsquash()] % Usage: % After >> [eigenvectors,eigenvalues,projections] = pcsquash(data,ncomps); % then >> [expanded_data...
eb110b8b2f84c7b661d98b8bf3a22d3d93a180abe0cfbf510fc57636792647f2
MATLAB
2,209
77
function [col_shift,M] = correct_bidirectional_offset(Y,nFrames,us) % look and correct for phase artifacts due to bi-directional scanning % with thanks to Fabian Sinz for useful discussions. if ~exist('us','var'); us = 10; end if ~exist('nFrames','var'); nFrames = 50; end if isa(Y,'char') Y = read_file(Y,1,nFram...
1c5ee37f6f0191e9735014bef007c8231c4b5c72eebd98f0aed7c37411707d9c
MATLAB
2,211
91
function [n, npw, ts, wave] = plx_waves(filename, ch, u) % plx_waves(filename, channel, unit): Read waveform data from a .plx file % % [n, npw, ts, wave] = plx_waves(filename, channel, unit) % % INPUT: % filename - if empty string, will use File Open dialog % channel - 1-based channel number % unit - unit number...
20fd0a699521395a9663c6fcb343678908b9c5e816a84bc1b17209e6257ce388
MATLAB
2,213
71
function ans = isinside(smallRect,rect,clip) %ISINSIDE checks whether one rectangular area is completely inside another % % SYNOPSIS ans = isinside(smallRect,rect,clip) % % INPUT smallRect : defintion of rectangular area which should be inside of % rect : % both rectangular areas are define...
03c0c330ec925f0fc9501886cb4030010a78ee52b8bffdae6574b311f0cb7689
MATLAB
2,214
66
% moveaxes() - move, resize, or copy Matlab axes using the mouse % % Usage: >> moveaxes % >> moveaxes(fig) % >> moveaxes off % % Note: clicking the left mouse button selects an axis % dragging the left mouse button resizes a selected axis % dragging the right mouse button copies a selected ax...
9814ebcb1c429b50e74deaeafa26acfe6d12354529916688eff5dba7d4090a88
MATLAB
2,215
52
%% Conditional Entropy 1 % This demo goes through calculating the conditional entropy for time % locked trials from two continuous time series. % Data Type: Continuous % Number of Variables: 2 % Information Analysis: Conditional Entropy % Trial Based or Single Trial: Trial Based % Significance Testing: N/A % Delays: ...
f1f40ca7ca4986392077899898e1a595681a5594fbc783c000816437d2a5d9d6
MATLAB
2,215
48
% Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions % %========================================================================= % % Copyright (c) 2008 Thomas Yeo and Mert Sabuncu % All rights reserved. % %Redistribution and use in source and binary forms, with or without %modification, a...
f9a96d51e2f9734a89b81bf228750d164c0a8d6720f6c5921138439e890b9d51
MATLAB
2,217
64
function [Serrp,Serrj]=uispecerr(S,J,err,trialave,numsp) % Function to compute lower and upper confidence intervals on the spectrum % Usage: [Serrp,Serrj]=uispecerr(S,J,err,trialave,numsp) % Outputs: Serrp (Serrp(1,...) - lower confidence level, Serrp(2,...) upper % confidence level), similarly for Serrj % % Inp...
8ee69ad876b01e21acc4f4d094f70e0eb64fee4bdbcf590b53180fd0fca8c4eb
MATLAB
2,219
83
function ps = CBIG_pairwiseCmpMeans(subInfoFile, GMICVFile, Q) % ps = CBIG_pairwiseCmpMeans(subInfoFile, GMICVFile, Q) % All these info is baseline info % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md [RID_dx, ~, ~, ~, ~, ~] = get_data(subInfoFile, GMICVFile, 3); % ...
31a8f0193d3fd829b9f0a48e72fd2290d1848ed0801f52fe56d09d18e2d5e50d
MATLAB
2,221
66
function add_ndt_paths_and_init_rand_generator % This function adds all the appropriate directories for the NDT toolbox to work % and initializes the random number generator based on the clock (by default % Matlab uses the same seed everything it is started which can lead to unwanted behavior). %=================...
afdc9d51ecaa477b665a492765790db3e48348d2b4c9e8d10f19143e792a5f2e
MATLAB
2,221
49
function [lh_full_label, rh_full_label] = CBIG_hMRF_get_left_right_overlapping_labels(lh_mask, rh_mask,... label, num_cluster_per_hemi) % [lh_full_label, rh_full_label] = CBIG_hMRF_get_left_right_overlapping_labels(lh_mask, rh_mask,... % label, num_cluster_per_hemi) % % This function reformats the input label vect...
2e1ead670775442d0d568beb83b0fff48858a7883fa8759b713311c1fe7d373b
MATLAB
2,222
53
% Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions % %========================================================================= % % Copyright (c) 2008 Thomas Yeo and Mert Sabuncu % All rights reserved. % %Redistribution and use in source and binary forms, with or without %modification, a...
8fb6ef53bb741c0fa72b558c32afeabb7b03a4948fe291f4247f0e155b0e6f9f
MATLAB
2,222
50
function [blockInfo] = PL2ReadNextDataBlock(blockInfo) % PL2ReadNextDataBlock(blockInfo): read next data block, return block info % % example: % % blockInfo = PL2ReadFirstDataBlock(filename) % while blockInfo.Type > 0 % % process data from the block % % ... % % read the next data block % blockInfo...
36a96d6b7a1143490420d5a3d36fd3f67ae0275939cd89b6ac80f626d29f8fa2
MATLAB
2,223
63
% CYLINDER: A function to draw a N-sided cylinder based on the % generator curve in the vector R. % % Usage: [X, Y, Z] = cylinder(R, N) % % Arguments: R - The vector of radii used to define the radius of % the different segments of the cylinder. % N - The number of po...
615a601df5967ca70f5df35b8a3c3417518aa90c4ede41a697616f9bd36a1db7
MATLAB
2,223
73
function [thresholdvalue, targetID] = prep_TurnOverAna(handles) % thresholdvalue = 3; thresholdvalue = handles.defaultPara.spineRetain; targetID = 1; N = length(handles.datafilename); mainfig_pos = get(handles.mainfigure, 'Position'); scrsz = handles.scrsz; pos = mainfig_pos; ...
ad5944fcce85f882d25d88385b604741fa8fda35d1812bf918f8d70b82874a44
MATLAB
2,223
60
% Periodic Boundary Conditions version function [perimeters, areas, a1, a2, orientation] = cell_shape_info(V, newC) % CELL_SHAPE_INFO Compute shape descriptors (area, perimeter, principal % axes, orientation) for every cell polygon under periodic boundary % conditions (PBC). % % [perimeters, areas, a1, a2, orientati...
7c3970b1d3dd29efba927862025831b092f9ca009b96c7c0efe915541c54d4e6
MATLAB
2,226
68
function ssEvents = fun_spindle_coordination(ssEvents, srate, samples) % Calculates sleep spindle coordination metrics. Takes each spindle event % on each channel and finds how many other channels the same spindle % occurred. % % Required inputs: % % ssEvents: A struct containing all sleep spindle events (output from ...
1ca039039b24b97d90b7dc418b18461593655de040f3f133a1a2ec0e968c0e42
MATLAB
2,228
59
function clusterInfo = getClusterInfo(filename) % GETCLUSTERINFO reads the phy generated file 'cluster_info.tsv' and % returns a table with the variables assigned into an output table % 'clusterInfo'. It will have size NxM, with N clusters and M variables. % clusterInfo = getClusterInfo(filename) % INPU...
3c6811648c47a805b8208ceb9f613881f491215fa783594791096aa34a4ded98
MATLAB
2,228
75
function hh=plotedges(node,edges,varargin) % % hm=plotedges(node,edges,opt) % or % hm=plotedges(node,loops,opt) % % plot a 3D polyline or close loop (1d manifold) % % author: Qianqian Fang <fangq at nmr.mgh.harvard.edu> % % input: % node: node coordinates, dimension (nn,3); if node has a % 4th colu...
592aa32854ce3b131dde99b290e8f81ae79a1c5c756f7f95cbd8c8d13c8d4413
MATLAB
2,228
59
function obj=geom_raster(obj,varargin) % geom_raster Plot X data as a raster plot % % Option 'geom': 'line' or 'point' p=inputParser; my_addParameter(p,'geom','line'); parse(p,varargin{:}); obj.geom=vertcat(obj.geom,{@(dobj,dd)my_raster(dobj,dd,p.Results)}); obj.results.geom_raster_handle={}; end function hndl=my_r...