sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
e91a8fd095f41dbd7502465c2e0b985fb76232083ba1b74b58b72a30ae5ad477
MATLAB
1,100
36
function [channelNumber] = plx_ad_resolve_chennel(filename, channel) % plx_ad_resolve_chennel(filename, channel): returns .plx file raw a/d channel number for the specified channel name % % [channelNumber] = plx_ad_resolve_chennel(filename, channel) % % INPUT: % filename - .plx file name % channel - 0-based channel...
8d7f23d5d7e75136b25af7bd7862c1a0289c0ace36718a4e120d0d3a4b2c7897
MATLAB
1,101
40
function varargout = offset(varargin) % file_array's offset property % For getting the value % dat = offset(obj) % % For setting the value % obj = offset(obj,dat) %__________________________________________________________________________ % Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging % % $Id: offset...
eac56433bdfe6fec618daa17c1afefa9220136f3a18e84ec305c652ec6bfb0ec
MATLAB
1,102
47
function W = pnmfeu(X, r, max_iter, tol) % % compute PNMF based on Euclidean distance % input: % X nonnegative data input (m times n) % r number of PNMF components % max_iter maximum number of iterations (defaut 5000) % tol convergence tolerance (default 1e-5) % output: % W ...
a459f2ed8ce48895c0f2a7c296fc4004c6677a5f1c3c8dbb4e5e3c2485dc5340
MATLAB
1,103
44
function [gm]=geometricMean(v) % geometricMean of vector v % for example % v=[1,2,3,NaN]; % [gm]=geometricMean(v) %%%% % 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 ...
88fc21b15200030b576acda0c8afd31bf3f8eeb433e12504402356b9de4ecc8f
MATLAB
1,104
34
%PERCENTILE: The kth percentile Pk is that value of X, say Xk, which % corresponds to a cumulative frequency of Nk/100. ( cited from % Eric W. Weisstein. "Percentile." From MathWorld--A Wolfram Web % Resource. http://mathworld.wolfram.com/Percentile.html ) % % Usage: Pk = percentile(X, Nk); % % In which, X can ...
4804227e7955de0eb71bd7b32d6a4c63d188d4b7afdec5dce96d7817210e3b38
MATLAB
1,106
39
function [x,obj] = hillclimber2c(DD, x, varargin) %HILLCLIMBER Performs hillclimbing using initial solution % % function [x, obj] = hillclimber(DD, x, varargin) % % % % This file is part of the Matlab Toolbox for Dimensionality Reduction. % The toolbox can be obtained from http://homepage.tudelft.nl/19j49 % You are...
0cfb1389d6d6a43becfdb6ba4419e5c5158786099e049e4d19ddb984ab0520c1
MATLAB
1,108
39
function [ERR, TBL] = export_features(handles, batchmode) warning off curclass = get(handles.popupmenu1,'Value'); filename = sprintf('%s_A%g_Features', handles.params.TrainParam.SAV.matname, handles.curranal); [nlabels, nmodal] = size(handles.visdata_table); if strcmp(handles.modeflag,'regression') ModeStr = 'Rg...
36fcea3177088080f486b26f8a61c4e6cc1be642bc36fddddc2b032ea9e437ab
MATLAB
1,108
40
function CutterOption_CreateClustersFromTFiles(self) % find T files [fn, fd] = uigetfile('*.t', 'T Files to get from', '*.t','MultiSelect', 'on'); if isempty(fn) return; else if ~iscell(fn) fn = {fn}; end self.StoreUndo('CreateClustersFromTFiles'); % get timestamps MCD = MClust.Get...
6238519378558162f76a52dd3d77b44b256924f9f69a1b60d5e41d08a1dc1c88
MATLAB
1,109
40
% fit 2D gaussian to cell with lam pixel weights function params = fitMVGaus(iy, ix, lam0, thres) % normalize pixel weigths lam = lam0; % iteratively fit the Guassian, excluding outliers for k = 1:5 lam = lam / sum(lam); mu = [sum(lam.*iy) sum(lam.*ix)]; xydist = bsxfun(@minus, [iy i...
065779e50e6f3328dbdd5dc7886eb02616f6c426ad7011f10ebc10defe4af2ef
MATLAB
1,112
46
function fn = FindFile(globfn, varargin) % fn = FindFile(globfn, parameters) % % Finds a single file that match a wildcard input globfn. % Based on matlab's dir function. % Can searche all directories under the current directory. % % INPUTS % globfn -- filename to search for (you can use '*', % but...
5a021d1e35ee3434557576505fbbe27a751c0c0079c4efae3d7d1a6c6c56f5d7
MATLAB
1,113
32
% SB2_SIGMOID Generic sigmoid function for SPARSEBAYES computations % % Y = SB2_SIGMOID(X) % % Implements the function f(x) = 1 / (1+exp(-x)) % % % Copyright 2009, Vector Anomaly Ltd % % This file is part of the SPARSEBAYES library for Matlab (V2.0). % % SPARSEBAYES is free software; you can redistribute it and/or m...
784b19305e85de0e8bf63375ddec0c78f1c77626778caeedb7565d0a4abc41bd
MATLAB
1,114
30
function IN = nk_PerfANOVAObjOld(Y, IN) global VERBOSE [~,n] = size(Y); %IN.p = zeros(n,1); %IN.F = zeros(n,1); %IN.R2 = zeros(n,1); if VERBOSE, fprintf('\t running ANOVA on %g variables ',n); end IN.beta = pinv(IN.X)*Y; % here we use a pseudoinverse: % X is rank deficient, i.e. regressors are not independent, since ...
03c6f0ba3ca583a091497993d3757b4a4a0e2b839887c3888f9f00ec5082a4dd
MATLAB
1,116
25
function SVR_NFolds_Sort_Permutation_Sub(Subjects_Data_Path, Subjects_Scores, FoldQuantity, Pre_Method, C_Range, ResultantFolder) % % Sub-function for the SVR_NFolds_Sort_Permutation.m % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Written by Zaixu Cui: zaixucui@gmail.com; % ...
2aa5cc6e637a2f390046e4fd4c15afc06e56b16c3241fcedb3a712f17d28ed60
MATLAB
1,117
33
function [X, W, mu_X] = prewhiten(X) %PREWHITEN Performs prewhitening of a dataset X % % [X, W, mu_X] = prewhiten(X) % % Performs prewhitening of the dataset X. Prewhitening concentrates the main % variance in the data in a relatively small number of dimensions, and % removes all first-order structure from the data....
9b77913073470978c375259ec5f3314e41c4e0497aa29c32d4f3f4d2ace4393d
MATLAB
1,117
27
function runConcatStep6(path) %% Pipeline for the proper concatenation of miniscope data across sessions % Developed by Daniel Almeida Filho July/2020 (SilvaLab - UCLA) % If you have any questions, please send an email to % almeidafilhodg@ucla.edu %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
0292d8156d335807d0ade6bf0136ddd1411fd43c42de886ef7e0f1f4c285fb9a
MATLAB
1,119
38
function op = prox_nnl1( q ) %PROX_NNL1 non-negative L1 norm. % OP = PROX_L1( q ) implements the nonsmooth function % OP(X) = norm(q.*X,1), OP(X)>=0 % 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). % % Update Fe...
7379348c89256afdeeea9384139dcab3dc42a8b4cde4908655c5d4371c3b5554
MATLAB
1,122
35
function [ wY, wYnew, wYoocv ] = nk_WeightData(W, TRd, CVd, OOCVd, SelectFlag, ScaleFlag) wYnew = []; wYoocv = []; if ~exist('ScaleFlag','var'), ScaleFlag = false; end if size(W,2) == 1, W = W'; end switch SelectFlag case 1 ind = W~=0; fprintf(' Selecting %g non-zero voxels ...', sum(ind)) ...
32b91cda49285aafebeea0013531c73d3d6e6871b134c08f5ece4d2913ec5121
MATLAB
1,123
38
function [channelNumber] = plx_event_resolve_channel(filename, channel) % plx_event_resolve_channel(filename, channel): returns .plx file event channel number for the specified channel name % % [channelNumber] = plx_event_resolve_channel(filename, channel) % % INPUT: % filename - if empty string, will use File Open d...
876238c5c9dc9243b2c35e29b43d57771b72cfeb7a6bb50111e62bc5162ad791
MATLAB
1,123
27
function [sY, IN] = nk_PerfDiscretizeObj(Y, IN) % ========================================================================= % FORMAT [dY, IN] = nk_PerfDiscretizeObj(Y, IN) % ========================================================================= % Do one of the following to digitize feature matrix Y % % Either: % Dis...
54f9ec8453a74358a639ddb7667ef333b27fc634e63f1107681a91a9f0b654f5
MATLAB
1,124
40
clear;clc; %This produces 4 .mat files. % 1. Dynamics_Outputs_*: Contains the variables required for analysis in % 'Nonergodicity and Simpson's paradox in neurocognitive dynamics of cognitive control' % 2. SummaryAll_cog_prad_*: Detailed summaries from JAGS output required for analysis in %'Computational Model...
be4cb22808c3ed104b90a40a97a1934d66418c39ee55dc520c59258e75c8ecd1
MATLAB
1,124
37
function params = fitted_params_from_posterior(self,xyz_mode) % feather.fitted_params returns the maximum likelihood fitted parameters % This function returns the parameter value corresponding to the maximum % value of the posterior density. This value reflects the entire distribution % and should be more stable (...
fb972351b8065a141b82e2c62d72648d4ce1e7ee439e0ea61300c7c17c83c2a9
MATLAB
1,126
33
function [S,C,L] = small_world_ness(A,LR,CR,FLAG) % SMALL_WORLD_NESS computes small-world-ness of graph % [S,C,L] = SMALL_WORLD_NESS(A,LR,CR,FLAG) computes small-world-ness score S of % graph described by adjacency matrix A, given mean shortest path % length LR and mean clustering coefficient CR averaged over a random...
4ea0a0afb00a5bc18d31ddc450c78ad7a217490b2eadf22ab40fd6072f298e46
MATLAB
1,127
29
function datacontainer = nk_LoadLinkedData(datacontainer, varind) global VERBOSE if iscell(datacontainer.Y) for i=1:numel(varind) if ischar(datacontainer.Y{varind(i)}) if exist(datacontainer.Y{i},"file") fprintf('\nLoading data file %s into modality #%g', datacontainer.Y{varind...
bb5a7ee2b2439decf63bb48af1f914e5489b7a0f1aaa03257460200bf5371858
MATLAB
1,127
37
%========================================================================== %FORMAT feats = nk_RSS(Y, P, transp) %========================================================================== %Performs random subspace sampling %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %(c) Nikolaos Koutso...
6dbfaed5865ec6a1494f80092c0ab52a5aed3728c070b1eade7041f12ecd1b46
MATLAB
1,128
37
function X = multi_transpose (X) % Multi-task cell array transpose. % %% INPUT % X: {n1 * n2} * t - input matrix % %% OUTPUT % X: {n2 * n1} * t - transpose every matrix in the cells. % %% LICENSE % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Pu...
646c14b9ff3de46dbbd435f759b4cc0257e994e2b98c4865a2d249fb10f64298
MATLAB
1,129
44
function distplot(y,cutoff,class,nid) %DISTPLOT plots the vector y versus the index. % At the height of the cutoff value a red vertical line is plotted. % % Required input arguments: % y : the vector to be plotted % cutoff : a cutoff value % % Optional input arguments: % class : the class of the y-vector ...
dd1f2eb1b5062f0c738ecbcbdaf3cbb88a44aa51859b034e92eb7ce4602bf808
MATLAB
1,130
37
% op_arr = DR_movavg(ip_arr, window, stepping, SR, mov_key) % Input parameters: % ip_arr: m * n array % window: length of window in sec. % stepping: the next window is step sec. after ini. time of this window % SR: sampling rate % mov_key: the column of time point % Output parameters: % op_a...
0f775528672d9515598d810cd7586351af6e7ab6dd922e09db6525be6d780ddc
MATLAB
1,131
47
function wcoh_fig(wc,phL,t,f,coi,varargin) %WCOH_FIG Wavelet coherence map. % WCOH_FIG(wc,phL,t,f,coi) draws wav-coherence map. % % Input parameters: % WC MxN matrix of MSWC values. 1D: frequency, 2D: time % phL MxN matrix of MSWC phase lag values. 1D: frequency, 2D: time % t 1xN time vec...
9dac5b8b814c8ac1cbaccc113a3e4b02e1be085ff31b1a947b44d7661fd24b37
MATLAB
1,131
31
function msPlayVidObj(vidObj,downSamp,columnCorrect, align, dFF, overlay) %MSPLAYVIDOBJ Summary of this function goes here % Detailed explanation goes here hSmall = fspecial('average', 2); for frameNum=1:downSamp:vidObj.numFrames frame = msReadFrame(vidObj,frameNum,columnCorrect,align,dFF); ...
f614545bda35a41e9be764e4f5e739f6db1a318011830233bfb13fea60892609
MATLAB
1,131
28
function mripy_merge_asc(lh, rh, output) %MRIPY_MERGE_ASC Merge FS/SUMA surfaces (left and right hemisphere) in *.asc format. % Note that vertices indexing is zero-based and continuous. % % References % 1. https://github.com/PyMVPA/PyMVPA/blob/master/mvpa2/tests/test_surfing_afni.py % 2. http://www.pymvpa.org/g...
ee976370c0c780f8da41eb80c2571ed4f74d385e4876374659eee4454872c1ff
MATLAB
1,132
52
function X = mask(tsa, t0, t1, masking) % % mTSD = ctsd/Mask(tsd, t0, t1, masking) % % INPUTS: % X = ctsd object % t0 = sets of start times % t1 = sets of end times % masking = 1=NaN times inside trial pairs, 0=NaN times outside trial % pairs (default = 1) % NOTE: must be SAME units as tsd! % %...
cfed2d032e5b5bfccba5e840ee6db29578e20a80438afea1037e09ac85c54266
MATLAB
1,133
28
function [wave] = PL2Waves(filename, channel, unit) % PL2Waves( filename, channel, unit ): read spike timestamps and waveforms from a .pl2 file % returns waveform values in millivolts % % wave = PL2Waves( filename, channel, unit ) % wave = PL2Waves( filename, 'SPK01', 1 ); % wave = PL2Waves( filename, 2,...
dfb409e71442c12ade5b1d154a554c8070445a28b026bb1877aa6ef152dd9760
MATLAB
1,135
51
load faces.mat; X = X / 255; disp 'Press any key to show example faces in the input dataset.'; pause; ShowNMFBasis(X(1:20:2000,:)', 32, 32, 2, true); disp 'Press any key to run the PNMF algorithm based on the Euclidean distance.'; disp ' W = pnmfeu(X'', 16)' pause; W = pnmfeu(X', 16); disp 'Learning is finished....
63f70e01d3af456d6e97d77059edc7a0a85f498f44b21337a57a0397b2faf570
MATLAB
1,136
34
function dir_srand=dir_generate_srand(s1,ntry) % Syntax: % dir_srand=dir_generate_srand(s1) % s1 - the adjacency matrix of a directed network % ntry - (optional) the number of rewiring steps. If none is given ntry=4*(# of edges in the network) % Output: dir_srand - the adjacency matrix of a randomized network with t...
a447c460dcc24d622a8fd3d4b33b31bd03e9149917ca41f5656cc203a391d824
MATLAB
1,136
40
function [wave,f] = eegwavelet2(dat,sr) %EEGWAVELET Wavelet calculation. % [wav,F] = EEGWAVELET(DATA,SR) performs wavelet calculation on % input EEG data (DATA) sampled at SR sampling rate. Complex wavelet coefficients % and scale vector (F) are returned. DATA is first % standardized. A minimal interesti...
3a7a9f9a1ae62c4e68701174b8e2cd60ea5c43f22f69c33b5b77a9e1c5fb8704
MATLAB
1,140
51
function Projection3(self) % Recalculate Projection (self) % Projection plan 3 % % Modified from Jadin Jackson's original code. MCD = MClust.GetData(); nFeatures = length(self.Features); % -------------------------- % Find points in n-dimensions C1 = self.PrimaryCluster; C2 = self.SecondaryCluster; FD = nan(nFeat...
f4f5a96806e0fd1876903c848ab52c6d719ddcbc0b36c8aadd7476bd4ed7e09a
MATLAB
1,141
50
function [str,n_pars] = nk_ConcatParamstr(param, longflg) str = []; if ~exist('longflg','var') || isempty(longflg), longflg = 0; end n_pars = numel(param); if longflg for i=1:n_pars str = conv_param(param(i),str); end else if n_pars > 1 str = sprintf('%g Params: ',n_pars); str = sp...
039730ff6ea373676a4462fc46b27b77df9124e8f4d43b6d3c39adbe2fad3323
MATLAB
1,142
29
% script to test the adjustment to combat %matlab p=10000; n=10; batch = [1 1 1 1 1 2 2 2 2 2]; %Batch variable for the scanner id dat = randn(p,n); %Random data matrix %and let simulate an age and disease variable: age = [82 70 68 66 80 69 72 76 74 80]'; % Continuous variable disease = [1 2 1 2 1 2 1 2 1 2]'; % Cat...
0c88d48209f990fdf0686efa1a9bb2efb37221f744b7ea5022b7d5e19aa2de31
MATLAB
1,143
55
function D = EuDist2(fea_a,fea_b,bSqrt) % Euclidean Distance matrix % D = EuDist(fea_a,fea_b) % fea_a: nSample_a * nFeature % fea_b: nSample_b * nFeature % D: nSample_a * nSample_a % or nSample_a * nSample_b if ~exist('bSqrt','var') bSqrt = 1; end if (~exist('fea_b','var')) | isempty(f...
37550da1ca1a2099e071e893d25482d2e5894f215999bfac8a024edeee880e3a
MATLAB
1,144
30
function [ nexFile ] = nexAddNeuron( nexFile, timestamps, name ) % [nexFile] = nexAddNeuron( nexFile, timestamps, name ) -- adds a neuron % to nexFile data structure % % INPUT: % nexFile - nex file data structure created in nexCreateFileData % timestamps - vector of neuron timestamps in seconds % nam...
226f1d0cff6f19c894db59847e92946e5c0dc9fdaa9f366fa220f86ca5944644
MATLAB
1,145
34
%% add path CNMF_dir = fileparts(which('cnmfe_setup.m')); addpath(fullfile(CNMF_dir, 'ca_source_extraction')); addpath(genpath(fullfile(CNMF_dir, 'ca_source_extraction', 'utilities'))); addpath(genpath(fullfile(CNMF_dir, 'ca_source_extraction', 'endoscope'))); addpath(fullfile(CNMF_dir, 'GUI')); addpath(fullfile(CNMF_d...
be504b98383e11c24aaf42de8d5efcfd7a0f63121a748841ac4dd7c1bb8b7247
MATLAB
1,145
45
function C = nk_CalcSpatConst(Y,Vm) indvol=[]; % Read brainmask into vector format for sl=1:Vm.dim(3) % read mask M = spm_matrix([0 0 sl 0 0 0 1 1 1]); %M1 = Vm.mat\V.mat\M; mask_slice = spm_slice_vol(Vm,M,Vm.dim(1:2),1); ind0 = find(mask_slice > 0.5); ind = ind0 + (sl - 1)*prod(Vm.dim(1:2));...
d116084bf221ec008df2bb9955f0d6a39afa535348c24dff7ac719a09e3ad361
MATLAB
1,145
25
% 20160415 CRM % 20180502 SK: modified to read in label names from a text file % if 'options.labelfile' is 'none', label names default to numerical addpath('../calcFD') sample = 'IXI'; subjectpath = sprintf('~/path/to/data/%s/surf/',sample); subjects = {'.'}; options.alg = 'd...
77137b7887ca045a8394d893bbad81309c4c03100e88514bc792c91835f542c1
MATLAB
1,147
37
function F = setPapertoFigPos(F) % This function change's the paper size of a figure to match % the space the figure takes up on the page. This is mainly % since it allows you to set the 'position' argument to the % desired size and then have the resulting ps/eps/pdfs come out % without a bunch of whitespace. %________...
21c3650c7576adc076f6075f5edf3fffdc4cea4d5ae466180e2abc4282a3ec5e
MATLAB
1,148
34
% ========================================================================= % FORMAT param = BAC2(expected, predicted) % ========================================================================= % Compute Balanced Accuracy of classification % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % (...
55bc225490909c70f2140bbce59c970e31b925e2b7f3337a4679f9a1dd8ed56b
MATLAB
1,150
54
function out = fixTrailing(in,varargin) p = inputParser; p.addRequired('in',@(x) exist(x,'file')); p.addParameter('delimiter','\t'); p.addParameter('out',''); p.parse(in,varargin{:}); inputs = p.Results; % setup output if isempty(inputs.out) [fpath,fname,fext] = fileparts(in); inputs.out = fullfile(fpath,[fname...
0bb9f0402a88fb82973d37f44533647d37ad486ee4c603e8dd8f7a69dee766ce
MATLAB
1,154
30
function [ad] = PL2AdSpan(filename, channel, startCount, endCount) % PL2AdSpan(filename, channel, startCount, endCount): read a span of a/d data from a .pl2 file % returns a/d values in millivolts % % examples: % % ad = PL2AdSpan(filename, channel, startCount, endCount) % ad = PL2AdSpan(filename, 48, 1, ...
591ba159c1f52448863d74f28cad29139e6ba396fa02b4fc2c26c3181c9d9976
MATLAB
1,158
22
% This make.m is for MATLAB and OCTAVE under Windows, Mac, and Unix function make() try % This part is for OCTAVE if(exist('OCTAVE_VERSION', 'builtin')) mex libsvmread.c mex libsvmwrite.c mex -I.. train_liblin244.c linear_model_matlab.c ../linear.cpp ../newton.cpp ../blas/daxpy.c ../blas/ddot.c ../blas/dnrm2.c ...
e37e8c364f980acbaf4ab7f6f5ef8f71de19aa24322df6aeef87ca630bb708a9
MATLAB
1,159
29
% CL Septembre 2022, landelle.caroline@gmail.com // caroline.landelle@mcgill.ca % Toolbox required: Matlab, SPM12 %% function Norm=Norm_dartel(dartel_template,filename_DeformField,i_file,SPM_Dir,resolution) %______________________________________________________________________ %% Initialization %________________...
40c6efa683e81c742ec59d51eefe84488b318e77ae1117a6b8362ccbda2ad5ad
MATLAB
1,161
39
% authors: Ioannis Psorakis psorakis@gmail.com, Theodoros Damoulas theo@dcs.gla.ac.uk % Copyright NCR, 2009 % % Use of this code is subject to the Terms and Conditions of the Research License Agreement, % agreed to when this code was downloaded, and a copy of which is available at % http://www.dcs.gla.ac....
bf2972ab3e70ef15290e172ec118919a190093ac9cdf6e9847757e73f00fc50d
MATLAB
1,161
37
function [sY, IN] = cv_graph_PerfSparsityThres(Y, IN) % ========================================================================= % FORMAT function [sY, IN] = nk_PerfElimZeroObj(Y, IN) % ========================================================================= % Remove features with zero-variance, and ANY Infs and NaNs...
199eda7b719a69a751daf52297ba138913c9657a9942414be48df9a67b032049
MATLAB
1,163
34
% ========================================================================= % FORMAT param = BAC(expected, predicted) % ========================================================================= % Compute Balanced Accuracy of classification % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % (c...
e935b047dd278d9173f8cf43827beb171652a2451d59ac5751e2372f22b8b2c7
MATLAB
1,166
42
function varargout = dim(varargin) % file_array's dimension property % For getting the value % dat = dim(obj) % % For setting the value % obj = dim(obj,dat) %__________________________________________________________________________ % Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging % % $Id: dim.m 7147 2...
3d7c4398fefd23fb7c2a56a1908f8eebcd020fccfb9dc5396a8372c3722c22f9
MATLAB
1,167
44
classdef NRadioSwitch < handle properties buttongroup; % group for set buttonElements; % individual buttons end methods function self = NRadioSwitch(buttonNames, varargin) nButtons = length(buttonNames); self.buttongroup = feval(@uibuttongroup, varargin{:}); set(self.buttongroup, 'Units', 'Normali...
7e1104fce9d989362ec92797dce89b1a0c3e93e26f3c0c7c1325f57a2e7e77d1
MATLAB
1,167
53
function [inputMap] = mbm_read_map(mapList) % Read the gifti or mgh maps from the file paths. % %% Input: % mapList - Cell array of character vectors. % - Each array element contains the path to an input % anatomical map in a gifti or mgh file. % %% Output: % inputMap - Matrix of ro...
85cda1568c9f3d3f1c665e6c69c14d814372750e6b1538850db2e3508a5a7b8f
MATLAB
1,168
27
%% prepare_workspace_example.m % Example template for preparing the workspace before building the benchmark. % % Replace the placeholder loading code below with your own data-loading % pipeline. The benchmark builder expects the following variables in the % MATLAB workspace: % % EEG_all_epochs : [N_eeg x T_src] clean...
bb9a3bb0c3787d9b159428c58de92681608d6e506b6d87cfcaa92241b8dad03e
MATLAB
1,168
37
function path = retrieve_shortest_path(s,t,hops,Pmat) % RETRIEVE_SHORTEST_PATH Retrieval of shortest path % % This function finds the sequence of nodes that comprise the shortest % path between a given source and target node. % % Inputs: % s, % Source node: i.e. node where the shortest path...
ce7afe3b609f7390ff5f10f6b78b1408b883f39dcab134492d8e8345a459bfd6
MATLAB
1,170
33
function IN = nk_PerfANOVAObjNew(Y, IN) global VERBOSE [~,n] = size(Y); %IN.p = zeros(n,1); %IN.F = zeros(n,1); %IN.R2 = zeros(n,1); if VERBOSE, fprintf('\t running ANOVA on %g variables ',n); end notnan = sum(isnan(Y),2)==0; X = IN.X(notnan,:); Y=Y(notnan,:); IN.beta = pinv(X)*Y; % here we use a pseudoinverse: % X ...
ae152230159d8c7e84f02aaf068c395141ff4c05f4d857fcfad4dc7acd2e78df
MATLAB
1,171
43
% authors: Ioannis Psorakis psorakis@gmail.com, Theodoros Damoulas % theo@dcs.gla.ac.uk % Copyright NCR, 2009 % % Use of this code is subject to the Terms and Conditions of the Research License Agreement, % agreed to when this code was downloaded, and a copy of which is available at % http://www.dcs.gla.ac....
b6e9774ee62077d848cf97cfc48f1d5951d1d619b9be5c3838d1e93871c352f3
MATLAB
1,172
34
function testClassPredicted=getLabel(Y) % obtain class labels from Y, called by logistic regression % for example % Y, n by k matrix, it can be posterior probability % testClassPredicted: n by 1 vector, intiger, each element is from {1,2,...,k} %%%% % Copyright (C) <2012> <Yifeng Li> % % This program is free software...
e79d33f02e636f92770fe587a616f4e74a86e760bb9d4a7743b7dc31fca1177e
MATLAB
1,172
43
function result=adm(x) %ADM is a scale estimator given by the Average Distance to the Median. % It is defined as % adm(x) = ave(|x_i - med(x)|) % If x is a matrix, the scale estimate is computed on the columns of x. The % result is then a row vector. If x is a row or a column vector, % the output is a scalar. % % T...
80a999d212b558a4ba25262d03863e61e21f45f790863b597aa13b9f971ba722
MATLAB
1,180
38
function optionFinal=mergeOption(option,optionDefault) % Merge two struct options into one struct % Usage: % optionFinal=mergeOption(option,optionDefault) % option: struct % optionDefault: struct %%%% % Copyright (C) <2012> <Yifeng Li> % % This program is free software: you can redistribute it and/or modify % it unde...
14620dce4341e2cc342ac8e28f181e622c98a99f1244ea65ba8f9be5d60c7e47
MATLAB
1,183
38
%% FUNCTION solve_12_norm % l1,2 norm projection % %% 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 option) any later version. ...
2813329ea4decd6e44998719a9ee4f503f91a4ea3e8924f8cc4f71c32bc5bc9f
MATLAB
1,188
44
function create(obj,wrt) % Create a NIFTI-1 file % FORMAT create(obj) % Write out the header information for the nifti object % % FORMAT create(obj,wrt) % Also write out an empty image volume if wrt==1 %__________________________________________________________________________ % Copyright (C) 2005-2017 Wellcome Trust C...
eb7b0b3b589d06293b689883e3b35aa1068cf141ba9a8385dd5558381bba1b04
MATLAB
1,189
36
function w=SW(K,trainClass) % compute the expected distance of an image from the mass center of a class % K: kernel matrix % trainClass: column vector, the class labels of the samples %%%% % Copyright (C) <2012> <Yifeng Li> % % This program is free software: you can redistribute it and/or modify % it under the terms ...
4fcc6186301232ad52f3eca75ae3630b199a292d36f87c092794ef2eb79b183e
MATLAB
1,190
41
function D = nk_FScoreFeatRankMdIqr(Y, L, N) % Y : Data % L : Target Labelss ix = unique(L); if numel(ix) == 2 indP = L==ix(1); indM = L==ix(2); YP = Y(indP,:); YM = Y(indM,:); % Mean of Positive / Negative Labels mP = nm_nanmedian(YP); mM = nm_nanmedian(YM); % Stan...
558937f872216e01c22af41b8cb9e6944e3e1b70496ee1e3a10ed4f9c8c8f634
MATLAB
1,192
35
<<<<<<< HEAD function names = fieldnames(this) % Fieldnames method for GIfTI objects % FORMAT names = fieldnames(this) % this - GIfTI object % names - field names %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % Guill...
fa386bc6bde379c6b50e886e9956f844d3ebccb354c6b94d9089a64f083ffa11
MATLAB
1,192
38
function [sY, IN] = nk_PerfPLSObj(X, Y, IN) if iscell(Y) && exist('IN','var') && ~isempty(IN) sY = cell(1,numel(Y)); for i=1:numel(Y), % Define active indices depending on training or testing situation if isfield(IN,'TsInd'), IN.indY = IN.TsInd{i}; else IN.indY = []; end sY{i} = Perf...
60d1c39b2ebce2fd35891e346588f267758fbd20d37e1a577c38bc4847fd4524
MATLAB
1,193
48
function W = pnmfkl(X, r, max_iter, tol) % % compute PNMF based on I-divergence (non-nomarlized KL-divergence) % input: % X nonnegative data input (m times n, non-sparse) % r number of PNMF components % max_iter maximum number of iterations (defaut 5000) % tol convergence tolerance (d...
bcbec87dbe17cd438bda86c5e93efeac15349f72f153fdb0b2a0f3535144f97c
MATLAB
1,194
38
function new_Evinxx_parts(curr_resdir,event,newpart_names,newpart_inx) %NEW_EVINXX_PARTS Adds new fields to Evinxx struct. % NEW_EVINXX_PARTS(curr_resdir,event,newpart_names,newpart_inx) saves % indices of new trial sets (NEWPART_INX), intersected with indices of % epochs aligned to EVENT. Trial/ epoch indiced are ...
4970942621972bd929a26a89b6abde78ff8fb0f349283d7849e0dfc87e737884
MATLAB
1,197
38
function a = state_colors(self) % Convert the state string into a colour state_str = self.state_str; [~,state_names,short_mapping] = bt_utils.state_cdata; if ~iscell(state_str) state_str = {state_str}; % Wrap one inside the cell end a = ones(length(state_str),1); for j = 1:l...
942217bd53fb0da703911b496ab9ef5dbf25d7412aecb2a98245f3964061485c
MATLAB
1,198
43
function RedrawAxes(self, ~, ~) MCS = MClust.GetSettings(); % Something has changed in the control window, redraw as necessary... if self.get_redrawStatus() % window for display if isempty(self.CC_displayWindow) || ~ishandle(self.CC_displayWindow) % create new drawing figure self.CC_dis...
319adf9e6ff78746f69669802c82558e1b1861af8694c221ca01268603842935
MATLAB
1,200
39
function [Pred, Pro] = ... IMRelief_Sigmoid_FastImple_Predict2(train_patterns, train_targets, test_patterns, Weight, distance, sigma) index_1 = find(train_targets==-1);N(1) = length(index_1); index_2 = find(train_targets==+1);N(2) = length(index_2); patterns_1 = train_patterns(:,index_1); patterns_2 = train_patter...
413fd1d178267466eb1850c7a3731045f3ca30636a2a7574c308abbcb10a299b
MATLAB
1,200
44
function n = calcFD_boxcount(vol,r) % Implementation of the 3D box-counting algorithm. % 20151025 CRM if length(size(vol)) < 3 | length(r) < 1 % unable to calculate any box counting disp('Failed to count!') n = NaN; return; end dim = size(vol); for rr = r step = rr; dim_r = dim / step; %...
717a69defcf5250cceac4c231a7cea413e7d89d68c04db08b0444415140c7c7b
MATLAB
1,201
48
function demo_face() % % 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, 20...
06b3f17bf8259dc65cc0890919cbfa3841a54d6b45fcaa46617caeb807384d6b
MATLAB
1,202
43
function hnew = outlinebounds(hl, hp) %OUTLINEBOUNDS Outline the patch of a boundedline % % hnew = outlinebounds(hl, hp) % % This function adds an outline to the patch objects created by % boundedline, matching the color of the central line associated with each % patch. % % Input variables: % % hl: handles to lin...
eed7eca36da046b860c3bdbfe18dcc61db55fff247c2e4e3fb3a564013981f7d
MATLAB
1,204
39
function plot_pred_vs_data_singleplot(predicted,data,time_stamps,datasetname) num_tpts = length(time_stamps); notnaninds = ~isnan(data(:,1)); data = data(notnaninds,:); predicted = predicted(notnaninds,:); data_vec = data(:); predicted_vec = predicted(:); D = [predicted_vec,data_vec]; % plot_min = min(min(D)); % plot...
88d90ad3a3058f2d88e77ede6343657a87073cd8f4b27c057d96fa1a82f2c593
MATLAB
1,205
48
function handles = load_analysis(handles, varargin) % Loop through input params nVarIn = length(varargin); for i = 1:nVarIn if strcmpi(varargin{i}, 'Subjects') handles.subjects = varargin{i+1}; elseif strcmpi(varargin{i}, 'Params') handles.params = varargin{i+1}; ...
68ccf5bfae5e6b872278b82b707ebfb9e320d4534daf2216ac3a738be14529f1
MATLAB
1,206
40
function [n_samples, n_subjects, groupnames, labelflag] = nk_DefineGroups(oocv, modeflag, n_subjects, groupnames) switch modeflag case 'classification' if (~exist('groupnames','var') || isempty(groupnames)) n_samples = nk_input('# of groups?',0,'e'); else n_samples = numel(...
9457315ae2d029491bb96b57daed686e3b2e43df69d5b9c0b68fa3509d6ac8e9
MATLAB
1,207
37
function net = get_net(varargin) % net = get_net(model_file, phase_name) or % net = get_net(model_file, weights_file, phase_name) % Construct a net from model_file, and load weights from weights_file % phase_name can only be 'train' or 'test' CHECK(nargin == 2 || nargin == 3, ['usage: ' ... 'net = get_net(model_...
f52451cdea416f9a9b49b5f47426e94c3f37478a171b02f7a708aefc176827f7
MATLAB
1,208
47
function [d,ix] = data(tsa, tlist, varargin) % % [d,ix] = data(tsa) % returns tsa.t % % d = data(tsa, tlist) % returns the nearest elements to tlist in tsa % % d = data(tsa, tlist, parms) % allows control of parameters through process_varargin % % extrapolate = nan; %% if 0 then only include tlist values such that % ...
1c524508829064ec40b4fae37d9f64471c405ed5e263f50dc23ab55f9b47cf4d
MATLAB
1,215
46
function R = ComputeMeanSDPerf(NM, EXT, modind, PERFCRIT) R.PERFs=[]; cnt=1; if ~isempty(EXT) L = EXT.L; P = EXT.P; ind = EXT.ind; nInd = numel(unique(ind)); else L = NM.label; L(L==2)=-1; ind = NM.TrainParam.RAND.CV2LCO.ind; nInd = numel(unique(ind)); P = NM.analysis{modind}.GDdims{1}....
b7c419d8140168c6a23f74f16caf677ec8e5b76986c171160f253f0a0e446f0b
MATLAB
1,216
42
function [G, Gnames] = nk_DefineCovars_config(n_subjects_all, covars) if exist('covars','var') && ~isempty(covars) ncov = size(covars,2); else ncov = Inf; end G = nk_input('Covariates',0,'r',[],[n_subjects_all ncov]); if nargout == 2 Gnames = cell(size(G,2),1); descflag = nk_input('Define covariate ...
cd8c24155cfac035c126db335e94dfcce5dbcf951a050530affaeb2168cb2f3f
MATLAB
1,216
29
function outputMatrix = assessCounterbalancing(conditionOrder) % result = assessCounterbalancing(conditionOrder) % % This function accepts an ordered array of integers with each unique integer % representing a different experimental condition. It assesses whether the % sequence of conditions is counterbalanced for ser...
170740938a24b0deb5b407963a010717cc6c1e66e5cf090f37a532a0a3016bee
MATLAB
1,218
40
function fname = mp2rage_generate_output_fname( job, suffix ) if nargin < 2 suffix = ''; end field = ['output' suffix]; % put upstair the sub-fields if isfield(job,'method') fieldname = fieldnames(job.method); fields = fieldnames(job.method.(fieldname{1})); for f = 1 : length(fields) job.(fie...
a0663922b4ebf061fa53fabdcfe19e9149ddb919c5e370eba9551869069df1d7
MATLAB
1,219
58
function C = ssa_decompose(y, L) %SSA_DECOMPOSE Simple 1D Singular Spectrum Analysis decomposition. % C = ssa_decompose(y, L) % % Inputs: % y : 1 x T or T x 1 signal % L : SSA window length, with 1 < L < T % % Output: % C : R x T component matrix, where R = min(L, T-L+1) % % Each row of C is a rank-1 reconstru...
33df5126a81d4932c35e272543da3c89480eb284c3963814a551185e8d2e411e
MATLAB
1,222
45
% eNDM % % Evaluate NDM predictions [y] at desired time stamps. % % Input: % x0 = Initial Condition % time_stamps = provided in units given by experiment % C = connectivity matrix % beta1 = diffusivity parameter % alpha1 = linear growth/clearance term in x ...
08b23f24f57938d44d5abf38a902a2f9afd8c8eada0bdda0874cfea0690e8248
MATLAB
1,223
50
function [d] = data(tsa, tlist, varargin) % % d = data(tsa) % returns tsa.D % % d = data(tsa, tlist) % returns the nearest elements to tlist in tsa % % d = data(tsa, tlist, parms) % allows control of parameters through extract_varargin % % extrapolate = nan; %% if 0 then only include tlist values such that % ...
955daa6be7fe409e46747d471135840eba5e1cc4aa4586d06275b2c88ffdded3
MATLAB
1,223
37
function X0 = mripy_create_hpf_X0(n, RT, constant) % Create sine wave regressors for high-pass filtering. % % See also: spm_filter, spm_dctmtx % 2021-02-19: Created by qcc global defaults if nargin < 3 constant = 'none'; end HParam = defaults.stats.fmri.hpf; % 128 s k = fix(2*(n*RT)/HParam ...
733a3e77e64364af792884aedc510e70a647866a7e9da3059c6be56186d7692d
MATLAB
1,224
33
load('N250_both.mat') [n,c2] = size(erpval); varNames = cell(3*2,1); for i = 1 : 3*2 v = strcat('V',num2str(i)); varNames{i,1} = v; end % Create a table storing the respones tbiases = array2table(erpval, 'VariableNames',varNames); % Create a table reflecting the within subject factors Fam = cell(3*2,1);...
1d6dac2107c70995c03b0da695c13cde7503ede9f89f87d0f802b547457040e4
MATLAB
1,225
44
function [NM, Y, oocvind, fldnam, dattype] = nk_SelectOOCVdata(NM, oocvflag, selflag, multiflag) oocvind = []; fldnam = []; dattype = []; if ~exist('selflag','var') || isempty(selflag), selflag = 0; end if ~exist('multiflag','var') || isempty(multiflag), multiflag = 0; end if ~isfield(NM,'C') && ~isfield(NM,'OOCV') &&...
6012ffb0b8b96f750de92cfc22d2bdfc99ed93c6f62e90802a9ca2a5617d9be7
MATLAB
1,226
33
function [local_cc, global_cc] = clustering_coefficient(A) % A is the adjacency matrix of the graph % Number of nodes in the graph n = size(A, 1); % Initialize array for local clustering coefficients local_cc = zeros(1, n); % Calculate local clustering coefficients for i = 1:n...
977f024aa4a736e6a7ccff031b4f34b0a7a8914a5cb3a3d261895277fba12dce
MATLAB
1,227
37
function v = eigenvector_centrality_und(CIJ) %EIGENVECTOR_CENTRALITY_UND Spectral measure of centrality % % v = eigenvector_centrality_und(CIJ) % % Eigenector centrality is a self-referential measure of centrality: % nodes have high eigenvector centrality if they connect to other nodes % that have high e...
5d6368b3b856990edf04de65eaa1ebf97c2bfab778f5dbb9414d5c6d03832825
MATLAB
1,232
38
function h = stacked_bar_perc(y,barcolors,textcolor) %STACKED_BAR_PERC Stacked bar plots with percentage % STACKED_BAR_PERC(y,barcolors,textcolor) draws 2 groups of stacked bar plots using % data in Y. Percentage of stacked bars of the stacked bar groups are % displayed, aligned to the middle of each stack...
52abb3d9ea24a520e4b4895fb1819c9147f09c4324fc2de12825b2fecc8698e4
MATLAB
1,233
32
function load_selPager(handles, perpage) if ~exist('perpage','var') || isempty(perpage), perpage = 50; end if strcmp(handles.popupmenu1.String{handles.popupmenu1.Value},'Multi-group classifier') multiflag = true; else multiflag = false; end if handles.curmodal<= size(handles.visdata,1) && handles.visdata{hand...
86f7ddf4210780f547e56d8f2544b28850b7a602d8a4c562df9311a637f668e6
MATLAB
1,233
40
function NM_out = train_model(NM, analind, ovrwrtfl, CV2x1, CV2x2, CV2y1, CV2y2, preprocmaster) % %%%%%%%%%%%%%%%%%%%%%%%%% INITIALIZE NeuroMiner %%%%%%%%%%%%%%%%%%%%%%%%% if ischar(preprocmaster) && exist(preprocmaster,'file') preprocmat = load(preprocmaster); lfl = 2; preprocmat = preprocmat.featmat; else ...
4191ea81f63a77afec4a7f6e2c7e13179fde949dafadb53f39a2859204624b76
MATLAB
1,237
49
function h = condmutualinfo(vec1,vec2,condvec) %========================================================= % %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 rese...
2600e5e3e42d420ebeeb5ffecb18a71571dfa4c4a0568b4aa268bb66727f65f7
MATLAB
1,239
45
function FindBestAxes(self) % Finds the best pair of axes using L-ratio for one cell against the rest % of the spikes or for two cells if two foci axisSetX = get(self.xAxisLB, 'string'); nX = length(axisSetX); axisSetY = get(self.yAxisLB, 'string'); nY = length(axisSetY); bestLR = inf; bestX = nan; bestY = nan; for...
764354d3c8363c4a2ba08358679266ac987bc1d47cbcd2ae8be65e0c2d8adf53
MATLAB
1,245
48
function [] = plx_spike_info(filename) % plx_spike_info(filename): prints .plx file spike channel info % % plx_spike_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 [ filenam...
78dda89ba1f927d50c038d3bc7d394e2a0d11e8e80fd851dcc9146f53c716700
MATLAB
1,245
38
function [P, Ppos, nP, Pdesc] = nk_GetModelParams2(analysis, multiflag, CV2ind, curclass, curlabel ) global MULTI Pdesc = analysis.Model.ParamDesc{curclass}; if ~exist('curclass','var') || isempty(curclass) nclass = analysis.SVM.nclass; P = cell(nclass,1); Ppos = cell(nclass,1); nP = zeros(nclass,1); ...