sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
41fe66e6af7e92538f3ffdc2b082bf9fad458a7963c41b956363910e8c791094
MATLAB
566
24
% NDM % % Evaluate NDM predictions [y] at desired time stamps. % % Input: % x0 = Initial Condition % time_stamps = provided in units given by experiment % C = connectivity matrix % beta = diffusivity parameter % % Output: % y = NDM predicted vectors (columns) at ...
2774b708a847ef3fc546b6cf4e0568c0913331993940582bcaafdc765b24b1a6
MATLAB
567
23
function BootSamp = nk_BootSamp(labels,nboot,perc) m = length(labels); minl=min(labels); maxl=max(labels); BootSamp = zeros(m,nboot); for i=1:nboot for j=minl:maxl ind = find(labels==j); lind = length(ind); pl = round(lind*perc/100); pind = randsample(ind,pl,false); ...
b90e48612df69fffdd99132e358fdec481f538ffb638d642994595b6c04590ef
MATLAB
569
15
function [X] = normalize(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 ----------------------------- % X: normalized data matrix tasknum = le...
3c31e6bd9d2deaeb208eda14f831b348ada06b4ac8a52fc6e94ab4cf58c44243
MATLAB
570
24
function map = coolhot4(siz) % Create a colormap that goes in this order: % Blue - White - Red % % Usage: % coolhot4(siz) % % siz : Size of the colorbar. To ensure symmetry, % an even number is recommended. % % _____________________________________ % Anderson M. Winkler % Yale University / Institute of Living %...
7c236bc96bf1d4d75287ffcc8757650648801dd9fcc5a06cf9d79ad255948a4d
MATLAB
570
23
% Objective function for NDM % % param(1) = beta % param(2) = x0_value function [f] = fun_test(param,seed_location,pathology,time_stamps,C) %y = param(1)*param(2) - pathology(2,1) + C(1,1) + seed_location(1); % Define Laplacian matrix L rowdegree = (sum(C, 2)).'; L = diag(rowdegree) - C; % Calculate predic...
760e8b44065026f0bfc299c49188f365065f7f31254796b6f0596741956b5d03
MATLAB
571
17
function drgui %DRGUI Runs the graphical user interface of the DR toolbox % % drgui % % Runs the graphical user interface of the dimensionality reduction toolbox. % This file is part of the Matlab Toolbox for Dimensionality Reduction. % The toolbox can be obtained from http://homepage.tudelft.nl/19j49 % You are fre...
a06dc77ba907aafe42bcba7e6f8d04d0509166216d6ceec3eef2ade7c6765a16
MATLAB
574
25
function SNR = CalculateSNR( self, WV ) % SNR = CalculateSNR(self) MCD = MClust.GetData(); mySpikes = self.GetSpikes(); if nargin==1 WV = MCD.LoadNeuralWaveforms(mySpikes, 2); end [~, nCh, ~] = size(WV.data); mWV = MClust.AverageWaveform(WV); [~, maxPeak] = max(abs(mWV)); noiseSpikes = setdiff(1:MCD.nSpikes(), ...
a437f87a8a1b40437d9c120617461929c9b700c2eca49dead2a247e57443f352
MATLAB
574
26
function [L,IsoD, F, m] = CalculateLRatio_and_IsolationDistance( self ) % Calculate LRatio and Isolation Distance for speed % ADR 2013/12 % construct components % 1. FD for each element of ClusterSeparationFeatures MCS = MClust.GetSettings(); [T, F] = MClust.CalculateFeatures(MCS.ClusterSeparationFeatures); nSpike...
7cbfafce1c07478769bfa8aee15d9af1f45617b0afff5f3723a6a696b0a5a03f
MATLAB
575
20
function bw = hsvThreshold(frame,hsvLevels) %HSVTHRESHOLD Summary of this function goes here % Detailed explanation goes here frame = rgb2hsv(frame); h = frame(:,:,1); s = frame(:,:,2); v = frame(:,:,3); hMask = h >= hsvLevels(1) & h <= hsvLevels(2); if (hsvLevels(1)<0) hMask = hMask |...
0233af2212dd57d8fd819458b91ec30af2c4ab4d016bd96896455d862755fcb9
MATLAB
576
40
function [r, p, Td] = spear(x,y) % Find the data length N = length(x); % Get the ranks of x R = crank(x)'; % Get the ranks of y S = crank(y)'; % Calculate the Spearman correlation coefficient r = 1-6*sum((R-S).^2)/N/(N^2-1); % Calculate the t statistic if r == 1 || r == -1 t = r*inf; else t=r.*sqrt((N-...
23ee949221dcdb9e18d2c5d71f1592ae1015adfd0848cef53474123d3d1a1693
MATLAB
576
18
% pnopt_flags % % $Revision: 0.8.0 $ $Date: 2012/12/01 $ % FLAG_OPTIM = 1; FLAG_XTOL = 2; FLAG_FTOL = 3; FLAG_MAXITER = 4; FLAG_MAXFEV = 5; FLAG_MAXFUNEV = 5; FLAG_OTHER = 6; MESSAGE_OPTIM = 'Optimality below optim_tol.'; MESSAGE_XTOL = 'Relative change in x below xtol.'; ME...
5687dd97d0be0e9c248570a514a20c13616cac3f64d1aafa66c1dab4e235faeb
MATLAB
578
24
function map = coolhot6(siz) % Create a colormap that goes in this order: % Cyan - Blue | Red - Yellow % % Usage: % coolhot6(siz) % % siz : Size of the colorbar. To ensure symmetry, % an even number is recommended. % % _____________________________________ % Anderson M. Winkler % Yale University / Institute of ...
a36206d4d7d8b5c7f6e493ab6d40352f96463587838ab5a02d8d4b6186d69f5d
MATLAB
578
24
function map = coolhot5(siz) % Create a colormap that goes in this order: % Cyan - Blue | Red - Yellow % % Usage: % coolhot5(siz) % % siz : Size of the colorbar. To ensure symmetry, % an even number is recommended. % % _____________________________________ % Anderson M. Winkler % Yale University / Institute of ...
8a8118cc7511555f3b29a2c81ccb50e94dd3f568ef3393de7bb5ad04667dba03
MATLAB
579
16
function opt_def = nk_matLearn_FindDefInParam_config(opt_format, opt_name, opt_def, opt_sel, param) switch opt_format case 'yes|no' if strcmp(param.name, opt_name) && ~param.range, opt_def = 2; else, opt_def = 1; end case {'e','s','i'} if strcmp(param.name, opt_name), o...
80a17256cdc032e9edf26b86b8f07f48efa8ec3e44fa9230d68092b4589c7b2d
MATLAB
580
24
function default = mp2rage_get_defaults(defstr) %MP2RAGE_GET_DEFAULTS Get the defaults values associated with an identifier % % Example : reg = mp2rage_get_defaults('rmbg.regularisation') % alldef = mp2rage_get_defaults % % See also mp2rage_defaults % Get all defaults parameters mp = mp2rage_defaults; if...
e38fa89a0b345b47bc42ed49c45c22344f3257086f3b6c05a842b2eff284696b
MATLAB
580
15
function flip = spm_flip_analyze_images % Do Analyze format images need to be left-right flipped? The default % behaviour is to have the indices of the voxels stored as left-handed and % interpret the mm coordinates within a right-handed coordinate system. % % Note: the behaviour used to be set in spm_defaults.m, but t...
9e84bc85af01f91b6d98cfafd4d47cb97740162eb47c9f65419d785df781bf8b
MATLAB
582
25
function ClusterFunc_AddSpikesFromUnaccountedByCvxHull(self) % PreCut Clusters - ClusterFunc_RemoveSpikesByPolygon % % Adds ability to add individual spikes MCC = self.getAssociatedCutter(); MCC.StoreUndo('Add Spikes from Unaccounted by Cvx Hull'); [xg,yg] = DrawPolygonOnAxes(MCC, true); plot(xg,yg,'-', 'color', sel...
bad70a1222b5afaef60cf19b23313910b0a883d05ada753558b38e56a2f9fc1e
MATLAB
583
26
function tso = smooth(tsa, sigma, window) % function tso = smooth(tsa, sigma, window) % % Smooths the the elements of a tsd % to apply to x,y run sd.x = SmoothPath(sd.x); sd.y = SmoothPath(sd.y); % % PARMS % sigma % in seconds % window % in seconds % % builds a gaussian smoothing function (stdev = sigma) of nW (win...
d41901c678e2ea6a4eb143c5e20e0df695a807307d7186566570aea1594f65ac
MATLAB
583
26
function ClusterFunc_AddSpikesFromUnaccountedByPolygon(self) % PreCut Clusters - ClusterFunc_RemoveSpikesByPolygon % % Adds ability to add individual spikes MCC = self.getAssociatedCutter(); MCC.StoreUndo('Add Spikes from unaccounted by Polygon'); [xg,yg] = DrawPolygonOnAxes(MCC, false); plot(xg,yg,'-', 'color', sel...
47118fbadae6ffcf00ec659d4efa5ebc1305400914e7fc7fc3bc8bc3913951a7
MATLAB
584
18
function load_selSubParams(handles) curclass = get(handles.popupmenu1,'Value'); if curclass>numel(handles.ModelParamsDesc), curclass=1; end popupstr = handles.ModelParamsDesc{curclass}'; popupstrgr1{1} = 'All parameters'; cnt=2; for i=1:numel(popupstr) if iscell(handles.ModelParams{curclass}) nuPi = numel(...
a64549fc2cdac0192303283ad450b059aeb3dfe68ee6a560d8bad99428112c4c
MATLAB
584
21
function out = isnan(fa) % Logical array containing true where the elements of file_array are NaN's % FORMAT isnan(fa) % fa - a file_array %__________________________________________________________________________ % Copyright (C) 2005-2018 Wellcome Trust Centre for Neuroimaging % % $Id: isnan.m 7501 2018-11-30 12:16:...
13f93375c6944d168a6938992a08386666f6099d82c9409c833fc6664c46554a
MATLAB
587
22
function ClusterFunc_Convert(self) % f = CopyCluster(self) % ncst 26 Nov 02 % ADR 2008 % MCS = MClust.GetSettings(); [AvailableTypes, AvailableNames] = MCS.FindAvailableClusterTypes(); [Selection, OK] = listdlg(... 'ListString', AvailableNames, ... 'SelectionMode', 'single', ... 'InitialValue', [], ... 'Name', '...
95071e5b64d6f00b717502f6d10f5b29110aa1ffffebde19cf7552254b34c20c
MATLAB
587
29
function [S, Salgo] = GetSalModeStr(FEATSEL) Salgo = 0; switch FEATSEL.salthreshmode case 0 switch FEATSEL.salthreshalgo case 1 S = 'IMRelief'; case 2 S = 'kNN'; case 3 S = 'RVM'; case 4 S = '...
386548ba194012991c7a2d7f590499048210699ca9104cad375e7b91288eeef9
MATLAB
589
21
function ClusterFunc_ShowHistISI(self) % ShowHistISI(self) % % NONE % ADR 2003 % % 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. % Extensively modified by ADR to accomodate ne...
3f2ef8b6a0f70384617cf965b9e109771e0ddae5ccf19b6990328a0f64949023
MATLAB
589
36
clear; clc; addpath('../../utils/'); lambda1 = 1; lambda2 = 1; opts.tol = 10^-4; opts.max_iter = 1000; opts.tFlag = 1; opts.init = 0; sample_size_arr = [500 500 500 500 500]; task_num = length(sample_size_arr); dimension = 200; X = cell(task_num, 1); Y = cell(task_num, 1); W = rand(dimension, task_num); for t = 1...
00bf7a59878a3e9946b681e01f9215fc78cb11a64191c69209b0dedec8642d8b
MATLAB
591
16
% ========================================================================= % FORMAT param = ACCURACY(expected, predicted) % ========================================================================= % Compute classification accuracy % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % (c) Nikol...
68dfe039697abab8b7587b1193ffcbb294024c6ca473dbfb1a857039004ebdba
MATLAB
591
23
function set_my_topo(fig) %SET_MY_TOPO % SET_MY_TOPO(fig) sets properties of topoplot (marker size, line width, contours) % Johanna Petra Szabó, 10.2024 % Lendulet Laboratory of Systems Neuroscience % Institute of Experimental Medicine, Budapest, Hungary % szabo.johanna@koki.hun-ren.hu % Electrode loca...
c0c826a9da836bc97c8981fd5d5620aaff3c1c15d85304e33b0b48cea1264238
MATLAB
592
23
function [filename,folders,namef] = findallmov(folder_name,fm,suffix) filename{1} = []; folders = {}; namef = {}; ik = 1; for k = 1:length(fm) [~,namef0,ext] = fileparts(fm(k).name); ismov = 0; for ie = 1:length(suffix) if strcmp(ext, suffix{ie}) ismov = 1; break; ...
0adf2028e5b10b37bfb76d543a3a61ddc154691f899df4e2a1fdd4a1e02dfa9f
MATLAB
595
17
function sYw = nk_SmoothMaskInActParam(uPREPROC, PV) I = arrayfun( @(j) isfield(uPREPROC.ACTPARAM{j},'RANK'), 1:numel( uPREPROC.ACTPARAM )); sYw=[]; if any(I) Ix = find(I); for qx = 1:numel(Ix) if isfield(uPREPROC.ACTPARAM{Ix(qx)}.RANK,'EXTERN') sYw = nk_PerfSpatFilt( uPREPROC.ACTPARAM{Ix(q...
960a876168523c17b0e8727d97cf91242c34790fda24d1e25ba011b363778eaf
MATLAB
595
24
function [X,Y] = proj_def(X, Y, u, v) % % Perform projection deflation of matrices X and Y using u and v % Please check Monteiro et al. 2016 for details: % doi:10.1016/j.jneumeth.2016.06.011 % % Inputs: X, Y - data matrices in the form: samples x features. % % u, v - weight vectors for X and Y, ...
47face8c6c744f8b978851f61c084b6521ba6f8a13a4e230fe2d33b3a31fcd78
MATLAB
596
25
% draws small ROIs (on right of GUI) and sets their settings function h = drawSmallROI(h) h.plotROIs(h.indROI) = 1; nxS = floor(h.nX{h.whichview} / h.sc); nyS = floor(h.nY{h.whichview} / h.sc); h.ROIfile(h.indROI) = h.whichview; if isempty(h.locROI{h.indROI}) ROI0 = [nxS*.25 nyS*.25 nxS*.5 nyS*.5]; else ROI0 ...
f0cbdf8818adab08a1da6445c5d4a05b63d90666831eddf9f2755697ea0a4bf5
MATLAB
596
26
function tso = smooth(tsa, sigma, window) % function tso = smooth(tsa, sigma, window) % % Smooths the the elements of a tsd % to apply to x,y run sd.x = SmoothPath(sd.x); sd.y = SmoothPath(sd.y); % % PARMS % sigma % in seconds % window % in seconds % % builds a gaussian smoothing function (stdev = sigma) of nW (win...
b64d1510a9d51a1fcac538587bc2dda00845d49181445a3f7474ca4837434e85
MATLAB
597
18
function [op, str, sortdir, optstart, minmaxstr, minmaxfl, op2] = nk_ReturnEvalOperator(GridParam) switch GridParam case {1, 2, 5, 6, 7, 10, 13, 14, 16, 17, 15, 19} op = 'ge'; str='above'; sortdir = 'descend'; minmaxstr = 'max'; minmaxfl = 1; op2 = 'gt'; switch GridParam case 19 ...
f3cd01833c8e866795893ac2cfc35d83b37ae8fefa11a8f7f817e4d169a08805
MATLAB
598
16
function mat2file(a,val,varargin) % Function for writing to file_array objects % FORMAT mat2file(a,val,ind1,ind2,ind3,...) % a - file_array object % val - values to write % indx - indices for dimension x (int32) % % This function is normally called by file_array/subsasgn. %____________________________________...
01a4933d0731f21fc3bddfe13603b802d69302722f686933386ded5292c5ee7f
MATLAB
599
21
function beta = mbm_eigen_decompose(statMap, eig) % Calculates the beta spectrum from the statistical map and the eigenmodes. % %% Inputs: % statMap - vector of the statistical map (1xn). % % eig - matrix (nxm) with m columns of eigenmodes, where each % eigenmode has n elements. % %% Output: % beta ...
1c0ea5696854f1cc972998ce4f6f8eff40eeb661fb2aa7201415048de6bcb73e
MATLAB
599
27
%========================================================= % %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 author. % %Last modification: April...
1a7b544c6e6d3005adbc1d991ebb4ef484de20876cb14160073dcef3413aedb3
MATLAB
601
15
% ========================================================================= % FORMAT param = DOR(expected, predicted) % ========================================================================= % Compute Diagnostic Odds Ratio of classification: % sens/(1-spec)/((1-spec)/sens); % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
9a17e53130fe69aa4362a8ca37b1f60f0ad4366a4dd078733eab0e2fa3e74e77
MATLAB
603
16
function val = file2mat(a,varargin) % Function for reading from file_array objects % FORMAT val = file2mat(a,ind1,ind2,ind3,...) % a - file_array object % indx - indices for dimension x (int64) % val - the read values % % This function is normally called by file_array/subsref. %_______________________________...
2f4ec3d0ff977181434a29a20e877a5cfac34ee8c7264546c9a3738ecb53646b
MATLAB
604
23
function h = mutualinfo(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 ...
e024cf211861da91f4eb5c7a641d0253618721f23f3593977151c6466c13d1d5
MATLAB
604
24
function s1 = resize_scales(s0,dim,args) % Resize scalefactors %__________________________________________________________________________ % Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging % % $Id: resize_scales.m 7147 2017-08-03 14:07:01Z spm $ dim = [dim ones(1,max(numel(args)-numel(dim),0))]; args...
5b9145ee240e35747a02c40798c6f7a559983e849ddd9839a0e14e3902fc2296
MATLAB
607
23
function NumParam = nk_CheckNumParam global SVM NumParam = 0; if iscell(SVM.kernel.kernstr), kerntyp = SVM.kernel.kernstr{1}; else kerntyp = SVM.kernel.kernstr; end switch SVM.prog case {'LIBSVM','SVMLIT','SVMPRF','CUDSVM'} if any(strcmp(kerntyp,{' -t 0',' -t 4',' -t 5', 'lin', 'linear', 'lin_kernel'})...
8b4a50f086d9c6307a7531f7c09fa7fb438b2e8e095064112cd73d02bca8e28a
MATLAB
608
22
function K = WLKernel_setsInput(Y1, Y2, height) % in case of test kernel, Y1 should be Ytest if ~isequal(Y1,Y2) test = 1; Y = vertcat(Y1,Y2); else test = 0; Y = Y1; end gList = []; for i = 1:size(Y,1) graph = array_to_graph(Y(i,:)); gList = [gList, ...
456555e57cc322992c6f409f54bd319674e55f32f1cec09fe3ee0b2f560a0150
MATLAB
610
22
cd(homedir); addpath(genpath(pwd)); load(fullfile(savedir,'W.mat')); Wnull = randmio_dir(W,10); save(fullfile(savedir,'Wnull.mat'),'Wnull'); coor = csvread('Data83018/coor.csv',1,1); D = squareform(pdist(coor,'Euclidean')); % R first then L save(fullfile(savedir,'D.mat'),'D') %% degree sequence, weight-length, w...
8aa5f67d4ed23b88ecab7596ecc63b66a1ebb0858461794f026c36674c54e1a3
MATLAB
611
19
function options = get_nmf_default_options() options.max_epoch = 100; options.f_opt = -Inf; options.tol_optgap = 1.0e-12; options.verbose = 0; options.store_sol = false; options.batch_size = 1; options.permute_on ...
9375a05528c1720dcd6fd18237515f17e71826919b16ae719aa168576b5b22f9
MATLAB
611
19
load('/media/carsen/DATA2/grive/10krecordings/2017-06-25_1_M161025_MP030_eye_proc.mat'); proc2=proc; %% nframes = proc2.nframes; iframes = cumsum([0; nframes]); for k = 1:length(nframes) clear proc; proc.data.face.motionSVD = proc2.motSVD{1}(iframes(k)+1:iframes(k+1), :); proc.data.face.motionMask = proc2.uMotMa...
6dab396d95e09fcf69f6d4631466d219c42de2b3390297e75a72f522817c2065
MATLAB
615
12
function mripy_write_asc(fname, verts, faces) %MRIPY_WRITE_ASC Write FS/SUMA surface (vertices and faces) as *.asc format. % 2017-08-13: Created by qcc n_verts = size(verts, 1); n_faces = size(faces, 1); assert(n_verts == max(reshape(faces(:,1:3),[],1))+1); % Sanity check dlmwrite(fname, ['# Created '...
cfbf38d60c8deb896f34aaaf0793f43ad25b1460f4bba34d4885839ec6c3c103
MATLAB
615
23
function CL = getNMcolors CL = [ rgb('Blue'); ... rgb('Red'); ... rgb('Green'); ... rgb('Yellow'); ... rgb('Magenta'); ... rgb('Cyan'); ... rgb('LightBlue'); ... rgb('Orange'); ... rgb('LightGreen'); ... rgb('Moccasin'); ... rgb('DarkGree...
b533ec1f66d825aa12956b6e2910701731318b3acb76f679618b7958e17f2bf6
MATLAB
616
20
%% find response cell for each event % This code is to identify behavioral event (trial start, approach, decision, outcome) responsive cells % input: sig (calcium data), behEvtTbl (behavior event table), fps: calcium frame rate 10Hz % output: logic matrix for activated, inhibited and non-responsvie cell in each ...
052d57571ce7aa0ead9d252e67b8005a6386fdc54cd7387d8c7b01c35210df6a
MATLAB
617
30
function [S, Salgo] = GetSalModeStrAlgo(FEATSEL) Salgo = 0; switch FEATSEL.salthreshmode case 0 switch FEATSEL.salthreshalgo case 0 S = ''; case 1 S = 'IMRelief'; case 2 S = 'kNN'; case 3 S = ...
1a26f06c309d9637b2a7d13adc82522842aee9f5aadebe10ae5de2cebf3f49ab
MATLAB
617
14
% ========================================================================= % FORMAT param = NRMSD(expected, predicted) % ========================================================================= % Compute Normalized Root of Mean Squared Deviation (NRMSD) of regression % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
1f05a96a5f29d26a6c40bb66fa9041d10a4980099a95f6262361b343ea731ce6
MATLAB
618
28
function R = restrict(tsa, t0, t1) % R = Restrict(tsa, t0, t1) % Returns a new tsa (ts) R so that only D.Data is between % timestamps t0 and t1, where t0 and t1 are in units % % If units are not specified, assumes t has same units as D % t0 and t1 can be arrays % % ADR 2011 % version L6.0 if nargin < 3 error...
7aeccb9495ca5f6d3de6a3aa063ebf059979f1a5f91869096be2cd1fbf80f9d2
MATLAB
618
22
function [varind, varstr] = nk_SelectCovariateIndex(dat, varind, askfl) if ~exist('varind','var') || isempty(varind), varind = 1; end if ~exist('askfl','var') || isempty(askfl), askfl = 1; end nD = size(dat.covars,2); if askfl && nD == 1 varind = 1; else fprintf('\n******************************') fprintf...
a184efe23b183d64e3e6b1809c5fe930c9b36768f36b244cb17719bf51866fe6
MATLAB
618
29
function leftoverV = process_varargin(V) % leftoverV = process_varargin(V) % % INPUTS % V - varargin cell array % % OUTPUTS % leftoverV - varargins not processed % % expects varargin to consist of sequences of 'variable', value % sets variable to value for each pair. % changes the current workspace! %...
ff5ada201cae7256dc3ceb9ac22890c30615f99f412a60c958846f24d98695b4
MATLAB
618
28
function [D, mD] = nk_ComputeMnMdPairWiseDiff(G, func, act) switch func case 'mn' func = @nm_nanmean; case 'md' func = @nm_nanmedian; end [m,n] = size(G); switch act case 'meandiff' D = zeros(m,n); for i=1:n vec = true(1,n); vec(i)=false; D(:,i) = fu...
f4086d6a8565606b80b26df42348aee72c96df6ff0a893009b55e07575ac7f42
MATLAB
620
23
%one-way rm anova stat, using function RMAOV1(X,alpha) load 'N250_both.mat' y = erpval; [n,c2] = size(y); %column numbers for categories tested using one-way anova %col1: UM F / col2: UM Fa / col3: UM UF / col4: M F / col5: M Fa / col6: M UF y_anova = y(:,[3 6]); Y = y_anova(:); % dependent variable S=[1...
8f2f969d69df9337f0befced98eeb53f822be30a6f1aec1f26932ad5c63cd67e
MATLAB
621
22
function param = nk_CostFun_config(param, SVM, MODEFL, defaultsfl) % Defaults if strcmp(SVM.kernel.kernstr,' -s 0') CostFun = 3; else CostFun = 2; end if isfield(param,'CostFun'), CostFun = param.CostFun; end if ~exist('defaultsfl','var'), defaultsfl = 0; end; if ~defaultsfl CostFun= nk_input('Cost ...
d82460dcc28e2a1638eaf871b67039e84a102294d872758c6df8dc0e039bfefc
MATLAB
622
24
function cv = nk_LOOpartition(Labels) % ========================================================================= % function cv = nk_LOOpartition(Labels) % ========================================================================= % (c) Nikolaos Koutsouleris indn = isfinite(Labels); K = numel(Labels(indn)); KN = numel(L...
20f050060116afee82779313525dc4668f05ce488033ef832598b707ee89012e
MATLAB
623
34
% test the main formulation addpath('../MALSAR/c_files/largescale_ops/'); addpath('../MALSAR/functions/pacifier/'); clear; clc; rng(1985) n = 12; k = 40; d = 1000; t_min = 150; t_max = 200; density = 0.001; X0 = cell(n, 1); for i = 1 : n X0{i} = sprand(d, t_min + randi(t_max-t_min, 1), density); end reg_l1 = ...
209013f6dddb9cd1c3fe97e972ea7ff0b0b9abad1bc7e8751d489e804dece591
MATLAB
628
19
function NM = nk_InitNMwindowColors(NM, cl) try if ~isfield(NM.defs,'JTextArea') || isempty(NM.defs.JTextArea) cmdWinDoc = com.mathworks.mde.cmdwin.CmdWinDocument.getInstance; listeners = cmdWinDoc.getDocumentListeners; for i=1:numel(listeners) listener_str = listeners(i).to...
508a6c99a629cddfac576df1fb397178bab5f42ef110e7b38f7b46417478b170
MATLAB
629
20
function msExtractSFPs(ms); %msExtractSFPs Extracts spatial footprints to perform chronic re-alignment % Converts spatial footprints from m,k,n (UCLA) to n,m,k (Ziv's lab) where % n is the number of neurons, k pixels in x axis, and m pixels in y axis % % Author: Guillaume Etter % Contact: etterguillaume@gmail.com for ...
627bb0143857b3e0d37c62d0d95ac88af91e197a3501de13798886663d321cf8
MATLAB
629
25
function map = coolhot2(siz) % Create a colormap that goes in this order: % Cyan - Blue - Black - Red - Yellow % % Usage: % coolhot2(SIZ) % % - SIZ = Size of the colorbar. To ensure symmetry, % an even number is recommended. % % _____________________________________ % Anderson M. Winkler % Yale University / In...
9cbd4a74821a98ec6bab8fe96c01cd91b183cb69d6feedea9ef3bb9702c002e1
MATLAB
630
25
function result = runntimes(K,lk,n) % Copyright 2012 Nino Shervashidze, Karsten Borgwardt % Input: K - m x m kernel matrix % lk - m x 1 array of class labels % n - number of times we want to run svm % Output: result - a structure with fields accuracy, mean, std and % mean, std and se are...
6f0e15e0ae67af48953a3868e80a1a152553ee57e28f6cc24862b484af71b4fa
MATLAB
632
26
function [meanYC, sdYC] = nk_ExtractClusterData(Y,C) % function out = nk_ExtractClusterData(Y,C) % I1: Data matrix with rows = samples, cols = voxels (dimensions) % I2: Vector indicating cluster membership: length(C) == size(Y,2)! % % O1: Output matrix consisting of rows = samples, cols = mean signal of % sample per cl...
961567331176908cd9f4d2c1d5ac19742f4d7d441d3bfcfe7d5e0b70fc46f0eb
MATLAB
632
15
function head_plot(self,fitted_spatial) if ~isa(self.model,'bt.model.template_spatial') error('This plot can only be generated for models that inherit from template_spatial') end if nargin < 2 fitted_spatial = 0; end if fitted_spatial bt_utils.head_imager(self.model.output_x,self.model.outp...
be2b8509d1b947ac92143d9597810b0bd92e9081afa64f84d59e582c47bf0257
MATLAB
632
18
function res = runmultiplesvm(Ks,lk,n) % Copyright 2012 Nino Shervashidze, Karsten Borgwardt % Input: Ks - cell array of h m x m kernel matrices % lk - m x 1 array of class labels % n - number of times we want to run svm % Output: res is a 1 x n+1 array of structures. Each of the first n % elemen...
8a4e97cefa32177744ac079599037de4df7a7ea1ed57c15a8c6d33f54d985d74
MATLAB
633
26
function OK = LoadTetrodeData(self, useFileDialog) if useFileDialog % find basename [fn dn] = uigetfile(self.TText, ... 'Select the spike data file from the desired tetrode.'); if isequal(fn,0) % user hit cancel return end else % use "get" paradigm MCS = MClust.GetSettings()...
7945f1aa140ad1275b860ed61379afbf5bd396800c3c8b7bfa9e3bde6ddf1cfd
MATLAB
634
16
function [X] = normalize(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 ----------------------------- % X: normalized data matrix tasknum = le...
f8c6e991f7dc4dcac87552622f90ae5725139185bf44299570365fa4c443990c
MATLAB
634
25
% Clear workspace and command window clear; clc; % Load the CSV file filename = 'deep_learning_papers.csv'; % Replace with your actual file path if necessary data = readtable(filename); % Extract the categories column categories = data.Category; % Count the occurrences of each category category_counts =...
750f1bf9b7abe027cc5b992094eb3f66c784fed9b2baf23fc08044fbe5f48f35
MATLAB
635
14
% Save important behavioral data from all extracted behavioral data for SST % baseline year. clear; data = load('/oak/stanford/groups/menon/projects/percym/2020_ABCD_SST/data/ABCD_SST_n9556_AUg2021.mat'); for i = 1:length(data.ABCD_SST) extract{i, 1} = data.ABCD_SST{i}.data.ID; extract{i, 2} = data.ABCD_SST{i...
68ebbea9fb5db5cf1158e156286282d5f09996e0b94b5644ea1735da39176977
MATLAB
637
28
function selectedY = featSelectT(X1, X2, y, train) % y = labels if train g1_idx = find(y==-1); g2_idx = find(y==1); selectedY = X1; for i = 1:size(X1,2) g1 = X1(g1_idx,i); g2 = X1(g2_idx,i); [h,p] = ttest2(g1,g2); if h == 0 |...
c67356350ff8f055f6584d3fe40a77647fbde6c3b2839afaeedcfc7b1455e737
MATLAB
637
20
function convert_derived_pp() % This function takes in pp_master as generated by assemble_master_pp % It then converts it into derived_pp for use by db_derived_fit load pp_master % Now go through spectra and assemble for j = 1:size(pp,1) % for each spectrum output(j) = get_spec_analysis(pp_f,pp(j,:)); end %...
dc704c87fa9fec6ea4080030bd7834548d7b61774070169e0a2e404043f8f693
MATLAB
637
16
% ========================================================================= % FORMAT param = TPR(expected, predicted) % ========================================================================= % Compute false posotive rate of classification: % Positive Predictive Value = TP / (TP + FP); % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
73504abbb2e7f94d5342f4ea448d07ce4d97350007f73a84dddc36c97b13bdde
MATLAB
638
19
function do_binary_cross_validation(y, x, param, nr_fold) len = length(y); rand_ind = randperm(len); dec_values = []; labels = []; for i = 1:nr_fold % Cross training : folding test_ind = rand_ind([floor((i-1)*len/nr_fold)+1:floor(i*len/nr_fold)]'); train_ind = [1:len]'; train_ind(test_ind) = []; model = svmtrai...
30c9330d5c41e1ac494e9c2a6caf4a394f136b421ca9ebaa61c10783bafed239
MATLAB
641
24
function ClusterFunc_ShowAutocorr(self) % ClusterFunc_ShowAutocorr(self) % ADR 2012 % % 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 M4.0. % Extensively modified by ADR to accomodat...
cbff755f3cbb199484fcfb969776361ef92fa0ba87cce940b588d9e4303c8072
MATLAB
641
26
function [oECOC, tECOC] = nk_OneVsOne(Dichotomizers, number_classes) nc = size(Dichotomizers,2); mx = number_classes*(number_classes-1)/2; % This is the observed matrix oECOC=zeros([number_classes nc]); % This is the template matrix tECOC=zeros([number_classes mx]); counter=1; % Create multi-group coding matrix (temp...
ca3fd91fe6b9c11b07dd49e120e2bcb1b6f48d3829ffbf19fbf9b2dea2a94db0
MATLAB
642
22
function [ res ] = getMCE( Y, P ) %RMSE Summary of this function goes here % Detailed explanation goes here predictions = P; labels = Y; ordered = sortrows([predictions,labels]); N = size(ordered,1); rest = mod(N,10); for i = 1 : 10 if (i <= rest) group = ordered((i-1) * ce...
ce7d712353103f68f92e573c1dbbca0a761c01dd84a5f09008005e8759477dcc
MATLAB
642
27
function tsout = cat(varargin) % tsout = cat(tsA, tsB, ...) % % concatenates the sequences of tsds % checks to make sure sizes match % raises an error if endtime(tsN) > starttime(tsN+1) nTSD = length(varargin); assert(nTSD>=2, 'Cannot concatenate < 2 tsds.'); assert(isa(varargin{1},'tsd'), 'Initial tsd not a tsd.');...
0df3e81bd25fb3f9e85a5916b33fce89e6207f602b42b7428c998cfbe17c4f50
MATLAB
643
23
function [SVM, CMDSTR, LIBSVMTRAIN, LIBSVMPREDICT] = nk_SetupGlobVarsForLIBSVM(param) global MODEFL SVM.prog = 'LIBSVM'; SVM.LIBSVM = param.LIBSVM; SVM.kernel = param.kernel; SVM.GridParam = param.evalfunc; CMDSTR = nk_DefineCmdStr(SVM, MODEFL); switch SVM.LIBSVM.LIBSVMver case 0 LIBSVMTRAIN = 'svmtrain31...
14fc7f2f554428aadeb3e3542857c826d0b8bbc94d8c6ec1254482a74f651050
MATLAB
646
25
function [param,val]=modSelKM(trainSet,trainClass,option) % model selection % this function is not currently useful if nargin<3 option=[]; end optionDefault.range=[0:30]; optionDefault.epsilon=1e-4; option=mergeOption(option,optionDefault); numTr=size(trainSet,2); numP=numel(optionDefault.range); M=nan(numP,1); fo...
92cd9328feba0b469abd69dedfc81bc6f8fb570c016b77e5296e256346be600e
MATLAB
646
24
function [T,WV] = LoadTT_NeuralynxNT(a,b,c) % MClust Loading engine wrapper % [T,WV] = LoadSE_NeuralynxNT(a,b,c) if nargin == 1 [T,WV] = LoadTT_NeuralynxNT0(a); elseif nargin == 3 [T,WV] = LoadTT_NeuralynxNT0(a,b,c); elseif nargin == 2 % New "get" construction" if strcmp(a, 'get') switch (b) ...
b5aaec967e1781bfb2a35b936c67be2cb7d633e1b4819ad28341ffa07a480248
MATLAB
646
13
function x_new = NextSolution2(x_curr, itt, n, featureID_order) % Unlike NextSolution1, this routine NextSolution2 can pick which new voxel % should or should not be included to the SA by considering the probability % derived from MI-descending rank moduloItt = mod(itt,n); if moduloItt == 0, moduloItt = n; end x_new...
bc6ca594cbf2bea47a269a5a0a07e0cf16a56f31f005e3f8795e691ff1b74c16
MATLAB
648
18
classdef test_io < matlab.unittest.TestCase methods (Test) function test_read_write_mean(self) % randomly generate mean data width = 200; height = 300; channels = 3; mean_data_write = 255 * rand(width, height, channels, 'single'); % write mean data to binary proto mean_pr...
4724e550363a7784760882acf94fbb49084a451c075ae428697fd2424766261a
MATLAB
649
24
function [T,WV] = LoadSE_NeuralynxNT(a,b,c) % MClust Loading engine wrapper % [T,WV] = LoadSE_NeuralynxNT(a,b,c) if nargin == 1 [T,WV] = LoadSE_NeuralynxNT0(a); elseif nargin == 3 [T,WV] = LoadSE_NeuralynxNT0(a,b,c); elseif nargin == 2 % New "get" construction" if strcmp(a, 'get') switch (b) ...
d6eebe1c43b701030ba489acc034d2f030829dc244c7ffc5c2bd9daa256e1ec0
MATLAB
649
25
% 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....
122e9ae0d3dab5227e450eca0bcea8646ab27ad029c7a554013ba8b2fa0c8aef
MATLAB
650
55
function P = Permutationmatrix5 P = zeros(1024,1024); for a = 0:1 for b = 0:1 for c = 0:1 for d = 0:1 for e = 0:1 for f = 0:1 for g = 0:1 for h = 0:1 for i = 0:1 for j = 0:1 am = [0, a, b, c, d; a, 0, e, f, g; b, e, 0, h, i; c, f, h, 0, j; d, g, i, j, 0] ; perm=perms([1 2 ...
92335688956030fa17a4971c2bf16c78bc41d7603cba83c3666975ac8a7f6052
MATLAB
650
37
function [xg,yg] = DrawPolygonOnAxes(self, returnConvexHull) % [x,y] = DrawPolygonOnAxes(self, returnConvexHull) % % INPUTS % returnConvexHull = t/f % % OUTPUTS % x,y pair for use in "inpolygon" % % ADR 2012/12 % MClust 4.0 MCC = self.CC_figHandle; if isempty(MCC) warning('MClust:Cutter', 'No axes to...
27dff22c1ea124576084a519af83e8086840138c1475f8062b589103dba8a6ff
MATLAB
651
23
function [AvailableTypes, AvailableNames] = FindAvailableClusterTypes(self) % MClustSettings % % What Cluster Types are available? % % Returns structure array of names ClusterTypeList = meta.package.fromName('MClust.ClusterTypes').ClassList; AvailableTypes = {}; for iC = 1:length(ClusterTypeList) if eval([Cluste...
2bd25e84148c1b9cca2e0e50f2159fabb49f358a91511853d2ba246e58638875
MATLAB
651
26
% Plot prediction vs data function plot_pred_vs_data(predicted,data,time_stamps) num_plots = size(data,2); % Set min and max points for plot axis D = [predicted,data]; plot_min = min(min(D)); plot_max = max(max(D)); figure % Plot figure for j = 1:num_plots subplot(1,num_plots,j) scatter(pre...
cbb5f5651a073b641f18812830812b1df688b038b5cbe867f11902d5accd0d13
MATLAB
653
24
% Objective function for NDM with Source (NDMwS) % % param(1) = beta % param(2) = x0_value % param(3) = alpha1 = linear growth/clearance term in x function [f] = objfun_NDMwS(param,seed_location,pathology,time_stamps,C) % Define Laplacian matrix L rowdegree = (sum(C, 2)).'; L = diag(rowdegree) - C; % Define...
27f8379110d24be1114eea83300f05015d2d4b7a70489e08d91b8a2d4d3766a5
MATLAB
654
26
function [cdata,state_names,short_mapping] = state_cdata cdata = [ 137 44 145; ... % EO, purple 0 255 145; ... % EC, light green 255 180 0; ... % REM, Orange 255 0 0; ... % N1, Bright red 0 154 255; ... % N2, light blue 12 23 178; ... % N3, dark blue 27 69 30; ... % N2S, dark green...
3749221f0f63b4781d2199431c473b14e7b4a37f373025fac1a2961c4401ff5e
MATLAB
654
17
function [handles, oocvind] = get_oocvind(handles) % Get index to OOCV data oocvind = handles.selCVoocv.Value-1; handles.oocvind = oocvind; % Try to find OOCV data pointer in newly selected analysis. if oocvind && (handles.curranal ~= handles.prevanal && handles.OOCVinfo.Analyses{handles.prevanal}.OOCVdone) desc...
eabba2614514380963fc14f642c3d28762de7727d78af00502e6cc5e32ad276e
MATLAB
656
25
function n = calcFD_dilate(vol,r) % Implementation of the dilation algorithm. % 20151025 CRM if length(size(vol)) < 3 | length(r) < 1 % unable to calculate any box counting fprintf('Failed to count!') n = NaN; return; end for rr = r kernel = ones([rr rr rr]); kernel = kernel/sum(kernel(:)); ...
8897fdb61289d356be54bb4425878e808be3b7483651918995e6d084b9362391
MATLAB
658
32
function restX=removal(X,r,k) %REMOVAL deletes rows(r) or columns(k) from X % Type in zero if you do not want to delete any rows (or columns) % r= rowvector of object numbers you want to remove % k= rowvector of variable numbers you want to remove % %I/O: restX=removal(X,r,k) % %Created by S.Verboven (1999) %Last edi...
4c979300a0037f7449c3a95d0aecd3e795de4ed531fd6c9cf8896734caec43e8
MATLAB
659
31
function testClassPredicted=knnrule(Y,trainClass,k) % knn rule for sparse coding based classification % Y: matrix of size K times n, each column is a the sparse coding % trainClass: n-length vector, the class labels % k: the number of largest coefficients to make decision % Yifeng Li % Feb. 14, 2012 %numTr=numel(trai...
6eca0923591ffb7db435c0d2ae05536d8c290700b14a436f5d83902c12b3a168
MATLAB
660
13
%addpath('/users/jfortin/ComBatHarmonization/Matlab/scripts') addpath('/users/fortinj2/ComBatHarmonization/Matlab/scripts') data = csvread('data/testdata.csv',1); batch = [1 1 1 1 1 2 2 2 2 2]; mod = [1 1 1 1 1 1 1 1 1 1 ;2 1 2 1 2 1 2 1 2 1]'; norm = combat(data,batch,mod); dlmwrite('data/testdata_combat_matlab.csv',...
32aaf05b365433cd4d2270f00acc5054fd5074a870e56df7b1c2a6cdf5829355
MATLAB
661
25
% 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....
06fdd234ae941362c3996aaa4a4fb4b60b125755b0623426cf87873627a1fa8b
MATLAB
664
19
function ClusterFunc_CutOnBestProjection(self) % PreCut Clusters - ClusterFunc_CutOnBestProjection % % Adds ability to cut differences between this cluster and all others by % merging and limiting MCC = self.getAssociatedCutter(); FeatureNames = cellfun(@(x)x.name, MCC.Features, 'UniformOutput', false); [Selection,...
c231e7a047559c5c9de193b913c71e16d0ff206161daa06e22d407766b0578bb
MATLAB
665
23
function ClusterFunc_ShowAverageWaveform(self) % ShowWaveformDensity(self) % ADR 2003 % % 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 M4.0. % Extensively modified by ADR to accomod...
abc647944d288667890cc21dc95f798437b3b7f9063d48c208556700a7ceca65
MATLAB
668
26
function [nch, npoints, freq, d] = ddt(filename) % ddt(filename) Read data from a .ddt file % % [nch, npoints, freq, d] = ddt(filename) % % INPUT: % filename - if empty string, will use File Open dialog % % OUTPUT: % nch - number of channels % npoints - number of data points for each channel % freq - A/D freque...
5ac7e02ba8197641f70b902217ab3c09cea22eac00c6ebe0fb745de9fe81c9a4
MATLAB
673
29
function [n,filters] = plx_chan_filters(filename) % plx_chan_filters(filename): read channel filter settings for each spike channel from a .plx or .pl2 file % % [n,filters] = plx_chan_filters(filename) % % INPUT: % filename - if empty string, will use File Open dialog % % OUTPUT: % filter - array of filter values (...