sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
22e76729fe1ea0f80512eba4fb5cf812e3cfc43ffe0a5370a229c8c9ada21138
MATLAB
953
34
function [P,T,L,r,centerX,cX]=kernelEVD(X); %KERNELEVD (kernel eigenvalue decomposition) performs a singular value decomposition % of a matrix with more columns than rows. % % Required input: % x : data matrix of size n by p where n < p (else classSVD is invoked) % % I/O: [P,T,L,r,centerX,cX]=kernelEVD(X); % % T...
26dc552661d8e8a33e66098f1945bed66e6e9427a966f696c51808defee4114f
MATLAB
955
39
% NDMwS % % Evaluate NDMwMC predictions [y] at desired time stamps. % % Input: % x0 = Initial Condition % time_stamps = provided in units given by experiment % C = connectivity matrix % beta = diffusivity parameter % alpha0 = cte growth/decay term dependin...
7353bc6d061d5026af9a859f8aed886364307bfa41fadfea181bcff7c30ba3af
MATLAB
955
34
function draw_signifpatch(time,sign_p,col) %DRAW_SIGNIFPATCH % DRAW_SIGNIFPATCH(time,sign_p,col) draws a filled rectangle with reduced opacity % where significant differences were detected across time. % Input parameters: % TIME time vector of plotted figure % % SIGN_P significance vector of 0s and 1s...
f030860cd1470afcc8cd74344f783279f08256487579669b2114424e3479518a
MATLAB
955
26
function [ nexFile ] = nexAddEvent( nexFile, timestamps, name ) % [nexFile] = nexAddEvent( nexFile, timestamps, name ) -- adds an event % (series of timestamps) to nexFile data structure % % INPUT: % nexFile - nex file data structure created in nexCreateFileData % timestamps - vector of event timestamp...
fc8eb7632698e19f8bbf89feae66a98258340931e261bc70f9b26cf2ee3ef3a8
MATLAB
955
45
function V = solveV_eig(U, Us, Vs, Ss, reg_smooth, reg_l2) % solve S analytically using eigen-decomposition % % TODO: check with optimization form. n = length(Ss); UtU = U' * U; [Q1, Lu] = eig(UtU); V = cell(n, 1); for ii = 1:n V{ii} = solveVi(U, Us, Q1,...
417bbb1129b939a5856f94a0bc8cd999660aab33d48a7db34c4bc94c8f196da3
MATLAB
957
33
function cmap = green_white_magenta(n) %GREEN_WHITE_MAGENTA Creates a green-to-white-to-magenta colormap % usage example: % colormap(green_white_magenta(256)); % colorbar; % % cmap = GREEN_WHITE_MAGENTA(n) returns an n-by-3 colormap array. % If n is not specified, it defaults to 256. if nargin < 1 n = ...
1867c1db0bf845b3d6e4d3e480ecb1a05a674d40f61445a74d5de0b9c3cf2c6f
MATLAB
959
39
function entry = findindict(c,dcode) % Look up an entry in the dictionary %__________________________________________________________________________ % Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging % % $Id: findindict.m 7147 2017-08-03 14:07:01Z spm $ entry = []; d = getdict; d = d.(dcode); if ischa...
8bb6b500576d269240da6a120fc69d174e6d17e05e8c6c85634a1c5f2ebf8957
MATLAB
960
25
matdir = '/Users/justintorok/Documents/MATLAB/Nexis/raw_data_mouse'; load([matdir filesep 'eNDM_mousedata.mat'],'Networks'); load([matdir filesep 'KaufmanDiamond_datasets_dat&seed.mat']); load([matdir filesep 'regional_Gene_Data.mat'],'regvgene_mean'); C = Networks.ret/max(Networks.ret(:)); tpts = tpts.DS6; data = data...
e218d4f765f48e477efdf7bc24f773d447a2bad0f0176751cfe524767e4b8bdf
MATLAB
963
29
<<<<<<< HEAD function tf = isfield(this,field) % Isfield method for GIfTI objects % FORMAT tf = isfield(this,field) % this - GIfTI object % field - string of cell array % tf - logical array %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust C...
c3ddd71b31b3ddb339a822e3052f0ff26260e231e009f2ebe41efab6a6ee0ab0
MATLAB
965
31
function P = nk_CreateSVMParamArray(Param, P) P.SVM = Param; ctype = nk_GetLIBSVMClassType(P.SVM); switch ctype case {0,4} P.Params{1} = Param.SlackParam; P.Params_desc = {'SlackParam'}; case 1 P.Params{1} ...
e3875f806cc9ed599786ce1fb306c6799b5986eb00267ff9d729119826d3110c
MATLAB
968
34
function IsoDist = IsolationDistance(FD, ClusterSpikes) % IsoDist = IsolationDistance(FD, ClusterSpikes) % % Isolation Distance % Measure of cluster quality % % Inputs: FD: N by D array of feature vectors (N spikes, D dimensional feature space) % ClusterSpikes: Index into FD which lists spikes fr...
394d005ac1cb8e28ab09ac4a1c36ce56385fc6d29c2bc4c566899303096a9769
MATLAB
969
25
clear %% graphing of response delays to show distribution load('ProcessedData\PreProcessed_50window.mat'); Pre_delays_pull = cell2mat(horzcat(Pre_Delay_byDay{1,:})); delays_pull = cell2mat(horzcat(Delay_byDay{1,:})); % drop blanks delays_pull(delays_pull == 0) = []; Pre_delays_pull(Pre_delays_pull == 0) = []; %...
94e40ef356f610f70ff56665d86c9cea020b152a87c81267772efe670995e01c
MATLAB
969
33
function e=num2cellstr(m) % numerical matrix to cell str of the same size %%%% % Copyright (C) <2012> <Yifeng Li> % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the Lice...
1ab22a87c3d7651a49ad3ff0487db05b88470d4f8c71308eb5d4962363e854a7
MATLAB
970
36
function spmTest %this loads sample overlays % each overlay has two contrasts/timepoints % examples saved in both GIfTI and MZ3 format %load GIfTI fnm = fullfile(spm('Dir'),'canonical','cortex_5124.surf.gii'); if ~exist(fnm,'file') error('Unable to find file (it comes with spm12): %s', fnm); end tic; g = gifti(fn...
22b0b821bdc7d0bdc5afb3784f442678a918da81a933322e82dcdf24ed7b6a96
MATLAB
971
34
function [eigNormalized, varargout] = mbm_normalize_eig(eig, nEig, varargin) % normalise each column of eig by dividing by its norm. % %% Inputs: % eig - Matrix of columns of eigenmodes. % % nEig - Number of eigenmodes. % %% Output: % eigNormalized - Matrix of columns of normalized eigenmodes. % Trang Cao, ...
762337c2d0a5a4365ed4d32a4e2a4c7835068369f1c197458f4ec7164ae3be32
MATLAB
972
27
%SPARSE_NN % % This file is part of the Matlab Toolbox for Dimensionality Reduction. % The toolbox can be obtained from http://homepage.tudelft.nl/19j49 % You are free to use, change, or redistribute this code in any way you % want for non-commercial purposes. However, it is appreciated if you % maintain the name of ...
814a12ac78a58301176845437f860c77c8251bb04586a8b0b13eb812defbe3f9
MATLAB
973
26
function mappedX = run_data_through_network(network, X) %RUN_DATA_THROUGH_NETWORK Run data through the network % % mappedX = run_data_through_network(network, X) % % Runs the dataset X through the parametric t-SNE embedding defined in % network. The result is returned in mappedX. % % This file is part of the Matlab ...
e0e7be7848bd774514b2886d5f72b5286922aca968c59e8e806983bb2edcd0ea
MATLAB
975
31
function Q = M2Q(M) % Convert from rotation matrix to quaternion form % See: http://skal.planet-d.net/demo/matrixfaq.htm %__________________________________________________________________________ % Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging % % $Id: M2Q.m 7147 2017-08-03 14:07:01Z spm $ d = diag...
e403dee58f9e762f7bbc3150f1be5c58356c1b31f200fd44c56c6ec1e33597de
MATLAB
980
37
rootfolder = 'Z:\data\EXP\'; %% compile_spontdbs; %% for j = 1 if ~isempty(db(j).expts) moviefolder = fullfile(rootfolder, db(j).mouse_name, db(j).date,... num2str(db(j).expts(1))); else moviefolder = fullfile(rootfolder, db(j).mouse_name, db(j).date); end % process all sav...
1acc458f56bf9d344480c9d304f72a0c5a5538cd8168f2db633676bdefb9280a
MATLAB
981
49
function [H,grad,iter] = nlssubprob(V,W,Hinit,tol,maxiter) % H, grad: output solution and gradient % iter: #iterations used % V, W: constant matrices % Hinit: initial solution % tol: stopping tolerance % maxiter: limit of iterations %global glbnumt H = Hinit; WtV = W'*V; WtW = W'*W; alpha = 1; beta = 0.1; for ite...
2aaed1d3f27a76200a94505f2ad9dc5a0596a43936651eccbdc62b1ff417a513
MATLAB
982
41
function [] = plx_ad_info(filename) % plx_ad_info(filename): prints .plx file a/d channel info % % plx_ad_info(filename) % % INPUT: % filename - .plx file name. Will use file open dialog if filename is empty string % % OUTPUT: % (none) if nargin ~= 1 error 'expected 1 input argument'; end [ filename, isPl2 ] ...
ad229f9b846f32ae8231fecf9c62cb1eb581c325abfb21602e2b92f9c929039e
MATLAB
982
42
function [MI, alph, optk] = nk_EstimKforMIPerm(Y,Labels,kstart,kend,nperms) [kX, ix] = size(Y); kvec = kstart:kend; kvecX = length(kvec); miK = zeros(ix,kvecX); alphK = miK; meanmiK = zeros(ix,kvecX); varmiK = zeros(ix,kvecX); miperm = zeros(nperms,1); TrainInd = zeros(nperms,kX); for i=1:nperms TrainInd(i,:) = r...
6e23e991edda0d28db9ef73b7b0be96627c2dd05301f399fe0a52573500cafda
MATLAB
983
40
function nk_make(srcdir) % ========================================================================= % function nk_make(srcdir) % ------------------------------------------------------------------------- % Inputs: % srcdir : source directory of files (<nm root>/cfiles) % This function compiles all C fi...
a5c916efe30dd8ed21daf51b6c6355f9db800e483ee867ec2833f6b5c5a478f7
MATLAB
985
30
function C=clustering_coef_wu(W) %CLUSTERING_COEF_WU Clustering coefficient % % C = clustering_coef_wu(W); % % The weighted clustering coefficient is the average "intensity" % (geometric mean) of all triangles associated with each node. % % Input: W, weighted undirected connection matrix % ...
3389b5a0d006de9b7b3fd77f58e11ffe891c95921e3011623d4e1f0ec8a97d46
MATLAB
986
33
function f = cal_mi(I1,I2) % A function with the simplest form to % compute Mutual Information of two images % written by HU Xiubing % Wuhan University,China % huxb@whu.edu.cn size1 = size(I1); size2 = size(I2); if ne(size1,size2) error('Please enter the same size images ! '); end I1 = I1(:); I2 = I2(:); min1 = m...
445473e4458c4b9163c62b4edc65cbb2b15bb1a1fe7a4efc7f5c2c88741fe39f
MATLAB
988
25
function p_map = compute_analytical_pvals(labels, X, w_star) % p_map = compute_analytical_pvals(labels, X, w_star) % Compute analytical multivariate P values using the formulation of Gaonkar % et al. "Interpreting support vector machine models for multivariate group % wise analysis in neuroimaging", Medical Image Analy...
4aa5fe4d46de59fb04a913fd7b934610a80316f16b43286475d0b421f3927d56
MATLAB
989
32
function C=getRelationMatrix(ind) % ind: logical matrix % C: numerical matrix %%%% % Copyright (C) <2012> <Yifeng Li> % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the ...
7b03fe89eb426c9ffc6c00e43ff89714dde88e6d31e563c2ee2c4b5c1dbd388b
MATLAB
990
44
function calcFD_save(fname,fd,subjects,labels,labelfile) % Output the FD values to a txt file % 20151024 CRM % % 20180503 SK: modified to read in the headers from label file if provided, % else labels are numerical % % file identifier fid = fopen(fname,'w') ; % headers fprintf(fid,'%s\t','subID.calcF...
67b690da34af7a6ef5e9507370b91eec7ef5fe8fbbe542129f8aebe056084c4e
MATLAB
993
28
function D = agreement_weighted(CI,Wts) % AGREEMENT_WEIGHTED Weights agreement matrix % % D = AGREEMENT_WEIGHTED(CI,WTS) is identical to AGREEMENT, with the % exception that each partitions contribution is weighted according to % the corresponding scalar value stored in the vector WTS. As an example, % su...
cfbe4873b158d1bf7bd3c9807e6b95b9f671464e50c63fc1c8e61b0d3d4be9b7
MATLAB
994
36
function silhouetteplot(sylinf,n,class) %SILHOUETTEPLOT creates a silhouetteplot for output of the cluster % algorithms pam or fanny. % % I/O: silhouetteplot(sylinf,n) % % This function is part of LIBRA: the Matlab Library for Robust Analysis, % available at: % http://wis.kuleuven.be/stat/robust.html % ...
1cfb26a845dfd346a4dd56396fd32f88487fe7e7f37ab254afded85a21a9389f
MATLAB
997
35
function [rmse, rrmse, pcc] = compute_metrics(x_gt, x_hat) %COMPUTE_METRICS Time-domain metrics between ground truth and reconstruction. % [rmse, rrmse, pcc] = compute_metrics(x_gt, x_hat) % % Inputs: % x_gt : 1 x T or T x 1 ground-truth signal % x_hat : 1 x T or T x 1 reconstructed signal % % Outputs: % rmse...
bb725101a9eafda75b7f160b31121cfcb69ceb59d1946fb7eeb246d0adb7cbc6
MATLAB
997
46
function [model] = ml_binaryclass_brokenStump(X,y,options) % ml_binaryclass_brokenStump(X,y,options) % % Description: % - Finds the best threshold across all features by minimizing the % number of misclassifications % % Options: % - None % % Authors: % - Mark Schmidt (2014) [nTrain,nFeatures] = size(X); ...
5324b7b2297806ec25147f5168ee5a6ef02951985898b5a8ede2ebd16dc63d62
MATLAB
1,000
34
function [flow_mat] = FlowCalculator(X_,C_,beta_,isndm,U_,b_) % This function will calculate the flows between each pair of regions using % the NDM and eNDM frameworks %isndm is a binary flag - where replaced by 1 means the model is for the %standard ndm and if 0 then it means the model is for eNDM nroi = size(C_,1);...
a1a0fd32ab0549ba8ddf56b7376358eddd3c2a082cec8448abfda4cc70573ac7
MATLAB
1,002
29
function [Thresh, Crit, Mx, YnewPred, YPerf, YnewPerf] = nk_DefineThresh(FEATSEL, Y, DScore, labels, Ynew, labelnew, sigma, curclass) Mx = []; YnewPred = []; YPerf=[]; YnewPerf=[]; % Determine threshold switch FEATSEL.salthreshmode case 0 Thresh = []; Crit = []; case 1 % Percentile if numel(FE...
b0b124cc980a187d4fbf1280d0b4b7a5dafcad1b091155b07e448050bb809846
MATLAB
1,002
26
function [Y] = diagonalize(X,samplesize) % ----------------------- Input ------------------------------ % X: samples of all tasks (each row is a sample) % samplesize: the i-th entry is the sample size of the i-th task % ----------------------- Output ----------------------------- % Y: sparse data matrix which is diagon...
bf548106c09842d9f1c2327c6dbeac1a97edbc46fc1554a8c403b6d4151bc4f9
MATLAB
1,002
32
function est = mripy_est_from_PEB(PEB, norm) % Extract estimates from a PEB object. % est.A, est.B, est.C, est.PA, est.PB, est.PC if nargin < 2 norm = false; end n_params = size(PEB.Pnames, 1); for k = 1:n_params if norm eval(['est.', PEB.Pnames{k}, ' = ', num2str(full(PEB....
765b381702218ce8101e6c4adcded89f609eb38bdaae7e0b9c33b5900fc67dd2
MATLAB
1,006
42
function demo() % % demonstration file for NMFLibrary. % % This file illustrates how to use this library. % This demonstrates multiplicative updates (MU) algorithm and % hierarchical alternative least squares (Hierarchical ALS) algorithm. % % This file is part of NMFLibrary. % % Created by H.Kasai on Apr. 05, 2017 ...
0b708b48f83c5b47ae97cdcafc3e765f3935e52fc76a64bd3045ae8c9311dcfa
MATLAB
1,007
45
% write face movie to binary file and then load to do SVDs, projections, % pupil computations function h = processROIs(h) %% tic; % compute mean from a subset of frames h = subsampledMean(h); h.nframes = int64(h.nframes); %% % compute svd of videos ----------------------------- % h = computeSVDmotion(h); %% pupil, ...
3e222a53f7c50768906be3124abb6096e077181427315c773d6f0683bf25c2b7
MATLAB
1,007
29
function j=JSM(K,trainClass) % compute the ratio of within class distance to between class distance % K: kernel matrix % trainClass: column vector, the class labels % j: scalar, the ratio %%%% % Copyright (C) <2012> <Yifeng Li> % % This program is free software: you can redistribute it and/or modify % it under the t...
17748fcca586792e81c237e7b3930d3fe7f6a26b7e65bc2682445ed77c2d599d
MATLAB
1,008
36
function import_coma os_prefix = './psg_data/'; for j = 1:1 import(os_prefix,'coma',j); end for j = 1:1 import(os_prefix,'control_coma',j); end function import(os_prefix,data_set,k) infile = fullfile(os_prefix,data_set,sprintf('%s_%d.mat',data_set,k)); fprintf('Loading: %s\n',infile); fhandle = load(inf...
fdd33082acccdb748d3863236116caa4fe7d1be01bba31e4a6670a9db1fd7c69
MATLAB
1,013
29
function autoenc = roll_out(network) %ROLL_OUT Rolls out an autoencoder % % network = roll_out(network) % % Rolls out a stack of RBMs as an autoencoder that can be finetuned using, % e.g., backpropagation. % % This file is part of the Matlab Toolbox for Dimensionality Reduction. % The toolbox can be obtained from h...
249e80f6fffc5f9693ca1c029b89e867359320ee971c11946389528a3028e929
MATLAB
1,015
33
function initialise(fa) % Initialise file on disk % % This creates a file on disk with the appropriate size by explicitly % writing data to prevent a sparse file. %__________________________________________________________________________ % Copyright (C) 2013-2017 Wellcome Trust Centre for Neuroimaging % % $Id: initia...
7e824159be598bcfff827aabf0ff9c6fabf1a476a273b7f568ef7cc0694c41a3
MATLAB
1,016
34
function [Q, R] = mgs(A) %MGS Performs a modified Gram-Schmidt orthogonalization % % [Q, R] = mgs(A) % % Performs a modified Gram-Schmidt orthogonalization. This is a more stable % way to compute the Gram-Schmidt orthogonalization than Matlab's one. % % % This file is part of the Matlab Toolbox for Dimensionality Re...
7936c5f58d9ea6aafd2dc3e6958e3d07e2987b08245d887cba6badf038e9dce4
MATLAB
1,018
25
function [c,ld] = lagrangian_foopsi_temporal(y,a,thr,G,ld_in) % solves min sum(G*c) % s.t.: G*c >= 0, ||a(j)*c - y(j)|| <= thr(j) T = size(G,1); la = length(a); myfun = @(Ald) lagrangian_temporal_grad(Ald,y,thr); options = optimset('GradObj','On','Display','Off','Algorithm','interior-point','TolX',1e-6); if nar...
927f5ba1a68b4b56c80bcab2a35a6d191eb70576577e6ad8995baf62887232ee
MATLAB
1,019
28
function mappedX = mds(X, no_dims) %MDS Run MDS on the data to get a low-dimensional visualization % % mappedX = mds(X, no_dims) % % Run multidimensional scaling on the dataset X to get a two-dimensional % visualization. The low-dimensional representation is returned in mappedX. % It has dimensionality no_dims (def...
1e97b05fa68ccb5eea73bb963fb4d39187f5b963fb818edfbea55c4c8d95c389
MATLAB
1,025
30
function rho=dispersionCoefficient(C) % Calculate the dispersion Coefficient % This function is called by function "chooseBestk" % C: matrix, the relation matrix % rho, scalar, the score %%%% % Copyright (C) <2012> <Yifeng Li> % % This program is free software: you can redistribute it and/or modify % it under the ter...
d2eed0693660ff1135f206dca9e9feb2a852b9e4430103506ffa14492e9b52de
MATLAB
1,026
25
function param = KAPPA(TP, TN, FP, FN, param) % ========================================================================= % function param = KAPPA(TP, TN, FP, FN) % ========================================================================= % Compute Cohen's Kappa based on contigency matrix % %%%%%%%%%%%%%%%%%%%%%%%%%%%...
d809fde32ab6a3a7e21a5f313c9b2a10973bcd52b5e8bf3bdd1d2282783b8948
MATLAB
1,029
39
function set_meanFR % SET_MEANFR Mean firing rate % SET_MEANFR stores mean firing rate property of all detected units in CellBase % Balázs Hangya, Johanna Petra Szabó, 10.2024 % Lendulet Laboratory of Systems Neuroscience % Institute of Experimental Medicine, Budapest, Hungary % szabo.johanna@koki.hun-ren.h...
33627b725ef4e0628e85de8ee93ba9ff266ec2f5f65b42b488c0d1feac8bd03d
MATLAB
1,034
45
function h = condentropy(vec1,vec2) %========================================================= % %This is a prog in the MutualInfo 0.9 package written by % Hanchuan Peng. % %Disclaimer: The author of program is Hanchuan Peng % at <penghanchuan@yahoo.com> and <phc@cbmv.jhu.edu>. % %The CopyRight is reserved by the...
1c3515ac571bfbf010808397b86f9ae93b0cff1476faa77df54b9880c5595fa1
MATLAB
1,035
38
function [ROIMEANS, act ] = cv_ROImeans_config(ROIMEANS, brainmask, parentstr, defaultsfl) Atlas = []; if ~exist('defaultsfl','var') || isempty(defaultsfl); defaultsfl = false; end if ~defaultsfl if isfield(ROIMEANS,'atlas') && ~isempty(ROIMEANS.atlas) Atlas = ROIMEANS.atlas; end if ~isempty(Atl...
8a66e19911cc68a057aa70bc2cc0d0d9063fb01b144d6c012362401420de9b12
MATLAB
1,036
40
function H = nk_Entropy(P, vec, m, n) % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ % function H = nk_Entropy(P, vec, m, n) % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ % % Compute entropy-based measure of ensemble diversity % % Inputs: % ======= % P = Input matrix % vec = unique values in input matrix % m = # of rows i...
9e58671a7bd6210c548a179fa4721d6ceed24d89d1f0f3d288541870872520c5
MATLAB
1,037
37
function op = prox_l1( q ) %PROX_L1 L1 norm. % OP = PROX_L1( q ) implements the nonsmooth function % OP(X) = norm(q.*X,1). % Q is optional; if omitted, Q=1 is assumed. But if Q is supplied, % then it must be a positive real scalar (or must be same size as X). % Dual: proj_linf.m % Update Feb 2011, ...
2f3d414ae0d1f7fc2a9ed90741b3a089593f1f8de694ec9c703ee4b771b3da80
MATLAB
1,038
39
function CutterOption_AllCrossCorrs(self) % shows crosscorrs of shows % % INPUTS % % OUTPUTS % % NONE % ADR 2013 % % Status: PROMOTED (Release version) % See documentation for copyright (owned by original authors) and warranties (none!). % This code released as part of MClust 3.0. % Version control M3.0. % Extensiv...
87f8c8601767b5cbb5790e5766256fd2eb1fb1748667404892e4a3219f57ef9c
MATLAB
1,039
28
% Bins probability estimates and also returns the empirical probability % estimate within each bin function [pDisc, empProb] = binProbabilities(p, y, gridSize) % Sort probability estimates in increasing order p = reshape(p, [1 numel(p)]); [p, i] = sort(p, 'ascend'); y = y(i); pDisc = round...
360024411a6dfcbef69a79f58596bba0a49df1552abe809c175e6ca440c3bf2c
MATLAB
1,040
30
currdir = fullfile(pwd) cmd.savePath = currdir [PATHSTR,NAME,EXT] = fileparts(cmd.files.viewpoint{1}) cmd.files.viewpoint{1} = fullfile(pwd,[NAME EXT]) [PATHSTR,NAME,EXT] = fileparts(cmd.files.grouping{1}) cmd.files.grouping{1} = fullfile(pwd,[NAME EXT]) [PATHSTR,NAME,EXT] = fileparts(cmd.files.timing{1}) cmd.files....
1aaefcf137f5bf6a1f1e0e2d07c35bd564480e5b73cb39b0e05bf5b063088f42
MATLAB
1,043
33
function sc = datpointsplot(dat,gooddat,lab,color) % DATPOINTSPLOT Dots overlayed on boxplots % DATPOINTSPLOT(dat,gooddat,lab,color) adds randomly scattered dots % corrsponding to each datapoint. Should be plotted over boxplots. % % Input parameters: % DAT MxN matrix, M: nr of datapoints, ...
eea5bba504815f9c06111ff4f48fa794376fe7ab7d97a6f5ca07573ec62bc335
MATLAB
1,043
37
function [tfFull,tf,n]=iszero(a) % if vector a is zero vector then tf=true, if a(i)==0, then tfFull(i)=true, % else =false. % n: number of zero elements %%%% % Copyright (C) <2012> <Yifeng Li> % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public Licen...
8f575d6457ccacf2aa1ca145528c5501fd009764564c7148ee7996130667b7bc
MATLAB
1,044
46
function [varargout] = mbm_plot_map(axisPlot, vertices, faces, dataToPlot, hemis, isCbar) % plot measurement on a surface % %% Inputs: % axisPlot - axis to plot on % % vertices - vector of vertices % % faces - matrix of faces (3 columns) % % dataToPlot - vector of data to plot % % hemis - '...
be0803ca3633d6703ff683398f8ab1b3a5cb55e542c3631c5b01d89b375a710a
MATLAB
1,044
40
% NDMwS % % Evaluate NDMwS predictions [y] at desired time stamps. % % Input: % x0 = Initial Condition % time_stamps = provided in units given by experiment % C = connectivity matrix % beta = diffusivity parameter % alpha0 = cte growth/decay term independe...
41e35be5b1265defd8b5cafb485ffe16e4132eab0c2296ea2aa42a41cc9e3af0
MATLAB
1,045
49
function [AC,xr] = AutoCorr(T, varargin) % MClust.AutoCorr(T) % % % INPUTS % T -- times of data (in seconds) % % OUTPUTS % AC --- tsd of autocorrelation of self % % ADR 2012 % % Status: PROMOTED (Release version) % See documentation for copyright (owned by original authors) and warranties (none!). % This code re...
102128330bb823d58af7d2641d904c6d8e24e4d00210851d687fd764f53bd64c
MATLAB
1,046
30
% CL Septembre 2022, landelle.caroline@gmail.com // caroline.landelle@mcgill.ca % Toolbox required: Matlab, SPM12 %% function Norm=Norm_BMPD(filename_DeformField,filename_func,SPM_Dir) %______________________________________________________________________ %% Initialization %______________________________________...
a4d8279806c96b61563d38e4e9658033640f478e4b85d7bec46b06ddb886e376
MATLAB
1,047
43
function hdr = encode_qform0(M,hdr) % Encode an affine transform into qform %__________________________________________________________________________ % Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging % % $Id: encode_qform0.m 7147 2017-08-03 14:07:01Z spm $ % Convert from first voxel at [1,1,1] to fi...
112e3787bb9b2f64a32018dfd996809ad602d89799dea8f61dbfa303665b92e2
MATLAB
1,049
39
function [n,names] = plx_event_names(filename) % plx_event_names(filename): gets the names of event channels in a .plx file % % [n, names] = plx_event_names(filename) % % INPUT: % filename - if empty string, will use File Open dialog % % OUTPUT: % names - array of event name strings % n - number of channels if n...
d6b867dd309ca5c84df2b1769f5cd2e30c53a639bb6afa3859efa3792245b0a7
MATLAB
1,049
44
function WriteHeader(fp, varargin) % WriteHeader(fp, H1, H2, H3, ...) % % INPUTS % fp = file pointer % H1, H2, H3, ... = lines (strings) to write out as header % % OUTPUTS: none % % Writes NSMA header % % ADR 1998 % version U3.1 % status PROMOTED MCS = MClust.GetSettings(); % v 3.1 now accepts cell arrays a...
9aaf8480c5356b3cc4d33ef4c73ac53651c562c36e68a68b24d982466fa434c2
MATLAB
1,050
40
function varargout = fname(varargin) % file_array's fname property % For getting the value % dat = fname(obj) % % For setting the value % obj = fname(obj,dat) %__________________________________________________________________________ % Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging % % $Id: fname.m 71...
b01690e5b412a99a573a663622c7f7ba8a280734b7f19308fa9c7d2126f4a9b7
MATLAB
1,050
28
function scores = corrcoef_select(X_train, Y_train); % scores = corrcoef_select(X_train, Y_train); % % Implementation of correletion coeficient feature selection, as used in: % % A. Navot, L. Shpigelman, N. Tishby, E. Vaadia. Nearest Neighbor Based Feature Selection for Regression and its % Application to Neural Act...
b107c9c0facb97f6ac7a157dac7c80a29000854aa8837268b59f4f73a123003f
MATLAB
1,051
45
function [T, Thresh] = nk_Threshold(V, thresh) if thresh.type ~= 3 sig = false(size(V,2),1); switch thresh.type case 1 % Percentile method Thresh = percentile(V, thresh.val); case 2 % Absolute threshold Thresh = thresh.val; end ...
0cc31ebf625308eab8c4422539adb2f87aa147f9d9273ca545d9e15596fc1eb7
MATLAB
1,052
23
function [L, targscale, Lmin, Lmax, Lfact, Lpolyfact, Llogar] = nk_LabelTransform(Param, MODEFL, L) targscale = 0; Lmin = min(L); Lmax = max(L); Lfact = 1; Lpolyfact = []; Llogar = []; if isfield(Param,'LABELMOD') && strcmp(MODEFL,'regression') if isfield(Param.LABELMOD,'TARGETSCALE') && Param.LABELMOD.TARGETSCAL...
8cef6fc4d705dcc2edd5aeab707db18be98fb11f42431dcd364e22cb61ddb656
MATLAB
1,052
40
% NDMwS % % Evaluate NDMwS predictions [y] at desired time stamps. % % Input: % x0 = Initial Condition % time_stamps = provided in units given by experiment % C = connectivity matrix % beta = diffusivity parameter % alpha1 = linear growth/clearance term in...
9ee504651dceb65d4fffbb02df4e91749793477769a9378c19e2177831fc7a04
MATLAB
1,055
23
function mess = CheckImageInfoConsistency(Vinfo, Vvox, mess) if ~exist('mess','var'), mess=[]; end % Check translational H = size(unique(Vinfo(:,1:3),'rows'),1); if H>1, mess = GenerateMessageEntry(mess, 'WARNING: Images do not have the same translation parameters.', 2, 'SystemCommands'); end % Check rotation R = s...
8dd6707f90077402b8369ca2d1e34f01e1ecff37c712059c9761fff54115f6d0
MATLAB
1,057
42
function [res] = lmc(x) %LMC calculates the left medcouple, a robust measure of %left tail weight % % The left medcouple is described in: % Brys, G., Hubert, M. and Struyf, A. (2006), % "Robust Measures of Tail Weight", % Computational Statistics and Data Analysis, % 50 (No 3), 733-759. % % For the up-to-...
117d8db47f22de8fbec28a8bac11f056947d8499a50c825cfc78f0030c14f00c
MATLAB
1,058
41
function chiqqplot(y,p,class) %CHIQQPLOT produces a Quantile-Quantile-plot of the vector y % versus the square root of the quantiles of the chi-squared distribution. % % Required input arguments: % y : row or column vector % p : degrees of freedom of the chi-squared distribution % % Optional input arg...
377d10e4b8ccc8783077074ff5632018461637e345b70eff69ff6d9289e0ca3e
MATLAB
1,059
27
function s = spm_existfile(filename) % Check if a file exists on disk - a compiled routine % FORMAT s = spm_existfile(filename) % filename - filename (can also be a relative or full pathname to a file) % s - logical scalar, true if the file exists and false otherwise %____________________________________________...
7856da1e0ab4b62d59be22f1a52fb351453c683c4712ba66847024d12cc8e331
MATLAB
1,061
43
function [res] = rmc(x) %RMC calculates the right medcouple, a robust measure of %right tail weight % % The right medcouple is described in: % Brys, G., Hubert, M. and Struyf, A. (2006), % "Robust Measures of Tail Weight", % Computational Statistics and Data Analysis, % 50 (No 3), 733-759. % % For the up-...
772a23ad84a0016c396c3c302a056e0d798014939d9434c121aa4e5be4642183
MATLAB
1,065
38
function [channelNumber] = plx_resolve_channel(filename, channel) % plx_resolve_channel(filename, channel): returns .plx file spike channel number for the specified channel name % % [channelNumber] = plx_resolve_channel(filename, channel) % % INPUT: % filename - file name % channel - 1-based channel number or chann...
c9ad9f079f4205594bdb48d106eef7577f95ab2ce49a7ebc6d296f34bf8b6b35
MATLAB
1,065
33
function model=logisticRegressTrain(trainSet,trainClass,option) % logistic regression for classification %%%% % Copyright (C) <2012> <Yifeng Li> % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundati...
e8c29a5499285a18b0dbd53c71bc8e029b0687b45165c937f5f9c5490db48907
MATLAB
1,070
34
function [ts] = PL2TsBySource( filename, source, channelInSource, unit ) % PL2TsBySource( filename, source, channelInSource, unit ): read spike timestamps from a .pl2 file % % ts = PL2TsBySource( filename, source, channelInSource, unit ); % ts = PL2TsBySource( filename, 'SPK', 1, 2 ); % ts = PL2TsBySource( filename, 7,...
fa26dc6fedbc3fe8c08270dbfb51af603b669a87de20009f067cf9d05314ceda
MATLAB
1,072
33
function [Y,numIter,tElapsed]=seminmfnnlstest(X,outTrain) % Project test samples into the feature space, this function is called by % function featureExtractionTest. %%%% % Copyright (C) <2012> <Yifeng Li> % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General...
6552b11a15b9d3dd4d63b52084bbb26662aae55380efc61ed25b660162eb34f5
MATLAB
1,074
26
% Given new scores yHat, and a mapping yHatIR -> yIR, calibrates the scores % in yHat function yCal = calibrateScores(yHat, yHatIR, yIR) n = length(yHatIR); [v,i] = sort(yHatIR); yHatIR = yHatIR(i); yIR = yIR(i); yCalIdx = bsearch(yHatIR, yHat); delta = yHat - yHatIR(yCalIdx); %disp('delta:'...
a8efc56eea6a88cd2fd35ba4272bb37a79aa606c85d714bbd2e49a13f76b0ef2
MATLAB
1,075
33
function [Lrand,Crand] = NullModel_L_C(n,m,Nrepeats,FLAG) % NULLMODEL_L_C Monte Carlo estimates of path-length and clustering of an ER random graph % [C,L] = NULLMODEL_L_C(N,M,R,FLAG) for N nodes and M edges, % creates R realisations of an Erdos-Renyi random graph (N,M), and % computes the shortest path-length L and c...
f2f1c8b34c2f21bb78d838f07c3d6dcadf081988be70f8e5054a0bbbf561ab4e
MATLAB
1,079
39
function []=run_spm_glm_stage_1(subject) addpath('~/apps/spm12'); spm('Defaults', 'fMRI'); setenv('SPM_HTML_BROWSER','0'); spm_jobman('initcfg'); spm_get_defaults('cmdline',true); home = getenv('HOME'); data_dir = [home,'/data/multimodal_decoding/fmri/bids/derivatives/betas/', subject, '/un...
a12c621ea9f8379c7f3bff3c685b71274286a99b29f8ee8dce8c424edf5506b1
MATLAB
1,080
25
function welcome %WELCOME Displays DR Toolbox version information % % welcome % % Displays DR Toolbox version information. % This file is part of the Matlab Toolbox for Dimensionality Reduction. % The toolbox can be obtained from http://homepage.tudelft.nl/19j49 % You are free to use, change, or redistribute this co...
ea76fb3528297510a0804c255f4de8519ca860f33e3290ef06b3101685cf015a
MATLAB
1,080
37
function [C, cAUC] = nk_CreatPredFeat(AUC_upper, AUC_lower, L, verbose) cAUC = 0; c1_x0_rng = linspace(0, .25, 5); c1n = numel(c1_x0_rng); c2_x0_rng = linspace(-0.25, 0, 5); c2n = numel(c2_x0_rng); w_st = 0.5; w_end = 1.5; c_w_rng = linspace(w_st, w_end, 5); cwn = numel(c_w_rng); c1_caseN = sum(L==1); c2_caseN = sum(L...
2d9613f08631e0458e124ff0f29f208f14d46c207c64348ec69c5ff7e8002b71
MATLAB
1,081
34
function [coreness,kn] = kcoreness_centrality_bu(CIJ) %KCORENESS_CENTRALITY_BU K-coreness centrality % % [coreness,kn] = kcoreness_centrality_bu(CIJ) % % The k-core is the largest subgraph comprising nodes of degree at least % k. The coreness of a node is k if the node belongs to the k-core but % not to ...
fec1dbff845f4612cfd3c7d6b7916609de874c2472f09651775da1352e385205
MATLAB
1,082
29
function frame = msReadFrame(ms,frameNum,columnCorrect, align, dFF) %UNTITLED Summary of this function goes here % Detailed explanation goes here vidNum = ms.vidNum(frameNum); vidFrameNum = ms.frameNum(frameNum); if ms.vidNum(1)==0 frame = double(ms.vidObj{vidNum+1}.read(vidFrameNum)); ...
8a89acb7375e677549253f1353a7530f7fffcafe8e6372ad66f3f158301f384a
MATLAB
1,083
34
function Pk=EQP(H,C,X,W,lambda) % solve the equality constrained QP % Yifeng Li, Feb. 21, 2012 option.tol=0;%2^(-32); [nV,nP]=size(X); % code=2.^(2*nV-1:-1:0) * W; code=genCode(W); % [codeSorted,csInd]=sort(code); codeUnik=unique(code); numUnik=numel(codeUnik); Pk=zeros(2*nV,nP); for i=1:numUnik indLog=(code==codeU...
e3cdb4b4271545065d5d6c8fdbf5ed47c094fe8ced023b2484a5eb4544be5a5e
MATLAB
1,083
39
function [ranset,seed]=randomset(tot,nel,seed) %RANDOMSET draws randomly a subsample of nel cases out of tot. %(It is called if not all (p+1)-subsets out of n will be considered.) % % Required input arguments: % tot : The total number of observations to consider % nel : The number of observations that the su...
a81cff7a4eaeb6b3ec9ea4863028e127d9bb4a648ee470e3df9306db55bafb5b
MATLAB
1,084
37
% ========================================================================= % FORMAT [mED, ED] = nk_Lobag(E, L) % ========================================================================= % This function performs the bias / variance decomposition of the error % proposed by Valentini & Dietterich (2004, Journal of Mach...
526c5a5f2a5888d6aeb8949245e02552c725a7533384a6f86672ff55e852185e
MATLAB
1,085
31
function M = nk_ConcatSubgroupPredictions % This script assumes that you have run each subgroup model on the training & CV data (the % subgroup) and the independent test data (the rest of the population % stored in NM.OOCV{1}). The analysis should be in NM.analysis{1} % The following statements should concatenate the ...
64776811c0d5384d90fbc83e3bc10ba278e654f9d59608f19dc2a67085060eef
MATLAB
1,088
39
function varargout = scl_inter(varargin) % file_array's scl_inter property % For getting the value % dat = scl_inter(obj) % % For setting the value % obj = scl_inter(obj,dat) %__________________________________________________________________________ % Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging % %...
53c8fd2ed31392d704a7aa5a458c7c7eba33da2be9d6b5bb4f8846a0427e9842
MATLAB
1,090
40
function varargout = scl_slope(varargin) % file_array's scl_slope property % For getting the value % dat = scl_slope(obj) % % For setting the value % obj = scl_slope(obj,dat) %__________________________________________________________________________ % Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging % %...
15feb3b63c9973934469270381132074a7289fa5d0720410258bcc51519b423c
MATLAB
1,091
33
%% FUNCTION LSSMTC % Transform the partition matrix to clustering results % %% LICENSE % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the License, or % (at your op...
1f6d75ba695c3c85de30fb25cabf432c3fd498c48298ea4c9d3428af0bd67e52
MATLAB
1,092
28
function reconX = recon_data_from_autoenc(network, mappedX) %RUN_DATA_THROUGH_AUTOENC Summary of this function goes here % Detailed explanation goes here % This file is part of the Matlab Toolbox for Dimensionality Reduction. % The toolbox can be obtained from http://homepage.tudelft.nl/19j49 % You are free to use, ...
cd421f9cc73c570eb8976e428dd0cc331531056c220d9ce3eb6e589362103fc9
MATLAB
1,094
28
function reconX = recon_data_from_autoenc2(network, mappedX) %RUN_DATA_THROUGH_AUTOENC Summary of this function goes here % Detailed explanation goes here % This file is part of the Matlab Toolbox for Dimensionality Reduction. % The toolbox can be obtained from http://homepage.tudelft.nl/19j49 % You are free to use,...
ed87dec9e24259042b0b872866532f91843952be1d644abde2074435c9986687
MATLAB
1,096
41
function Z=module_degree_zscore(W,Ci,flag) %MODULE_DEGREE_ZSCORE Within-module degree z-score % % Z=module_degree_zscore(W,Ci,flag); % % The within-module degree z-score is a within-module version of degree % centrality. % % Inputs: W, binary/weighted, directed/undirected connection matrix % ...
396b68160bd546744a6c8a9f25e0253becaf33cb97ecb72f46974f43fc3bd25b
MATLAB
1,097
33
function [GEdiff,Ediff] = diffusion_efficiency(adj) % DIFFUSION_EFFICIENCY Global mean and pair-wise diffusion efficiency % % [GEdiff,Ediff] = diffusion_efficiency(adj); % % The diffusion efficiency between nodes i and j is the inverse of the % mean first passage time from i to j, that is the expected number...
3afc6760e7071801f75562dfabc6e09ff0026d60e985de46c65f83e2176ca209
MATLAB
1,098
33
function [event] = PL2EventTsBySource(filename, source, channelInSource) % PL2EventTsBySource(filename, source, channelInSource): read event timestamps from a .pl2 file % % [event] = PL2EventTs(filename, source, channelInSource) % [event] = PL2EventTs(filename, "KBD', 1) % [event] = PL2EventTs(fi...
53a419c099e0f54c84a341f79bedb13c78bf0e45b4230c67ab6b3a282fa84d95
MATLAB
1,099
45
function newvariable = mergemultivariables(variablearray1,variablearray2) %========================================================= % %This is a prog in the MutualInfo 0.9 package written by % Hanchuan Peng. % %Disclaimer: The author of program is Hanchuan Peng % at <penghanchuan@yahoo.com> and <phc@cbmv.jhu.edu...
6cd752d91581da7987fe79a428495eba1d7d858240e196f65b457eab7fc85c97
MATLAB
1,099
34
function set_visibility(handles) if ~handles.NM.analysis{handles.curranal}.status || (sum(handles.MLparams.NumParamCombs) <= handles.nclass && ~isfield(handles,'visdata')) vis = 'off'; else vis = 'on'; end set(handles.pnModelPerf,'Visible',vis); set(handles.selModelMeasures,'Enable',vis); switch handles.mode...
0911b66d9ab1ceca35f7fc739686705be4fb410199d9a427b51e9df4710758d5
MATLAB
1,100
46
function RegulFunc = nk_RegulFunc_config(defaultfl) if ~exist('defaultfl','var') || isempty(defaultfl) defaultfl = false; end if ~defaultfl RegulType = nk_input('Regularization function',0,'m', ... ['none|', ... '1 - values|', ... 'cosinus|', ... 'sinus|', ... '1 -...