sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
1fbec5e8b66d6de08d5aff83677730caa88cbe560aee9af85c7cee1a4a6f7664
MATLAB
2,911
83
function [mask,Xdiff]=plotsigdiff(X1,X1err,X2,X2err,plt,t,f) % Function to plot significant differences between two time-frequency arrays X1 and X2 % given errors X1err, X2err. % Usage: mask=plotsigdiff(X1,X1err,X2,X2err,plt,t,f) % % X1 err and X2err contain upper and lower confidence intervals for X1 and X2 % T...
671781dd4efe3b64e0bc8feb1a51fa7783d291d4191f4ba164618783ab754f3a
MATLAB
2,911
83
% Section 4.5.4: Minimum spectral radius via Peron-Frobenius theory (GP) % Boyd & Vandenberghe "Convex Optimization" % Joelle Skaf - 01/29/06 % Updated to use CVX mode by Almir Mutapcic 02/08/06 % % The goal is to minimize the spectral radius of a square matrix A % which is elementwise nonnegative, Aij >= 0 for a...
f09395bb7e2a806383e0f55e5d61f01f20a9a35075afd602a41214c62d92bc90
MATLAB
2,912
82
% eeg_latencyur() - transform latency of sample point in the continuous % data into latencies in the transformed dataset. % % Usage: % >> lat_out = eeg_latencyur( events, lat_in); % % Inputs: % events - event structure. If this structure contain boundary % events, the length of th...
04956b6585eac185f9d1bbdaddd0ac8d3f556a7327a3fc67b97fe20c585899e3
MATLAB
2,913
95
function [ica] = bz_RunIca(varargin) % [ica] = bz_RunIca(varargin) % % Perform Independent Component Analysis (ICA) decomposition of input data % using the logistic infomax ICA algorithm of Bell & Sejnowski (1995) with % the natural gradient feature of Amari, Cichocki & Yang. % % INPUTS % <optional> % basepath ...
5c6058af99cdecd5cf35a4e2edfe7b3f0160a30a0d766fa7165f91c35eb8383a
MATLAB
2,914
85
function r = bfGetReader(varargin) % BFGETREADER return a reader for a microscopy image using Bio-Formats % % r = bfGetReader() creates an empty Bio-Formats reader extending % loci.formats.ReaderWrapper. % % r = bfGetReader(id) where id is a path to an existing file creates and % initializes a reader for the in...
e4684789a521ea40e75853289b6e6b091c23afb52593aafbf0c94f897ea56689
MATLAB
2,915
94
function ea_reconstruction2native(options) if ~isfield(options.subj, 'norm') options = ea_getptopts(fileparts(fileparts(options.subj.recon.recon))); end load(options.subj.recon.recon, 'reco'); if ~exist('reco','var') % old format reco.mni.coords_mm = coords_mm; reco.mni.markers = markers; reco.mni.tr...
76758c8631598f1d10393b1afeea970dc587e4e6a123dfbd3c731d177dd22cba
MATLAB
2,916
88
function ys=positionMask2D_many(mainIm,mainParms,subImRoot,subParms) % Usage ... ys=positionMask2D_many(mainIm,mainParms,subImRoot,subImParms) % % This function will provide overlay masks for the locations of subIm % images on mainIm. The parameters of mainIm, mainParms=[FOVx FOVy]. % SubImRoot is a cell of fileroots....
034c5282fafa7e73fcabdff68ae64670987de2d88c06d8c08c946848749c39e9
MATLAB
2,917
72
function CBIG_gwMRF_individual_lut(output_dir) % CBIG_gwMRF_individual_lut(output_dir) % % This function generates the lookup table for individual subjects. % % Input: % -output_dir: % Path of the output folder, There should already be annot files in % fsaverage space '?h.Schaefer2018_?Parcels_?Netwo...
99c494201eab3acf5f3e276dc2dad8fd5caf1ce12181265bb6b1a0c6a82603f4
MATLAB
2,918
85
function M = obj_read(filename) % Read Wavefront OBJ-formatted data from disk % FORMAT M = obj_read(filename) % % filename - OBJ-formatted file name % M - data structure %__________________________________________________________________________ % % Wavefront OBJ Format Specification: % https://en.wikipedia.org...
c8f45a5303a4453bb1278677110b350064f7304cc6fd07c136b331165b74ecb2
MATLAB
2,918
78
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Creates a matrix with the pairwise distances (in mm) on the fsaverage sphere % between each vertex in an ROI clear all hemis = {'lh', 'rh'}; % use ministreams to subselect and save on mems/compute roi_name = 'ministreams'; roivalsL = cvnloa...
9c8009c29e3496d59e059e58c705df7fb8badb8df2497eee586d934e21902276
MATLAB
2,919
89
% matperm() - transpose and sign rows of x to match y (run after matcorr() ) % % Usage: >> [permx indperm] = matperm(x,y,indx,indy,corr); % % Inputs: % x = first input matrix % y = matrix with same number of columns as x % indx = column containing row indices for x (from matcorr()) % indy = column co...
d3af20d4888f45c80a9222a70b8db6bf01b2dc2de130cc4443ac3f6c0629fe0b
MATLAB
2,921
79
function ivc = makeIVC(leftdata,rightdata,ivctype,exptype) % ivctype = 1 for array (mean of response), 2 for cell array ("tc"), 3 for % "tc" but it's also a per-fly mean % exptype = 1 for exp6 speed tuning data, 2 for direction tuning data, 3 for exp7 if exptype == 1 if ivctype == 1 ivc = [rightdata...
7a3786554faeea11a77f61d639617bf8e0a46a42e57bc6df66380907f672e2b3
MATLAB
2,922
88
%% Detection of novel (rearranged) sequences load('result_rearranged.mat'); % load actual and rearranged dataset %% Figures % example raster plot subplot(3,6,1); hold on; sp_tr = spikes_actual; trange = [0 5000]; no_sp_tr = length(sp_tr); for i_sp_tr = 1:no_sp_tr no_sp = length(sp_tr{i_sp_tr}); f...
8d482900ec706caf45c453845c5fe05352de551abc4a08faa58a24ef4d2d74c1
MATLAB
2,922
128
function RGB = pa_LCH2RGB(LCH,adobeRGB) % RGB = PA_LCH2RGB(LCH) % % Convert LCH colours to RGB colours % % For formulas, see: % http://easyrgb.com/index.php?X=MATH % % For those with the Image Processing toolbox: % http://www.mathworks.nl/help/images/converting-color-data-between-color-spaces.html % % For a ...
abff123e89524ea528ebe3e1e167d70abb775919135aa7fb60ee29914878c82f
MATLAB
2,922
120
function write_ply(fn, pnt, tri, format) % WRITE_PLY writes triangles, tetraheders or hexaheders to a Stanford *.ply format file % % Use as % write_ply(filename, vertex, element) % % Documentation is provided on % http://paulbourke.net/dataformats/ply/ % http://en.wikipedia.org/wiki/PLY_(file_format) % % See als...
2c467e039cd5e793d26cb5069f993f59906efe6e2e29cdc3c43e744f2d39263c
MATLAB
2,924
94
function prefs = ea_prefs(patientname, context) if ~exist('patientname', 'var') patientname = ''; end % 'normal' context by default. If context is not 'normal' (cluster run or % exported job case), 'machine' settings will not be added to 'prefs' here. % The value will be read from options.prefs.machines. if ~exis...
50bbc5b930c90eaf42b9517d05b4bf0ba32c8b06ecbaf35d393e06f303523f3b
MATLAB
2,924
79
% 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...
94da9b85e26b732d2025a8798daf0b7b3a08f501f4e2f57018a6876155e3a176
MATLAB
2,925
76
ccc; %% Path GRANGERPATHs0 = dir("..\MAT Data\granger result raw (ext)\Prediction\**\single\**\*.mat"); SINGLEPATHs = unique({GRANGERPATHs0.folder})'; SAVEPATHs = cellfun(@(x) strrep(x, '\granger result raw (ext)\', '\granger result minus base (ext)\'), SINGLEPATHs, "UniformOutput", false); cellfun(@mkdir, SAVEPATHs);...
968b38ef9079fe1e172501f81c38636e71a748d476a81b06889bfab8c5b5c8ec
MATLAB
2,925
70
% Name: Robert Kim % Date: 09-01-2024 % Email: robert.f.kim@gmail.com % fnc_time_bootstrap.m % Description: Pointwise bootstrap confidence intervals (per timepoint) for % two time-resolved data series and their difference. At each timepoint, % resample trials with replacement nboot times, compute the per-condition % me...
175ba835ed4f1a9c3bb48b6f67015880a1ddcdcd2ae238f9de22ccc400fe1c37
MATLAB
2,927
146
function [ node_num, node_dim, element_num, element_order ] = ... gmsh_size_read ( gmsh_filename ) %*****************************************************************************80 % %% GMSH_SIZE_READ reads sizes from a GMSH file. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modifi...
70be529dfcf5899bd2fa61c0ad0c3eb954a47142db8a5910ea2caaf7f8d5297b
MATLAB
2,927
107
%% QUICKENT - quick entropy calculation % Calculates the entropy for the input data. The data can be continuous or % discrete. If the data is single trial, the entropy is calculated through % time. If the data is trial based, the entropy is calculated at each time % point in the trials. For discrete and continuous data...
b36e2a9d2a79a20440fbe517b8c0553686993135cd63fc403165c9a79569b29e
MATLAB
2,928
108
function [ WW , WO , WS , DS , SI , ORIGWSPOS ] = stream_to_collocation_data( DS_IN , WS_IN , WO_IN , stopwordsfile , freqcutoff , doexcludenumbers ) %% Function stream_to_collocation_data %% % A utility to convert the stream data used by HMM-LDA model into stream % data useful for the LDA-COL model. %% % |[ ...
1921a0d3993e0bc87680aa0f6f7f6936af9950d37f4d9f4414f3568bd701529c
MATLAB
2,929
78
% 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...
21d36375dd3ccc00f9cdb12b9e742807ccdd99695125f27411691bd9ea100fba
MATLAB
2,929
74
%% Description % This script does further preprocessing after trial % exclusion, trial classification, and ICA. % Three steps are included in this procedure: % 1. Common average referencing (CAR) % CAR re-references data by subtracting the common % average of trial data from channels of the same % ...
e67031a8f63ef90f04ad60b63644b239aa51942709f918e6a75d2aef446733f1
MATLAB
2,929
79
%% PaCER/EXAMPLE_5_1.m - Continuing Example 5 by adding fibertracts from MRtrix and projecting a VTA to them % % Andreas Husch % Centre Hospitalier de Luxembourg (CHL) / Luxembourg Centre for Systems % Biomedicine (LCSB), University of Luxembourg % mail@andreashusch.de / husch.andreas@chl.lu % % Mikkel V. Petersen % Ce...
b2466e5318cd863e6111fb17ef1bc43633200321ca7dfd8a3ea7e901d8eb3de3
MATLAB
2,930
81
function ea_connectome_from_pathways(obj, connectomeName, N_voters, N_sides, negative_vals) % check how many are duplicates % store in one folder in connectomes/dMRI_MultiTract % give original names to connectomes, the function will overwrite % files! connectome_folder = [ea_getconnectomebase(...
de4f4fb0ad66fbfc8b4a7c55f677f50ca15525c3a4994785112b839a10a59d10
MATLAB
2,930
87
function myScreePlot(SS,K,XAX,lam) % Adapted for PLS-SVD % IN: % SS: singular values values % K: cut-off % XAX: x axis limits % lam: null distribution lambda if nargin<3 XAX=[1 length(SS)]; end % pos=get(gcf,'position'); % set(gcf,'Position',[pos(1) pos(2) 1300 300]) title('Scree plot...
1297069cc8357d4b8152adedaa4561e4322eb1136b87db41b2d2028cfc191d45
MATLAB
2,931
63
%% Function GibbsSamplerLDA % Runs the Gibbs sampler for the Latent Dirichlet Allocation (LDA) model % % |[ WP,DP,Z ] = GibbsSamplerLDA( WS,DS,T,N,ALPHA,BETA,SEED,OUTPUT )| will % run the Gibbs sampler for the LDA model on a bag of words data provided % by the vectors |WS| and |DS|. |WS(k)| and |DS(k)| contain the...
7d349db34fd7cfbc60cd6a34f0973da86bb467d825f64d7dfd256c4d32e7c0c8
MATLAB
2,932
85
% eegplot2event() - convert EEGPLOT rejections into events % compatible with the eeg_eegrej function for rejecting % continuous portions of datasets. % % Usage: % >> [events] = eegplot2event( eegplotrej, type, colorin, colorout ); % % Inputs: % eegplotrej - EEGPLOT output (TMPRE...
c5829dc57d2c6f7949c9153509ad3f1e2756e9df722964be3d1f47702dde023b
MATLAB
2,932
176
% This video was uploaded and converted to .gif with Giphy: % https://giphy.com/create/gifmaker % % https://media.giphy.com/media/ybSv8dGOxnVZ45TsR4/giphy.gif myfile = which('canlab_dartmouth_brainlogo.m') mypath = fileparts(myfile); cd(mypath) D = imread('D-Pine_Black.jpg'); Dflat = any(D, 3); Df = uint8(repmat(Dfl...
36c0dfdc00018d8ca541777536a465c34b6f3acebe19c34c2bd2a9ec08b90b86
MATLAB
2,933
82
function r = surrogateContract(x, gen, nSurr) %SURROGATECONTRACT Measure what a surrogate generator actually preserves. % % r = nonantest.surrogateContract(x, gen, nSurr) % % gen is a function handle producing ONE surrogate: @(v) surr_theiler(v,1). % % Returns measured quantities and asserts nothing; the caller d...
cba63e0e680ad5eee4a8d2ae3805961363efe1c3e06ca59ef637331d5241f363
MATLAB
2,934
59
function varargout=ea_normalize_fsl(options) % This is a function that normalizes both a copy of transversal and coronal % images into MNI-space. The goal was to make the procedure both robust and % automatic, but still, it must be said that normalization results should % be taken with much care because all reconstruct...
f20801524e94800827fd2b165164ab23d861eed99c26e7cabe297c4f883c8ff3
MATLAB
2,934
60
function presenceRatio = presenceRatio(theseSpikeTimes, theseAmplis, presenceRatioBinSize, startTime, stopTime, param) % JF, Calculate fraction of bins that include one or more spikes from a particular unit % ------ % Inputs % ------ % theseSpikeTimes: nSpikesforThisUnit × 1 double vector of time in seconds % of each...
0ca211d315460d70a96b035be3e1ff61aa13097e071d7ce764b623e2c114f69b
MATLAB
2,935
57
function plotmsd4Exclude2(x,y,s,ExcludeVals,cc) % Usage ... plotmsd4(x,y,s,c) % % Plots the vector y against vector x overlaying a shaded region % by s using the color defined in c. The figure to plot should be % cleared to avoid transparency problems. % % Ex. plotmsd4([0:0.05:20],sin(2*pi*0.15*[0:0.05:20]+pi/3),ones(1...
326c80b37e84fd17626a00f89abcb7aae3fc69a6f2ae8784b7e0f7b9b5dace1c
MATLAB
2,935
97
function palm_ptree2dot(Ptree,dotfile) % Create a DOT file from a permutation tree, that can be used % with GraphViz for visualisation. % % Usage: % palm_ptree2dot(Ptree,dotfile) % % Ptree : Permutation (dependence) tree. % dotfile : DOT file to be created. % % Reference: % * Winkler AM, Webster MA, Vidaurre D, N...
6ccf3c29fd2a16b4a661c8b54d69b555889426d0ee57c2f9f98f7fe093e20325
MATLAB
2,939
115
close all clear all %% load data load("combined_data_for_correlationsNEW.mat") maxLagMinutes = 23; analysis_number = 3; % 1 is NB area vs SC Intensity % 2 is SC Contact Length vs SC Intensity % 3 is SC Area vs SC Intensity filter_data = 1; chopMS2 = 0; %% if analysis_number == 1 Variable1 = CombinedNBArea./Co...
45b7bc4817373df65cab6226dc246deeaa04e59316ca8e62cc61551c0dfe3eec
MATLAB
2,941
106
function out = export_channel_info_NIRx(probe_file, montage_name, varargin) %FNIRSPOWER.HELPERS.EXPORT_CHANNEL_INFO_NIRX % Export NIRx channel names and positions for the Python power pipeline. % % Usage: % out = fnirspower.helpers.export_channel_info_NIRx( ... % probe_file, montage_name); % % Required inputs: ...
768fb80ed8188e2976d2ab7924ef625df8ac7f7448664f680ced9d0f3f14c4a8
MATLAB
2,941
68
function [ NCSE ] = ent_symbolic( X, L ) % [ SymEnt ] = ent_symbolic( X, L ) % symbolicEnt Calculates the Symbolic Entropy for given data. % Input - X: 1-Dimensional binary array of data % L: Word length % Output - NCSE: Normalized Corrected Shannon Entropy % Remarks % - This code calculates the Symbbolic ...
856dc8bcc69971123ad75d3d1fe56491bfec2caa69066318988129e9b694d3c9
MATLAB
2,941
93
function map = jetm(m) %JETM Muted jet colormap. % JETM(M), a variant of JET(M), returns an M-by-3 matrix containing a % muted version of the JET colormap. % JETM, by itself, is the same length as the current colormap. if (nargin < 1), m = size(colormap,1); end; % This colormap was constructed m...
fe2ae82022b7cd735ec43bbbefb0c5da169f0e97398ffbc886f3f5aec8e6dc4e
MATLAB
2,942
96
function depth_first_search(A,u,dfs_visitor,varargin) % DEPTH_FIRST_SEARCH Fully wrap the Boost depth_first_search call % including the dfs_visitor. % % depth_first_search(A,u,dfs_visitor) performs a depth first traversal % of A starting from vertex u. For each event defined by the dfs_visitor % structure below, the...
9e272f3160532b2c7095294ce4541b7b3e5acdb3737295160303a013d7439ad5
MATLAB
2,944
87
function [siglev,res]=arres(w,A,v,k) %ARRES Test of residuals of fitted AR model. % % [siglev,res]=ARRES(w,A,v) computes the time series of residuals % % res(k,:)' = v(k+p,:)'- w - A1*v(k+p-1,:)' - ... - Ap*v(k,:)' % % of an AR(p) model with A=[A1 ... Ap]. % % Also returned is the significance leve...
03b842aab9aa6a699490c985e0db52d783c0da2cfac58d369828a6a9d6ef4b9a
MATLAB
2,945
83
function [yhat, mdls] = fitSpline(x, y, n, winSz, ovrlap, verbose) %FITSPLINE Fits an nth order piece-wise polynomial to the given signal y to %the values inside the given window size winSz and overlapping the fittings %ovrlap percentage (0-1) % [yhat, mdls] = fitSpline(x, y, n, winSz, ovrlap) % INPUTS: % ...
1efb60c9f230166eb701b137faa1803e18c1c32c8e66f8b7741b5582bc5ae0eb
MATLAB
2,945
107
function [ rgb ] = hex2rgb(hex,range) % hex2rgb converts hex color values to rgb arrays on the range 0 to 1. % % % * * * * * * * * * * * * * * * * * * * * % SYNTAX: % rgb = hex2rgb(hex) returns rgb color values in an n x 3 array. Values are % scaled from 0 to 1 by default. % ...
db7bc6899b6ecac3ff5a9759303b29bb88eaf4c4814ae0ae1614f8919c91ef3c
MATLAB
2,946
86
function options = ea_ensure_fa_and_fa2anat(options) % Ensure FA map exists and FA coregistered to anatomical is in coregistration/anat. % % When running Lead Connectome (structural), this helper: % 1. Creates FA from DWI if not present (preprocessing/dwi/*_fa.nii). % 2. Coregisters FA to the anatomical (T1) and writ...
d67cae40548d6f9353504f087bf4a20008cd23f6c85b6f3a8a1e175cfb68294f
MATLAB
2,947
112
function [] = fig2latex(ax, fname, media9_or_movie15, pdforxelatex) %FIG2LATEX Convert axes to U3D file, generating LaTeX code including it. % % usage % FIG2LATEX(ax, fname, media9_or_movie15, pdforxelatex) % % input % ax = axes object handle % fname = file name % media9_or_movie15 = select LaTeX package for i...
35b00a60173a0abcd783abde127847d2af2cecb8b47f7e9d32fad071bea13597
MATLAB
2,950
68
function [age, gender, dx] = CBIG_MMLDA_get_age_gender_dx(DXSUM_file, PTDEMOG_file, phase, rid, viscode) % [age, gender, dx] = CBIG_MMLDA_get_age_gender_dx(DXSUM_file, PTDEMOG_file,... % phase, rid, viscode) % % This function get age, gender, dx based on ADNI DXSUM and PTDEMOG spreadsheets. % % Input: % - DXSUM_fi...
9ae064bc87f93b846afb66c4e42eea8f5fa2522727c44aaec8461a47d71aadad
MATLAB
2,952
68
function this = subsasgn(this,index,c) if isempty(this) this = eegobj; end; % mulitple dataset if strcmpi(index(1).type, '()') && length(index) == 1 % dataset assignement if isempty(c) % suppression this(index.subs{1}) = []; else % cre...
700d59ca45810643919586c70a5a416ae7b05bdd248ddcb54c66afb5a7481ea0
MATLAB
2,954
73
function [tscounts, wfcounts, evcounts, contcounts] = plx_info(filename, fullread) % plx_info(filename, fullread) -- read and display .plx or .pl2 file info % % [tscounts, wfcounts, evcounts, contcounts] = plx_info(filename, fullread) % % INPUT: % filename - if empty string, will use File Open dialog % full...
f92b93aa4b8ede4f069d8310684c4dee9f9d2c00566d6ee34d70a059a645bfca
MATLAB
2,954
74
function dockexample() %DOCKEXAMPLE: An example of using the panelbox dock/undock functionality % Copyright 2009-2013 The MathWorks Ltd. % Create the window and main layout fig = figure( 'Name', 'Dockable GUI example', ...' 'NumberTitle', 'off', ... 'Toolbar', 'none', ... 'MenuBar', 'none', ... 'Clo...
fb9328d239ca12d6d68f3fe802fd834c5de1a813a169de57e57734e4e0c2538d
MATLAB
2,954
69
function [qMetric, param] = prettify_names(qMetric, param) % Define name mapping oldNames = {'minTroughToPeakRatio', 'firstPeakRatio', ... 'minMainPeakToTroughRatio', 'minWidthFirstPeak', ... 'minWidthMainTrough', 'RPV_tauR_estimate', 'isoD'}; newNames = {'maxScndPeakToTroughRatio_noise', 'maxPeak1ToPeak2Rati...
1431999574ca896b8baa44c599ee19ab7cf77f6e009b544de6d07b03fb3f12b5
MATLAB
2,955
120
function testspecgram(data) %cd 'C:\Documents and Settings\Admin\Desktop\'; %data=wavread('bird109_26519_on_Aug_19_16_33.wav'); params.tapers = [3 5]; params.fpass = [100 20000]; params.Fs = 44100; params.pad = 2; max_time =10; % seconds per run max_tapers = 150; increment = 1.5; profile on nsample...
384513c4daa2ed75cb91d00e5f0f0fea73d26706dd6f35e5abd846f9f4c251c8
MATLAB
2,955
57
function plotmsd4Exclude(x,y,s,ExcludeVals,cc) % Usage ... plotmsd4(x,y,s,c) % % Plots the vector y against vector x overlaying a shaded region % by s using the color defined in c. The figure to plot should be % cleared to avoid transparency problems. % % Ex. plotmsd4([0:0.05:20],sin(2*pi*0.15*[0:0.05:20]+pi/3),ones(1,...
503a4c86500a053ae4dbfbf3bc6346f379041b5930a5779603df4ab0c353920e
MATLAB
2,955
88
function [fig, varargout] = draw_surface_bluewhitered_dull(surface_to_plot, data_to_plot, hemisphere, medial_wall, with_medial) % draw_surface_bluewhitered_dull.m % % Draw data on surface using blue-white-red colormap for % negative-zero-positive values with dull plot lighting % % Inputs: surface_to_plot : surface stru...
b5747fc9c4a163046e5cd0232543f397ec02671fbd9d92fd838cfd969d71980f
MATLAB
2,955
84
% rsadjust() - adjust l-values (Ramberg-Schmeiser distribution) % with respect to signal mean and variance % % Usage: p = rsadjust(l3, l4, m, var, skew) % % Input: % l3 - value lambda3 for Ramberg-Schmeiser distribution % l4 - value lambda4 for Ramberg-Schmeiser distribution % m - mean of t...
f319e9362860b473656d1b6a64947ffef5be261262e0465d4b29b36b0be42ef7
MATLAB
2,956
97
function stackview(imgs,showfun) if nargin == 1, showfun = @imshow; end; if iscell(imgs), if length(imgs) > 3, display('maximum three volumes'); return; end; for k = 1:length(imgs), if ~isempty(imgs{k}), sz = size(imgs{k}); break; end; end;...
2059edc766b2c3d69f3b9047cf0d66a41a8333f05d0b3979d7e16231ec1ef1b8
MATLAB
2,957
83
function corr_array = compute_scf(sigma_n, position_centre_grid, topology, dx, dt, hetparam_het, homparam, tol) % Compute the SCF with reference point p, with given sigma_n % Set tolerance if not given if nargin < 8 || isempty(tol) tol = 1e-7; end % Create stim struct sum_xy = zer...
3c1dd2c371183a6066334ce390f4b85d8dfada3cb917e10425ffca92c2087ecf
MATLAB
2,957
77
ccc; %% Path % GRANGERPATHs0 = dir("..\MAT Data\granger result raw\Prediction\**\*.mat"); GRANGERPATHs0 = dir("..\MAT Data\granger result raw\Prediction\**\single\**\*.mat"); SINGLEPATHs = unique({GRANGERPATHs0.folder})'; SAVEPATHs = cellfun(@(x) strrep(x, '\granger result raw\', '\granger result minus base\'), SINGLE...
446e6d142f34ac11fd88fdcd0b934ebcaa203d822983216b1d096691c3e9df6f
MATLAB
2,957
90
% pop_rejepoch() - Reject pre-labeled trials in a EEG dataset. % Ask for confirmation and accept the rejection % % Usage: % >> OUTEEG = pop_rejepoch( INEEG, trialrej, confirm) % % Inputs: % INEEG - Input dataset % trialrej - Array of 0s and 1s (depicting rejected trials) (size is ...
8d129d1887c0747d2d819f96181d79971ed8e8ad46fd6d39b1e40f65464b33fe
MATLAB
2,957
89
% difftopo - compute and plot component decomposition for the difference ERP % between two EEG datasets. Plots into the current axis (gca); % plot into a new empty figure as below. % Usage: % >> figure; difftopo(ALLEEG,eeg1,eeg2,interval); % Inputs: % ALLEEG - array of leaded EE...
ba667f2edf0620071f4debd81d0e26093a16a3c247bb00c30ae2cbd4ed917f29
MATLAB
2,957
96
function result=mahalanobis(x,locvct,varargin) %MAHALANOBIS computes the (squared) distance of each observation in x % from the location estimate (locvct) of the data, % relative to the shape of the data. % % Required input arguments: % x : data matrix (n observations in rows, p variable...
20bc9435b8a4e281c9101693123b8e439c184781a65b3bc8dcc0c0a01aa399d9
MATLAB
2,958
97
% Minimize stopband ripple of a linear phase lowpass FIR filter % "Filter design" lecture notes (EE364) by S. Boyd % (figures are generated) % % Designs a linear phase FIR lowpass filter such that it: % - minimizes the maximum passband ripple % - has a constraint on the maximum stopband attenuation % % This is a convex...
48b981def647b788325e87898ef8f51f6124e7749906fee4d4a7c0b5669253b0
MATLAB
2,958
90
% Name: Robert Kim % Date: 05-13-2023 % Email: robert.f.kim@gmail.com % fnc_eval_model2.m % Description: Variant of fnc_eval_model.m. Instead of accepting a modified % recurrent weight matrix (mod_ww), this version takes a list of unit indices % (mod_nn) and clamps their firing rates to 1 during the stim1 window % (tim...
6f15243da65f667b48f85359d46f49ef3dcbb56ae0d58256c3d5ef522d4b4bd6
MATLAB
2,958
65
clear all close all do_save=1; bioroot='MOUSE_NOSK15_7_20170818'; bparms1=[-2000 18000]; bparms2=[-5000 62000]; bparms4=[-5000 42000]; sparms1=[200 20]; % 5Hz 4s sparms12=[200 40]; % 5Hz 8s sparms2=[100 40]; % 10Hz 4s sparms22=[100 80]; % 10Hz 8s sparms4=[50 80]; % 20Hz 4s sparms42=[50 160]; % 20H...
4e075ac9cb553c108c567cd73b08539d038ee5205812b95f830099cfd3757870
MATLAB
2,960
84
function SaveBinary(filename,data,varargin) %SaveBinary - Save data in a multiplexed binary file. % % USAGE % % SaveBinary(filename,data,<options>) % % filename file to save to % data data to save % <options> optional list of property-value pairs (see table below) % % =============...
6bd6417eef4088c584a980f0d23457ff208fedefff362631d592f6fa108ccfd9
MATLAB
2,961
69
function sigma = nonst_stat(data,A,sumV,params) % Nonstationarity test - continuous process % % Usage: % % sigma=nonst_test(data,A,sumV,params) % Input: % Note units have to be consistent. See chronux.m for more information. % data (1d array in samples) -- required % A quadratic coefficient ma...
71815287cfa315946278d663505ebb31a36432540716504820273171ec88b041
MATLAB
2,961
66
% 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...
a90e271723dbfea5d69c9976c5aff5d071023c76282a1c419988642dedd2fe57
MATLAB
2,963
86
% Plot brain parcels from an atlas in MNI152 space % For this example, the atlas/parcellation file must be a full % probabilistic atlas. This enables image thresholding based on % probabilty values. You can do all the rest of the commands with only an % image with labels, however. % % Creating an atlas object requir...
a4b56a9b752467685d14e7ff4e5fd95bb022ba6269f14e68d7fa9b1173baa32c
MATLAB
2,965
81
function axcodes = ea_aff2axcodes(affine, tol, labels) % Calculcate axis direction codes from affine matrix % Can be used to set the 'voxel_order' in track file (*.trk) header % % tol: {None, float}, optional % Threshold below which SVD values of the affine are considered zero. % If 'tol' is None, and 'S' is an ...
bd97612ba17295833f772b6da2e529c6ba0595fd1a475c27e802a7a841419282
MATLAB
2,969
84
function [ei Ei] = edge_weight_index(A,varargin) % EDGE_WEIGHT_INDEX Build a conformal matrix of edge index values for a graph. % % [eil Ei] = edge_weight_index(As) returns a vector where % As(i,j) not= 0 implies Ei(i,j) not= 0 and Ei(i,j) = eil(i) % for an integer value of eil(i) that corresponds to the edge index ...
b15dc4b09341066a73ffc36b636b2b86dca375ee9e99b40777116a7cee7e1c63
MATLAB
2,970
112
function CBIG_pMFM_step1_generate_permutation_order_desikan() % This function is the first step of the permutation test of SWSTD-FCD % correlation. In this step, 10000 permutation order will be generated and % store for further use. % % Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab...
e5c805336b145e5cb02a1b2493f0b26fa00c5432e8ae41517ec46cfe960cbc34
MATLAB
2,971
92
function x_oct = smoothSpectrum(X,f,Noct) %SMOOTHSPECTRUM Apply 1/N-octave smoothing to a frequency spectrum % % X_OCT = IOSR.DSP.SMOOTHSPECTRUM(X,F,NOCT) applies 1/NOCT-octave % smoothing to the frequency spectrum contained in vector X sampled at % frequencies in vector F. X can be a log-, magnitude-, or % po...
17c9199988f3584ce65e806f35eb87261efd3b24d50630b9daaf2a67a2deb71f
MATLAB
2,973
64
% 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...
5c3f8d632b61d28f0d83949af392e273698069c0cca05747ca0d99a5288c564f
MATLAB
2,974
88
function plotModulatedCountsVenn(allROIs) % Plots Venn diagram circles for the number of cells modulated for all % intersections of the three events % Paper ready figure/axis formatting fig; panelwidth = 2.25; panelheight = 3; leftoffset = 0.5; bottomoffset = 0.5; formatFigure(gcf, panelwidth, panelheight, leftoffset,...
95dfa48b8868d32dc8a23e5eebb39f144ed181f8da689678d6145d6f58aea8e2
MATLAB
2,974
79
function success=ea_hotfix(varargin) % lead hotfix success=0; local = ea_getvsn('local'); web = ea_getvsn('web'); % if local version unknow or outdated, skip applying hotfix hotfix = 0; if strcmp(local,web) % local version is the latest release, applicable for hotfix hotfix = 1; end earoot=ea_getearoot; updurl =...
fc3c26732b123a36698221f98b329cf1704aa8b307c9099f938a4994dcea7c2f
MATLAB
2,974
87
function [out, sigmab2] = ICC(cse,typ,dat) %function to work out ICCs according to shrout & fleiss' schema (Shrout PE, %Fleiss JL. Intraclass correlations: uses in assessing rater reliability. %Psychol Bull. 1979;86:420-428). % % 'dat' is data whose rows represent different ratings or raters & whose % columns rep...
fea522c86eda0d963321e1b22f378fc1e128fcb7a78688eb756990d127f3eb48
MATLAB
2,974
96
function [ newstruct1, newstruct2 ] = bz_Matchfields( struct1,struct2,mode ) %[ newstruct1, newstruct2 ] = bz_Matchfields( struct1,struct2,mode ) %Takes two structures that may have different fields and gives them the %same fields. Mode can either be 'remove' or 'add' (mismatching fields) % %If struct1 is a cell array ...
52d1b60d5420109a7072450d559338ca6503d034fc6b53b6ac312a033aa15e56
MATLAB
2,976
115
function [HIPshanks, ECshanks]=getshankECHIP_LV_multi(animal) if strcmp(animal, '3xTg1-1')==1 HIPshanks=[2,3];%2 ECshanks=5; %5 elseif strcmp(animal, '3xTg1-2')==1 HIPshanks=4;%3 ECshanks=6; elseif strcmp(animal, 'WT45-2') == 1 HIPshanks =[3,4]; ECshanks =5; elseif strcmp(animal...
6796d785a0ebc9927e1c274564c82123496efbe5645039a3fe552deb18c5c4f6
MATLAB
2,976
85
function [flowval cut R F] = max_flow(A,u,v,varargin) % MAX_FLOW Compute the max flow on A from u to v. % % flowval=max_flow(A,u,v) computes the maximum flow on the network defined by % the adjacency structure A, with source u and sink v. % % [flowval cut R F] = max_flow(A,u,v) returns the maximum flow in the % networ...
aaeb969e1a52c618dcc762026bbabe8b98274e92b103dea03b19db34d35cf198
MATLAB
2,976
82
%% Figure 9 analysis YOURDATAPATH = ''; % Load ROIs and border classifier data fileList = searchFilesRecursive(YOURDATAPATH, 'allROIs.mat'); load(fullfile(fileList.folder, fileList.name)) fileList = searchFilesRecursive([YOURDATAPATH 'models'], 'areaGMMs.mat'); load(fullfile(fileList.folder, fileList.name)) % Using on...
775bd8667cb258c8088a09bfbc45f2a11800c578d5c5afcbac7cd19a7a66d2ac
MATLAB
2,977
81
function y = base64decode(x) %BASE64DECODE Perform base64 decoding on a string. % % BASE64DECODE(STR) decodes the given base64 string STR. % % Any character not part of the 65-character base64 subset set is silently % ignored. % % This function is used to decode strings from the Base64 encoding specified % in...
c88355ce4d8ad309a66c0c0cc66ebf6328d194f0a4bf643c715f537f63ba9c92
MATLAB
2,977
101
function [y, se] = predict(varargin) % Interpolate a fit produced by locfit(). % % predict(fit) produces the fitted values at locfit's selected points. % predict(fit,x) interpolates the fits to points specified by x. % % Input arguments: % fit The locfit() fit. % x Points to interpolate at. May ...
d4f0e490944344c6b7262662437882728e8245cb0ac4a8933eedd508287451ce
MATLAB
2,978
65
function [shifts,Mf] = register_frame(Yt,fftTempMat,fftTempPatches,patches,options) minY = min(Yt(:)); maxY = max(Yt(:)); dim = size(Yt); Yc = split_frame(Yt,patches); fftY = fft(fft(fft(Yc,[],1),[],2),[],3); nd = ndims(Yt); n_patches = [length(unique(patches(:,1))),length(unique(patches(:,3))),length(unique(patches(:...
f6c8ef669192cc0d2b825e31e6e1fd434e1ef3345e82d43a7a9777dfd9170fe8
MATLAB
2,978
62
function [XtrP, XteP, pre] = foldPreprocess(Xtr, Xte, Ctr, Cte, scaleMode) % foldPreprocess Per-fold, train-only preprocessing for the ML pipeline family. % % [XtrP, XteP, pre] = foldPreprocess(Xtr, Xte, Ctr, Cte, scaleMode) % % Composes the two train-only transformations every pipeline fold needs, in % the one ...
4cbd624420fa8b8f787fdf026d2e52a4c3cde6b93e444a12fef077e22563e91e
MATLAB
2,979
79
classdef ImportCellMaskProcess < DataProcessingProcess %Class definition for cell mask import % % Copyright (C) 2021, Jaqaman Lab - UTSouthwestern % % This file is part of conditionalColoc. % % conditionalColoc is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public ...
74e2bb5690106c0a935250222a3446e9bd195150f6532b2f1a923798c1bcba6c
MATLAB
2,980
72
%% params nChSource = eval(['nCh', sourceArea]); nChTarget = eval(['nCh', targetArea]); grangerspctrm = eval(['grangerspctrm_', sourceArea, '2', targetArea, '_topo', topoArea]); chs2Avg = eval(['chs2Avg', topoArea]); if strcmp(topoArea, 'AC') posIndex = 1; else posIndex = 2; end fIdx = cellfun(@(x) unique(dse...
a0a85f0c04f7f10c8b5a6f447ede9a0a731261cfd24274f939dd03ef19f11601
MATLAB
2,980
121
function result = cvmultnet(object, lambda, x, y, weights, offset, foldid, ... type, grouped, keep) if nargin < 10 || isempty(keep) keep = false; end typenames = struct('mse','Mean-Squared Error','mae','Mean Absolute Error',... 'deviance','Multinomial Deviance','class','Misclassification Error'); if strc...
37654a8521e781b5416a85c20d18be798fecaefd5c152ec88d4d2222c1ee1c33
MATLAB
2,982
88
function [classEvs] = checkEvents(ts) % check events ch = 'all'; basepath = pwd; noPrompts = true; eventsType = 'UDStates'; win = 5; shanks = 1; sw = []; sessionInfo = bz_getSessionInfo(pwd, 'noPrompts', noPrompts); lfp = bz_GetLFP(ch,'basepath',basepath,'noPrompts',noPrompts); classEvs = ones(size(ts)); fprintf('%...
40d57df379086147504dc8640078885273d52a05ca09b54a8abfae2fe484036f
MATLAB
2,982
86
% robust_kmeans() - an extension of Matlab kmeans() that removes outlier % components from all clusters. % This is a helper function called from pop_clust(). function [IDX,C,sumd,D,outliers] = robust_kmeans(data,N,STD,MAXiter,method) % data - pre-clustering data matrix. % N - number of wanted cluster...
b5d7f6585fc723ca2d02170847085bd2a8a704d635cb82d0de80bc16763a308b
MATLAB
2,982
93
classdef CardPanel < uix.CardPanel %uiextras.CardPanel Show one element (card) from a list % % obj = uiextras.CardPanel() creates a new card panel which allows % selection between the different child objects contained, making the % selected child fill the space available and all other childre...
24d19d4de15566e0915469d72b7046fded72f946b95d9da0453549ce5ec0bc8c
MATLAB
2,983
82
function [C,phi,S12,confC,phierr,Cerr]=cohmathelper(J,err,Nsp) % Helper function called by coherency matrix computations. % % Usage: [C,phi,S12,confC,phierr,Cerr]=cohmathelper(J,err,Nsp) % Inputs: % J : Fourier transforms of data % err : [0 p] or 0 for no errors; [1 p] for theoretical confidence level, % [2 p...
fc1007211b3715a9229c050ff1a9ca5906304a9168800c3f0b12afb051c8a104
MATLAB
2,984
87
% std_rebuilddesign - reduild design structure when datasets have been % removed or added. % Usage: % STUDY = std_rebuilddesign(STUDY, ALLEEG); % STUDY = std_rebuilddesign(STUDY, ALLEEG, designind); % % Inputs: % STUDY - EEGLAB STUDY set % ALLEEG - vector of the EEG datasets includ...
35d8c5980336ac7bff5acaef4e4eca075827f35d3efc0aee8d4896df37bbc414
MATLAB
2,985
91
function pvals_LC = myPLS_permut(X,Y,U,S,nPerms,grouping,normalization_img,normalization_behav,seed) % Permutation testing over singular values obtained with PLS % Rows (subjects) of Y are permuted within each diagnostic group % % Inputs: % - X : N x M matrix, N is #subjects, M is #FC % - Y ...
5ddde85bb56e8691a934f26233f3236522e9158fdab6fe332d2e98b223b8e985
MATLAB
2,985
112
function CBIG_pMFM_step1_generate_permutation_order_schaefer() % This function is the first step of the permutation test of SWSTD-FCD % correlation. In this step, 10000 permutation order will be generated and % store for further use. % % Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLa...
4f37e0271810ccc46fbbeefe598730b18ec9aa21b92f69ad883aa70a7ed202f8
MATLAB
2,986
90
function varargout = plotLayout(varargin) % Description: plot layout image to figures or axes % Input: % FigsOrAxes: target figures or axes array % posIndex: 1 - AC of CC % 2 - PFC of CC % 3 - AC of XX % 4 - PFC of XX % alphaValue: alpha from 0 to 1. % ...
cf4aa40a6d700d4f790919e5c16ae10384408cb06f596e026eff9729a22c6742
MATLAB
2,986
88
function [U,S,V,Lx,Ly,explCovLC,LC_behav_loadings,LC_RSFC_loadings] = myPLS_analysis(X,Y,normalization_img,normalization_behav) % PLS analysis (main script) % % Inputs: % - X : N x M matrix, N is #subjects, M is #FC % - Y : N x B matrix, N is #subjects, B is #behaviors % - normaliz...
f4ac0fbecefa40c6366f680e31fae147bf92f4c875b84438c992a15f4f0c9f99
MATLAB
2,986
80
ccc; AREAs = {'AC', 'PFC'}; temp = dir("..\MAT Data\cwt result\Prediction\**\cwtres_*.mat"); ROOTPATHs = unique({temp.folder}'); %% Params ncmb = 16; %% granger causality computation for rIndex = 1:length(ROOTPATHs) disp(['Current: ', strrep(mu.getlastpath(ROOTPATHs{rIndex}, 6), '\single\', '\')]); CWTPATHs...
5cd323458719bb48302bce7bea0738c34bc85a6ce033ee8dff5fe7be55c49cab
MATLAB
2,987
108
function [ probs_sorted , index , probs ] = AssociationLDA( WP , BETA , W1 ) %% Function WriteTopics % % works on single samples as well as multiple samples if iscell( WP ) % we are dealing with multiple Gibbs samples. Need to average % predictions over these samples. Note that the WP samples do not have ...
70c3bfbe3ac87e97e285a107ec2950f472bb188fda929c9dcc3fe785f0a1d483
MATLAB
2,988
94
function [tuning_curve, theta, ang_hd, mr] = DirectionalTuningFcn(self, cel, varargin) % Computes the head direction tuning curve. % % Arguments (see syntax (2)): % % binsize -> width of binsize in degrees % Continuize -> merge overlapping epochs, and concatonate all data from % root.epoch % % Returns % % tuning_curv...
4edfe435908379cd934a8629fa1cb3d871973b3473ffc8879283a103d703cfa9
MATLAB
2,989
90
addpath('/home/yh19218/Code_IF_2020/Connectivity Measure Toolbox/'); addpath('/usr/local/eeglab/') load('validParticipants.mat') load('electrodes.mat') load('bandReference.mat') bands = [0.5 4;4 7.5;8 12;12.5 16] ; mainfolderlist = {'1_1s';'2_2s5';'3_5s';'4_10s'}; % Read the data fileIndex = 4; foldername = mainfolder...
7f0aa6f14cec5a8ed2eb13b4f46ee4c1d6f1070599ad01f091e5acf0124749e1
MATLAB
2,993
76
function [vvx, vvy] = get_vertex_velo_viscous(V, topo, VF, B, strain) % GET_VERTEX_VELO_VISCOUS Solve for vertex velocities including % cell-cell viscous adhesion coupling between neighboring vertices % (Lees-Edwards sheared PBC version). % % [vvx, vvy] = GET_VERTEX_VELO_VISCOUS(V, topo, VF, B, strain) builds % th...