sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
6bae2d1dddf28079e42ee127acd853f5c58292847661475e9466cbb4eb0677a3
MATLAB
1,619
48
% std_reset() - Remove all preloaded measures from STUDY % % Usage: % >> STUDY = std_reset(STUDY); % % Inputs: % STUDY - EEGLAB STUDY structure % % Outputs: % STUDY - EEGLAB STUDY structure % % Author: Arnaud Delorme, CERCO/CNRS & SCCN, INC, UCSD, 2009- % Copyright (C) Arnaud Delorme, arno@sccn.ucsd.edu % % This...
818a379db6660ec2d10c20c377802cc6a48501f0fd598e4659143a68cded4532
MATLAB
1,620
48
% Quadratic discrimination (separating ellipsoid) % Section 8.6.2, Boyd & Vandenberghe "Convex Optimization" % Original by Lieven Vandenberghe % Adapted for CVX by Joelle Skaf - 10/16/05 % (a figure is generated) % % The goal is to find an ellipsoid that contains all the points % x_1,...,x_N but none of the points y_1,...
4ec5de09277f3309993b43c1c2992ea744b7e6c2008961f0f1f2c4ac69b2e6ef
MATLAB
1,623
51
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% angular resolution dt=pi/40; t=0:dt:2*pi-dt; %% parameters of a side-cut fiber h=100; r1=20; r2=25; a=-1; b=0; c=1; d=-h; %% key nodes of a side-cut fiber n...
b7caded6db67e102a7006e138a67014643bef62d51cfaace7f7ab6fd168e10ba
MATLAB
1,623
46
function [cp,selectFeature,featureWeight,featureCOH] = innerCOHBinclass(CFCdata,trialtag,fold,featureNumber) CFCdata = CFCdata'; cp = classperf(trialtag); crossInd = crossvalind('Kfold',trialtag,fold); selectFeature = []; featureWeight = []; featureCOH = []; for r = 1:10 testGroup = (crossInd == r); trainGroup...
20bd13ae1059503146b409e93cb6b4129c2616e24a94437426a80be3146ecea9
MATLAB
1,625
43
function fileList = searchFilesRecursive(baseDir, pattern, maxDepth, currentDepth) % searchFilesRecursive Searches subdirectories for files matching a regexp pattern up to a certain depth % fileList = searchFilesRecursive(baseDir, pattern, maxDepth) searches % baseDir and its subdirectories up to maxDepth levels fo...
2a8c9e5aa58a2e2eedf51967563617cd0a05e594ef37a3ce67b2c9ea3a2c769a
MATLAB
1,625
51
function [ params ] = config() % [ params ] = config() % % ---------------------------------------------------------------------- % Matlab tools for "Predicting human gaze beyond pixels," Journal of Vision, 2014 % Juan Xu, Ming Jiang, Shuo Wang, Mohan Kankanhalli, Qi Zhao % % Copyright (c) 2014 NUS VIP - Visual Informa...
cade25c0b7a43bec2c6e380e17d3caf3100549260535d62c5c94d57bebdde00f
MATLAB
1,625
64
function [Ygreen, Yred] = makeStacks3(folder, pctUpdate) if(nargin<2) pctUpdate = []; flag = false; else flag = true; end files = jdir(folder,'ChanA_*.tif'); if(~isempty(files)) r = imread(fullfile(folder,files(1).name)); else ...
a7a80d1ceb4855113e80227a2425a68f71720a7954c45f541d83d54ffdc951e8
MATLAB
1,626
61
%isiscalar - Test if parameter is a scalar (integer) satisfying an optional list of tests. % % USAGE % % test = isiscalar(x,test1,test2,...) % % x parameter to test % test1... optional list of additional tests % % EXAMPLES % % % Test if x is a scalar (double) % isiscalar(x) % % % ...
f2c02be90d6a2bf8c1d9a05f22c2227b941a6f0fd034cdc844d9ac7473465ae4
MATLAB
1,626
87
function alpha = circ_vmrnd(theta, kappa, n) % alpha = circ_vmrnd(theta, kappa, n) % Simulates n random angles from a von Mises distribution, with preferred % direction thetahat and concentration parameter kappa. % % Input: % [theta preferred direction, default is 0] % [kappa width, default is 1] ...
b0eebd82be3ad2709ad01273403dd7b16c0821d4025c4b0e10babf0cb431b56d
MATLAB
1,627
39
function CBIG_ArealMSHBM_example_single_subject(out_dir) % CBIG_ArealMSHBM_example_single_subject(out_dir) % % This function will call a simplified wrapper to run a single subject parcellation using gMSHBM. This example use % HCP trained group priors in fsaverage6 space. % Results of the parcellation will be saved in...
43141c45834861d5d0e498f5dea7b8349fa8df8596aff6718600be63378bea95
MATLAB
1,628
41
function SANDIinput = AnalyseAllDatasets(SANDIinput) StudyMainFolder = fullfile(SANDIinput.StudyMainFolder,'derivatives','SANDI_analysis'); PreprocMainFolder = fullfile(SANDIinput.StudyMainFolder,'derivatives','preprocessed'); SubList = dir(fullfile(StudyMainFolder,'sub-*')); SANDIinput.DatasetList = SubList; for su...
8662d87fcb03325ad46b082d138569cc3bb3de6bd9cb2e69835f8173a1f1ee53
MATLAB
1,628
42
function [nCoords, nDim, nVTMode, c] = plx_vt_interpret(ts, sv); % plx_vt_interpret - interpret CinePlex video tracking data % % [nCoords, nDim, nVTMode, c] = plx_vt_interpret(ts, sv); % % INPUT: % ts - array of timestamps (in seconds) (see plx_event_ts.m) % sv - array of strobed event values (see plx_event_...
aec870ca6771f3bf294ab46bc6a2d9b6b0799fb22d9e101fbc7486da3e23434a
MATLAB
1,628
55
function [peaktimes,winints,peakmags] = FindPeakInWin( data,timestamps,peakthresh,winthresh,minwindur,minseparation ) %[peaktimes,winints,peakmags] = FindPeakInWin(data,timestamps,peakthresh,winthresh,minwindur,minseparation ) % % %DLevenstein 2017 %% DEV % data = -normGAMMA; % timestamps = gammaLFP.timestamps; % peakt...
e0bfbacbfaa77ade96c07ef99d7c447495acf54e67f3edad8a9e2a9da70b7e8b
MATLAB
1,628
55
function cvx_optval = det_inv( X, p ) %DET_INV determinant of the inverse of an SPD matrix. % For a square matrix X, DET_INV(X) returns 1.0./DET(X) if X is symmetric % (real) or Hermitian (complex) and positive defininte, and +Inf otherwise. % % This function can be used in many convex optimization problems that...
eb7349c9af7761cfeb5f841f53e4afde57da8f8b33ac8105b5d8d9dd4540b285
MATLAB
1,628
61
% Example 8.3: Bounding correlation coefficients % Boyd & Vandenberghe "Convex Optimization" % Joelle Skaf - 10/09/05 % % Let C be a correlation matrix. Given lower and upper bounds on % some of the angles (or correlation coeff.), find the maximum and minimum % possible values of rho_14 by solving 2 SDP's % m...
f46362420452eb132891b146961d2e278aa9edf324a8cb38150559c91554ef9c
MATLAB
1,628
61
%isiscalar - Test if parameter is a scalar (integer) satisfying an optional list of tests. % % USAGE % % test = isiscalar(x,test1,test2,...) % % x parameter to test % test1... optional list of additional tests % % EXAMPLES % % % Test if x is a scalar (double) % isiscalar(x) % % % ...
55cf9caabc22072d5cd7ffb3f095acbf7bca4f6f7657bb34cac050c63e1f2d61
MATLAB
1,630
71
function [mp rho_p mu_p] = circ_moment(alpha, w, p, cent, dim) % [mp cbar sbar] = circ_moment(alpha, w, p, cent, dim) % Calculates the complex p-th centred or non-centred moment % of the angular data in angle. % % Input: % alpha sample of angles % [w weightings in case of binned angle data] ...
c990292820a74c430505660e5c2fc643a66a03ec580af70f17db52c39affa36a
MATLAB
1,630
67
function plotPairwiseZReject(out, groupNames) % plotPairwiseZReject Visualize pairwise rejection matrix as an image % % Inputs % out : struct from pairwiseTwoPropZ (expects fields .reject and .alpha) % groupNames : 1xG cellstr/string array for tick labels (optional) % ax : (optional) target axis h...
f3da389d1a6c200aee48de115677560baca564930f3367b52e0a6e2cecba9c4c
MATLAB
1,630
58
%% Prepare data harmonisation % % %% Configuration clear clc fprintf(' *** Preparing functional connectivity data for harmonization ...\n') %Define cohort, session, correlation Cohort = '2'; Ti...
261be14a5b8ea3586ebafe231ef717b2ef4f23dcd267ec4f2911c7fce03ef3d1
MATLAB
1,631
52
function b = copyfields(a, b, fields) % COPYFIELDS copies a selection of the fields from one structure to another % % Use as % b = copyfields(a, b, fields); % which copies the specified fields over from structure a to structure b. Fields that % are specified but not present will be silently ignored. % % See also KEE...
96f366bd57ea3e4d9b97add4725579173ba187c80ce3b08c8c7f6e75a17ef3c7
MATLAB
1,631
39
% GIfTI Class for MATLAB % % Geometry format under the Neuroimaging Informatics Technology Initiative % (NIfTI): % http://www.nitrc.org/projects/gifti/ % http://nifti.nimh.nih.gov/ % % This MATLAB class is part of SPM: % http://www.fil.ion.ucl.ac.uk/spm/ % ...
c5d27a8fc8ebff009e2cb404771228fa67fecd6a9959a748ef294b06ad124b05
MATLAB
1,632
33
% Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences; % Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "License") % You may not use this work except in compliance with the License. % You may ob...
2aa06511422792f9e8dce718f7f3fb792d50766dc38a30a1cda6d03aad249845
MATLAB
1,634
50
function tree = copy(tree,subuid,uid) % XMLTREE/COPY Copy Method (copy a subtree in another branch) % FORMAT tree = copy(tree,subuid,uid) % % tree - XMLTree object % subuid - UID of the subtree to copy % uid - UID of the element where the subtree must be duplicated %______________________________________...
b81bddbd40e30123229d06fb13f904ddf020bbf7402a15a71af114265b3cdd95
MATLAB
1,635
51
% Periodic Boundary Conditions version function [plist, alist] = get_cell_shape_LE(V, C, strain) % GET_CELL_SHAPE_LE Compute perimeter and area of every cell polygon % under Lees-Edwards (sheared) periodic boundary conditions. % % [plist, alist] = GET_CELL_SHAPE_LE(V, C, strain) computes, for each % cell, the peri...
f60c6e96a7299e29287a625771c2b7f9a86187bbc1eec9543b289bdba91afbe0
MATLAB
1,635
59
function [n, npw, ts, wave] = plx_waves_v(filename, channel, unit) % plx_waves_v(filename, channel, unit): read waveform data from a .plx or .pl2 file % % [n, npw, ts, wave] = plx_waves_v(filename, channel, unit) % % INPUT: % filename - if empty string, will use File Open dialog % channel - 1-based channel n...
ce6c5ba481acf774e2fda0df7504cbdb9674f5a44561cae789c6ac97944fbcbb
MATLAB
1,636
41
%% Contents % buzcode\analysis\ %% lfp % bz_Filter: Filter - Filter samples. % bz_DownsampleLFP: takes a buzcode lfp structure and returns a buzcode lfp structure downsampled % bz_LFPPowerDist: calculates the power distribution of an LFP signal. % bz_LFPSpecToExternalVar: calculate...
0e1b5a4d848e99144b122c72b23cf4e7477808458b0a4e5984a19738ad212bc8
MATLAB
1,637
28
function ciftisavereset(cifti, filename, varargin) %function ciftisavereset(cifti, filename, ...) % Compatibility wrapper for cifti_write. periods = find(filename == '.', 2, 'last'); if length(periods) < 2 warning('ciftisavereset wrapper called with non-cifti file extension'); else ...
08957f9c7d0906b81961de8f7d45554f55db005aed9d98c95e3e5e762046e11b
MATLAB
1,638
40
% ccc; clear; clc; SINGLEPATHs = dir("..\MAT Data\granger result minus base\PE\**\single\**\*.mat"); SINGLEPATHs = unique({SINGLEPATHs.folder})'; % SINGLEPATHs = SINGLEPATHs(contains(SINGLEPATHs, 'Active')); SINGLEPATHs = SINGLEPATHs(contains(SINGLEPATHs, 'Passive')); %% Collect data [~, temp] = cellfun(@(x) mu.getla...
454ab750efd606d819559d82d91b73c6ea62caef711dd60a22f2de553f9b20f2
MATLAB
1,638
57
function s = CumSum(data,stops) %CumSum - Cumulative sum of elements. Partial sums can also be computed. % % USAGE % % sum = CumSum(data,stops) % % data data to sum % stops optional logical indices where sum should be restarted % % EXAMPLE % % % Simple cumulative sum % s = CumSum([1...
7f7d5630d435c3b0c100d5272be1813328458fc969b781767320b9ba5314dae5
MATLAB
1,638
49
%%************************************************************************* %% ToeplitzApprox: find the nearest symmetric positive definite Toeplitz %% matrix to a given symmetric matrix F. %% %% %% max -y(n+1) %% s.t. T(y(1:n)) + y(n+1)*B >= 0 %% [I 0 ] + sum_{k=1}^n y(k) [0 ...
da76161ed664492da1b9257b904ccf5c61391f9fafbf7fad53a797ce41eaf4c2
MATLAB
1,638
47
function Y = palm_gammainc(X,A,tail) % Quick patch until the "gammainc" function in Octave is fixed % http://savannah.gnu.org/bugs/?47800 % % Inputs and outputs are as in "gammainc", except % that A must be scalar. % % _____________________________________ % Anderson Winkler % FMRIB / University of Oxford % Apr/2016...
7cb6f562cef77c5c43944111ecb86520056ff3f05612ad7eabf9b0efbaee5469
MATLAB
1,639
50
function showEyeData(params, subject) % showEyeData(params, subject) % % ---------------------------------------------------------------------- % Matlab tools for "Predicting human gaze beyond pixels," Journal of Vision, 2014 % Juan Xu, Ming Jiang, Shuo Wang, Mohan Kankanhalli, Qi Zhao % % Copyright (c) 2014 NUS...
aea45bce352fe166557fe7999bdb4d9cc0a45ea496a72f3ed4407f06a97a078a
MATLAB
1,639
40
function z = psdinvjmul(xlab,xfrm, y, K) %#ok % z = psdinvjmul(xlab,xfrm, y, K) % % PSDINVJMUL solves x jmul z = y, with x = XFRM*diag(xlab)*XFRM' % % ********** INTERNAL FUNCTION OF SEDUMI ********** % % See also sedumi % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko % Copyright (C) 2005 McMas...
5b94e42a586c69f7fad8b37bf455a6478d6f2b66b71329dbb55e85baf5b3a78e
MATLAB
1,640
32
function new_tractset = ea_unifiedmapping_update_settings(explorer,new_settings) % Updates the given tractset object based on the % struct passed into the function explorer.calcsettings.calcthreshold = new_settings.calcthreshold; explorer.posvisible = new_settings.posvisible; explorer.negvisible = ...
721e4fdd0ac229246c7e3b50874b85e1481b5bc1f8eef6754ff54c4c647ef006
MATLAB
1,640
53
% sample script to create volumetric mesh from % multiple levelsets of a binary segmented head image. % % Author: Qianqian Fang <fangq at nmr.mgh.harvard.edu> % load full head image (T1 MRI scan) fprintf(1,'loading binary head image...\n'); for i=1:256 head(:,:,i)=imread('head.tif',i); end % load segmented brain...
eb56882d4899b3e218e41ae6c7743612337788272ce13dc4986a8ebe17cffe99
MATLAB
1,640
37
% SOFA API - demo script % Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences % Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "License") % You may not use this work except in compliance with t...
c2b4f71a3f4ea3ef2383192ab01071b7df8c20c6a569864efe69a2fd34bc2262
MATLAB
1,641
39
% written by Yiyuan Han, Essex BCI-NE Lab, 03/09/2020 % getEEGmapCFC: get the map of the channels with CFC as the selected % features function CFCmap = getEEGmapCFC(featureLabels,channelPos,electrodes,map) CFCmap = imread(map); indices = unique(featureLabels(3,:)); for node = 1:size(channelPos,2) CFCmap = insertSha...
713348e2cad5f2f7d2974d9d5694a3042255178d06e66ef7a4402412d6f3818c
MATLAB
1,642
57
function C = approx_multiway_cut(A,vs) % APPROX_MULTIWAY_CUT Solve a 2-approximation to the multi-way cut problem % % C = approx_multiway_cut(A,vs) % % Outputs C, the set of edges cut in a 2-approximation to the multiway cut % problem. The multiway-cut problem is to find a minimum cost set of edges % to disconnect al...
a7c9463831069504f607250b0282f2184aa9fe228768dd5e698b78340bc0f163
MATLAB
1,642
54
function cg = ea_colorgradient(steps, color1, color2, color3) % Generate linear color gradient (used for customized colormap) if ~exist('steps', 'var') % Input steps steps = inputdlg('Please enter the number of the steps:','Steps',1,{'256'}); steps = str2double(steps); end if ~exist('color1', 'var') % Inpu...
e3e17c7a554641371afdbed1ecba8fd1800ccf5814c8999daca4ced92974c00a
MATLAB
1,642
40
% ccc; clear; clc; SINGLEPATHs = dir("..\MAT Data\granger result minus base\Prediction\**\single\**\*.mat"); SINGLEPATHs = unique({SINGLEPATHs.folder})'; % SINGLEPATHs = SINGLEPATHs(contains(SINGLEPATHs, 'Active')); SINGLEPATHs = SINGLEPATHs(contains(SINGLEPATHs, 'Passive')); %% Collect data [~, temp] = cellfun(@(x) ...
6a1619f78a0318eae5e72b77d9529af4c543fec45f0ca38633bcbb0914f574db
MATLAB
1,643
38
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% calculate trace means function [IndivClustersRAW_means] = CalculateTraceMean(IndivClustersRAW) fns = fieldnames(IndivClustersRAW); for k=1:size(fns,1) % read cluster data from structure ClusXYZRAW = IndivClustersR...
6bc86f5e93ba7843f7bf8ab59f96d43e383bf2fca4290c6fed6a43d64743f24e
MATLAB
1,643
50
%% Setup: Define File and Sheet Info Wt_E8_fileName = 'Data_1.xlsx'; Wt_E8_sheetName = 'Wt_E8.5_data'; %% Data Import % Read the full table from the specified sheet Wt_E8_data = readtable(Wt_E8_fileName, 'Sheet', Wt_E8_sheetName); %% Filtering: NMPROI == 1 and Marker Positivity % Subset for NMP cells only Wt_E8_datan...
a6977f60ddb05d9693f455e33fdf154d45d7aaa0edb728d5089437783505f2a9
MATLAB
1,643
52
function Mset = palm_msetread(fname) % Read a .mset file, i.e. a file containing % multiple matrices (2D arrays) % % Mset = palm_msetread(filename) % % filename : File name. % Mset : Cell array with the matrices. % % _____________________________________ % Anderson M. Winkler % FMRIB / University of Oxford % Feb/20...
bf29cff873488b42d0baa5aa87518a8f9b9aed2d1b6da7a8334f6ea5731c0abd
MATLAB
1,643
44
function [DPF_760, DPF_850, info] = compute_dpfs(model, epsilon_mm_uM, brain_nodes_idx, wl_idx, dist_ch, nCh) %COMPUTE_DPFS Channel DPFs from Jacobian-derived total pathlengths. % [DPF_760, DPF_850, info] = nirsproc.compute_dpfs(model, epsilon_mm_uM, brain_nodes_idx, wl_idx, dist_ch, nCh) arguments model stru...
a4e0d9f07b67628cbf80f961a1c579348f0ff6b28865f2477e231504db2d039d
MATLAB
1,644
52
function ea_crop_nii_bb(input, bbox, output) % Crops nifti to a specific bounding-box. arguments input {mustBeFile} bbox {mustBeNumeric} % in mm output {mustBeTextScalar} = '' end % Validate bbox size if ~isequal(size(bbox), [2 3]) ea_cprintf('CmdWinErrors', 'Wrong bounding box size! Should be 2x...
f50349eabc7a574fd6b9f53419892c2d879914098d0a5f9e15442e51ba24fd68
MATLAB
1,644
46
classdef HButtonBox < uix.HButtonBox %uiextras.HButtonBox Arrange buttons horizontally in a single row % % obj = uiextras.HButtonBox() is a type of HBox specialised for % arranging a row of buttons, check-boxes or similar graphical % elements. All buttons are given equal size and by default a...
08fc16b7e9657d55c3eee4ceb357b73f7ea1aad578102587e5964ad890e664e4
MATLAB
1,646
50
function [vals inds equal_max_val_inds] = randmax(X) % The function is the same as the regular max function, but if there are ties in maximum value, % this function returns a randomly selected best index rather than always choosing % the index with the smallest value (as would happen if normal max is used). Thi...
83332d9022db440852162f1d7a14cf67a715d855221e6de8d9b4332eb6a277f9
MATLAB
1,646
44
function [Y0] = buildInitialConditionVectorsFromData(T,init_times,concentrations) % This file is a part of the MDSINE program. % % MDSINE: Microbial Dynamical Systems INference Engine % Infers dynamical systems models from microbiome time-series datasets, and % predicts biologically relevant behaviors of the ecosyst...
0b98b5b7c6ccf410791056f481dfbbece2fa74ca0888e742c7e5c144a9114d8f
MATLAB
1,647
46
classdef VButtonBox < uix.VButtonBox %uiextras.VButtonBox Arrange buttons vertically in a single column % % obj = uiextras.VButtonBox() is a type of VBox specialised for % arranging a column of buttons, check-boxes or similar graphical % elements. All buttons are given equal size and by defau...
f8dd846a746481a529e86ee397ac0360fbaee3ba154ce911a364d751364d6bd5
MATLAB
1,647
46
function plotAreaROItSNE(allROIs, areas, colors) % Plots tSNE coordinates for allROIs, colored by area % Create plot fig; axis square axis off alpha = 0.5; % Get data allCoords = cat(1,allROIs.tsneCoords); % Z position, randomized for better visuals for M2, M1 and S1-fl zCoords = 0.8*rand(size(allCoords,1),1); zCoor...
fabb0da3172f3fff2eb4517d174569eaa211a603d9c43a33477a65bca9dcd062
MATLAB
1,647
56
%%******************************************************* %% maxcut: MAXCUT problem. %% %% (primal problem) min Tr C*X %% s.t. diag(X) = b; %% %% Here, b = e, C = -(diag(B*e)-B)/4. %% %% (dual problem) max b'*y %% s.t. diag(y) + Z = C. %%---------...
48e6f352d5174ac96e13ec5f70c65520d4f60739389457e3b41991eda8b5ae23
MATLAB
1,648
54
%%******************************************************* %% max_kcut: MAX k-CUT problem. %% %% (primal problem) min <C,X> %% s.t. diag(X) = b %% Xij >= -1/(K-1) for all i ~= j %% X positive semidefinite %% %% Here, b = e, C = -(1-1/K)/2* (diag(B*e)-B). %%...
3cd011e5c73989434c690b2bd630a7e90ec83207591a1582015d18db6cd6d05a
MATLAB
1,649
55
function answer = max_cell(a) %MAX_CELL maximum of 2D cell or 2D numeric matrix. % MAX_CELL(A) calculates the maximum of the contents of A, % provided A is a 2 dimesional numeric matrix or % a 2 dimensional cell matrix containing a mix of % 2D cell matrices and 2D numeric matrices, which in % turn ma...
d70506675decb25f959baf997839994c83774a7e48508e558aaa26d6a3aa6b9c
MATLAB
1,649
55
function answer = min_cell(a) %MIN_CELL minimum of 2D cell or 2D numeric matrix. % MIN_CELL(A) calculates the minimum of the contents of A, % provided A is a 2 dimesional numeric matrix or % a 2 dimensional cell matrix containing a mix of % 2D cell matrices and 2D numeric matrices, which in % turn ma...
469d55a0d8cc1330e614158d67a706f7bae960293038e44290f571d2d90623ab
MATLAB
1,650
56
%% Figure 5 main YOURDATAPATH = ''; % Load ROIs and PETHs data fileList = searchFilesRecursive(YOURDATAPATH, 'allROIs.mat'); load(fullfile(fileList.folder, fileList.name)) load('allenDorsalMap.mat'); % Using only cue-modulated henceforth allROIs = allROIs([allROIs.modCue] == 1); % Params smoothSD = 0.15; color = [0,1,...
28d8367829b6951601dc4953e04437a85cb5c280a49c27868a5bdfdf7c6fd4a7
MATLAB
1,651
44
function tdetx = tdet(x,K) % tdetx = tdet(x,K) % % TDET Computes twice determinant for Lorentz block % % ********** INTERNAL FUNCTION OF SEDUMI ********** % % See also sedumi % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko % Copyright (C) 2005 McMaster University, Hamilton, CANADA (since 1.1) ...
38323b61d77bcc78e084c4b483f1f5a112e8bc7f83f20b3edf6ace149dd5666c
MATLAB
1,652
39
function y = huber( x, varargin ) %HUBER Huber penalty function. % HUBER(X) computes the Huber penalty function % % HUBER(X) = |X|^2 if |X|<=1, % 2|X|-1 if |X|>=1. % % HUBER(X,M) is the Huber penalty function of halfwidth M, M.^2.*HUBER(X./M). % M must be real and positive. % % HUB...
67ec9610be195c6c8e9619482bcafb144a448e672b97122f300076845cc4dfcc
MATLAB
1,652
58
n = 10; %% ---- Linear System ---- figure; hold on; x1 = 1:size(linearSystem_CM,1); h1 = plot_with_shade(x1, linearSystem_CM(:,1), linearSystem_CM(:,2)/sqrt(n), [0 0 0], '-'); h2 = plot_with_shade(x1, linearSystem_PM(:,1), linearSystem_PM(:,2)/sqrt(n), [0.3 0.3 0.3], '-.'); h3 = plot_with_shade(x1, linearSystem_CU(:...
9a47613f78f166b8881bfc63e7edc4eb15e5e39e6ce3262f876d078a50b93f35
MATLAB
1,652
47
% cc = getCorrcoef(I1,I2,c1,c2) % --------------------------------------- % % Return the normalized correlation coefficient expressed in Fourier space % % Inputs: % I1 Complex Fourier transfom of image 1 % I2 Complex Fourier transfom of image 2 % % Outputs: % cc Normalized cross-correlation...
b0cfb841367bdc43e7d595cbd791628ae687c8ff951aaf291d6cb1d368b424b9
MATLAB
1,652
87
function alpha = circ_vmrnd(theta, kappa, n) % alpha = circ_vmrnd(theta, kappa, n) % Simulates n random angles from a von Mises distribution, with preferred % direction thetahat and concentration parameter kappa. % % Input: % [theta preferred direction, default is 0] % [kappa width, default is 1] ...
73ac784215aac9272db6e785b338f309cb0c49ec8a8a69a8d161b771a01fe8e9
MATLAB
1,653
46
% x = blk2vec(X,nL) % % Converts a block diagonal matrix into a vector. % % ********** INTERNAL FUNCTION OF FROMPACK ********** function x = blk2vec(X,nL) % % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko % Copyright (C) 2005 McMaster University, Hamilton, CANADA (since 1.1) % % Copyright (C)...
cdd86fb80e10069fb87b8eede596f30671ab86b07d68f01369fe2f468087ab1a
MATLAB
1,653
44
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SORTING %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% load spikes2 %% The following commands run the Fee algorithm spikes = ss_dejitter(spikes); spikes = ss_outliers(spikes); spikes = ss_kmeans(spikes); spikes = ss_energy(spikes); spikes = ss_aggregate(spikes); %% The following commands merge/spl...
b3b083f4d8e5a3d9ea9769a2c6dc8e4f54cb2c02ad072db71303f293a76f409d
MATLAB
1,655
46
function TtrfAnmlWithDprime = tuningQualityToTtrfAnml(TtrfAnml) boots = 1000; %add to params eventually? dPrime = cell(size(TtrfAnml,1),1); for aNo = 1:size(TtrfAnml,1) [~,BFidx] = ismember(TtrfAnml.BFuDB{aNo},TtrfAnml.freqList{aNo}); %This looks one dB lvl below at BF freq, and above and below...
faf8d0ac89eb70eba36d433a0a5d3003be4b516203d5131ed0a484b155b8d372
MATLAB
1,655
45
function bfInitLogging(varargin) % BFINITLOGGING initializes the Bio-Formats logging system % % bfInitLogging() initializes the logging system at WARN level by default. % % bfInitLogging(level) sets the logging level to use when initializing % the logging system % % Examples % % bfInitLogging(); % bfInitLog...
2e09137d18a19fbf1a49b559399c681964b02c4ae9dbff18750dbf7d5a2d85de
MATLAB
1,656
39
classdef CBIG_MSHBM_unit_test < matlab.unittest.TestCase % Written by Ru(by) Kong and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md methods (Test) function test_example(testCase) % create output folder CBIG_CODE_DIR = getenv('CBIG_CODE_DIR'); ...
5c3b7568e243c1bf0fde1d6ad9fba799947d062994e32ce81252814388482163
MATLAB
1,656
56
function [ events,filename ] = bz_LoadEvents(basePath,eventsName) %[ events ] = bz_LoadEvents(basePath,eventsName) function for %loading events.mat files. events.mat files are saved as... % datasetPath/baseName/baseName.eventsName.events.mat % %eventsName can be the name of a events.mat file, If empty, prompts the user...
f4778beecb9c82f559ad637bdc9fd1090df1fbffa5a70217e8a1e5cbc8aac159
MATLAB
1,656
41
function [res] = plx_test_bad_parameters() % trying all functions with invalid file name res.allTestsPassed = 1; res=VerifyError('[a,b,c,d,e] = plx_ad(1, 1);', res); res=VerifyError('[a,b] = plx_ad_chanmap(1);', res); res=VerifyError('[a,b,c,d] = plx_ad_gap_info(0, 1);', res); res=VerifyError('[a,b,c] = pl...
da0a7db4bf65573380395a02420719db6f0c47cc29e2de1d4da50fb139126de4
MATLAB
1,658
56
function b = renamefields(a, old, new) % RENAMEFIELDS renames a selection of the fields in a structure % % Use as % b = renamefields(a, old, new); % which renames the fields with the old name to the new name. Fields that % are specified but not present will be silently ignored. % % See also COPYFIELDS, KEEPFIELDS, R...
99e4989e313a0a129e802ca01eacd4db4f228a765810abc52050b711d2db8969
MATLAB
1,659
66
function baseline = CBIG_hypoTest_2t(betas, stats) % baseline = CBIG_hypoTest_2t(betas, stats) % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md baseline = zeros(3, 3); %% AD fprintf('\n--------------------------------- AD ---------------------------------\n\n'); %...
2869efa8c7aae6ff2ecbbefbca0c5acebca587b745c87022fdf298dc792dfb89
MATLAB
1,660
60
function trial = trialbytrial(headpath,fileexpnum,imskip,expskip,deltamode,FrameRate) myfields = {'template';'trtype';'fluordata';'redfluor'}; %;'processedfluor';'processedred'}; ? for i = 1:numel(myfields) trial.(myfields{i}) = []; end % redtemplate={}; cd(headpath); %'D:\TWO-PHOTON IMAGING\Metadata'...
2afca70e90ca30decfb75b451fe0da370736985768822c4057752bf12ac94d95
MATLAB
1,660
37
function [cxitem,cxmenu] = find_uimenu(parent, tag, label, callback) %FIND_UIMENU Finds/creates an item in a UIcontextmenu. % HITEM = FIND_UIMENU(PARENT,TAG) searches the UIcontextmenu (if any) % associated with the object PARENT for a menu item with tag TAG. If % such a menu item exists, its handle is re...
66709f77beb5c32db10b11137f29892d0f46b88ac2b032a053878d6b96b786b1
MATLAB
1,660
40
function y = invcholfac(u,K, perm) %#ok % y = invcholfac(u,K, perm) % % INVCHOLFAC Computes y(perm,perm) = u' * u, with u upper triangular. % % ******************** INTERNAL FUNCTION OF SEDUMI ******************** % % See also sedumi, getada3 % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko % Cop...
09c3c2e4288cf17f38f6f459b759b7de3a457a443fc08a0e1878a89327ce4a9c
MATLAB
1,661
33
function ciftisave(cifti, filename, varargin) %function ciftisave(cifti, filename, ...) % Compatibility wrapper for cifti_write. if ~isfield(cifti, 'diminfo') error('cifti structure has no diminfo field, maybe use the old ciftisave code instead?'); end tic; if length(size(cifti.cdata))...
638d9757136db8bb0d0b61ea141ac0343e33d628c60e62a278c5b58acfa14bd7
MATLAB
1,661
56
%isdmatrix - Test if parameter is a matrix of doubles (>= 2 columns). % % USAGE % % test = isdmatrix(x,test1,test2,...) % % x parameter to test % test1... optional list of additional tests % % EXAMPLES % % % Test if x is a matrix of doubles % isdmatrix(x) % % % Test if x is a matr...
67cbf4f866c05cc42ec50bd781ae3200ba7fe00fb9510b40d61b3b2bddf8c2c3
MATLAB
1,661
77
function [p,idx]=ea_isosignificance(varargin) % inputs: values at coordinates, threshold, max dist vizz=0; XYZV=varargin{1}; % clear NAN vars: XYZV(isnan(XYZV(:,4)),:)=[]; XYZV=zscore(XYZV); try thresh=varargin{2}; % standard deviation catch thresh=1.5; end try mdist=mean(ea_pdist(XYZV(:,1:3)))*varargin{3}...
aa81944296de69b479f09150d1786c67919968a5633f7b0fedfc69a347dec99e
MATLAB
1,661
48
function copydata2targetwithT1(PGout,ROIdirs,IMGdirs,T1dirs,namelist) for i = 1:length(namelist) [pth1 fil1 ext1] = fileparts(IMGdirs{i}); [pth2 fil2 ext2] = fileparts(ROIdirs{i}); [pth3 fil3 ext3] = fileparts(T1dirs{i}); Outdirs = [PGout,filesep,namelist{i},filesep]; mkdir(Outdirs); if strcmp(e...
a650062c4cdcf0a05f665cbf0aa7a142dda72b0c007da7439ce5484cc7817fae
MATLAB
1,662
63
%% Example 1 of applying author topic model (AT) % % This example shows how to run the AT Gibbs sampler on a small dataset to % extract a set of topics. This code will produce a single |WP| and |AT| count matrix % and will show the most likely words and authors per topic. It also writes the results % to a file ...
b176445630e0e39fed3f2a4cd697c74827fa5adeccb8adcfb67693ff33b8ad89
MATLAB
1,662
48
%% bombcell: Methods Text Generation % This script demonstrates how to automatically generate a methods section % paragraph for a scientific paper, based on the parameters used to run % bombcell %% 1. Generate methods text from default parameters % If you just want to quickly generate the text with default BombCell % ...
4f0ea7b6ba69e726d864510caaa9913942fb0279b5be7b9f096f4d97dd461fd5
MATLAB
1,663
42
function y = sqrtinv(q,vlab,K) %#ok % y = sqrtinv(q,vlab,K) % % SQRTINV Computes for PSD-cone, y = (Q / diag(sqrt(vlab)))', so that % Y'*Y = inv(Q * diag(vlab) * Q'). % % ********** INTERNAL FUNCTION OF SEDUMI ********** % % See also sedumi % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko % Co...
6ada5b23a0fb4eac0044869e7b7d1437276ff60b80f74af82275bf8aee94b6ec
MATLAB
1,663
44
function [vatlist,FilesExist] = ea_discfibers_getlattice(obj) % Return list of VATs numPatient = length(obj.allpatients); vatlist = cell(numPatient,2); FilesExist = zeros(numPatient,2); % no sense to check for mirrored here disp('Check for 4-D niftis...') for sub=1:numPatient [~,subj_tag,~] = fileparts(obj.M.pat...
a99f0502585a93faa968babc47542b91c998e8c7a10996d380c5ad9c0ea74318
MATLAB
1,663
50
function computeFixationMaps(params) % computeFixationMaps(params) % % ---------------------------------------------------------------------- % Matlab tools for "Predicting human gaze beyond pixels," Journal of Vision, 2014 % Juan Xu, Ming Jiang, Shuo Wang, Mohan Kankanhalli, Qi Zhao % % Copyright (c) 2014 NUS V...
01b5230fa43948c17d092b9bf50b101005b60927438b091a586745f22e64a093
MATLAB
1,664
57
function [IIM JJM deltaI Iabs] = AutoFeature_detection(im, sigma, quant, plot_flag) % a function of particle detection. Use Delaunay triangulation to % estimate local background intensity and t-test to determine true particles. % Inputs: % im: an image, % sigma: level of gaussian smoothing on the raw image % quant: q...
21420fa98caba55f835b2ebc4f0b11955bf321b21a00798193d79ee86f8d70b3
MATLAB
1,664
69
function active_lfp_ind = ChooseActiveLFP(root) % active_lfp_ind = ChooseActive(root) for k = 1:length(root.b_lfp) pr(k) = calc_spectrum(root.b_lfp(k)); end [~, active_lfp_ind] = max(pr); end function power_ratio = calc_spectrum(lfp) import CMBHOME.Utils.* ...
635ed9d72599531f1c3f884188807af1c3df7d5756bf98c83eac8b5b31e91f30
MATLAB
1,664
62
addpath bva-io-master/ addpath (genpath('eeglab2022.1/')); eeglab load("dataset_ds005284.mat"); selected_channels = {'C3','C4','CZ','PZ'}; aveERP = zeros(length(selected_channels),300); for figi=1:length(selected_channels) for i=1:size(data,2) disp (num2str(i)) EEG = data{i}; EEG = pop_...
86a923c61f5b0d28d1cdf40c6c1a1610bf09dee5fde0ec4439775e0e258c536a
MATLAB
1,665
66
function baseline = CBIG_hypoTest_2t(betas, stats) % baseline = CBIG_hypoTest_2t(betas, stats) % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md baseline = zeros(3, 3); %% AD fprintf('\n--------------------------------- AD ---------------------------------\n\n'); %...
8e075dead4caecb7948b0410392d461b10d3259b9f8d1be20eb5f2cc203501f2
MATLAB
1,665
59
function [ spiketimes_jitt ] = JitterSpiketimes(spiketimes,jitterwin,varargin) %[ spiketimes ] = JitterSpiketimes(spiketimes,jitterwin) jitters spiketimes %of all cells within a designated window. % %INPUT % spiketimes {Ncells} cell array of [Nspikes] vectors of spiketimes for % each cell (seconds) % ...
ed94d4222423ec03c14def623a5bcc046bd54a206c2c1e23ec652fb7dca71aed
MATLAB
1,665
47
function obj=set_order_options(obj,varargin) % set_order_options() Set ordering options for categorical % variables % % Ordering options are available for 'x', 'color', 'marker', % 'size', 'linestyle', 'row', 'column', 'lightness' % For each variable, the option is provided with a 'name', % value pair. Example for sett...
1499e9c378188a6489cecd5eec449cd0ffaa2a3041f89a52af3cf5984cac71a4
MATLAB
1,666
32
function [tapers,eigs]=dpsschk(tapers,N,Fs) % Helper function to calculate tapers and, if precalculated tapers are supplied, % to check that they (the precalculated tapers) the same length in time as % the time series being studied. The length of the time series is specified % as the second input argument N. Thus if p...
33cc108fd3274aafb9417cc00df5409d21d4e3353a779e02e036abbb39791a46
MATLAB
1,666
41
function rid = CBIG_select_predementedGrp(rid_dx, grpName) % rid = CBIG_select_predementedGrp(rid_dx, grpName) % Possible values: ad_188 mci_394 a+_mci_147 converter_mci_198 a+_hc_43 a+_hc&mci_190 % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md switch grpName ca...
673b160f995ac33219ff1208decc77eadb63bcc569e80247b2eeae160e3e2626
MATLAB
1,666
41
function y = bwdpr1(Lden, b) %#ok % y = bwdpr1(Lden, b) % % BWDPR1 Solves "PROD_k L(pk,betak)' * y = b", where % L(p,beta) = eye(n) + tril(p*beta',-1). % % ********** INTERNAL FUNCTION OF SEDUMI ********** % % See also sedumi, dpr1fact, fwdpr1 % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko...
6f968e371ad43a5e2b42d60465f82ecc85b95371db76df4e8f50cd31d9bd5e06
MATLAB
1,667
41
function varargout = nifti_stats(varargin) % Conversion among various statistics % FORMAT P = nifti_stats(VAL,CODE,OPT,PARAM) % CODE can be one of % 'CORREL' 'TTEST' 'FTEST' 'ZSCORE' % 'CHISQ' 'BETA' 'BINOM' 'GAMMA' % 'POISSON' 'NORMAL' 'FTEST_NONC' 'CHISQ_NON...
678eeb3c3f222bc722669a3be3ae12ad43132870d4b7f96c702c717c2c221ff7
MATLAB
1,668
40
function [u,perm,gjc,g] = urotorder(u,K, maxu,permIN) %#ok % [u,perm,gjc,g] = urotorder(u,K, maxu,permIN) % % UROTORDER Stable reORDERing of triu U-factor by Givens ROTations. % % ********** INTERNAL FUNCTION OF SEDUMI ********** % % See also sedumi % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Roman...
acf61110455838151ea6aea2ec06f83d7071454a5abbdcdefb0524a62b53c22b
MATLAB
1,668
46
function [vtx,fac] = palm_srfread(filename) % Read a surface file, in ASCII format. % % [vtx,fac] = palm_srfread('filename'); % % - vtx contains the coordinates (x,y,z), one vertex per row % - fac contains the indices for the three vertices of each face % % The indices for the vertices start at 1, not 0. % % ______...
e2a1b0866c7d798383d22b10fdf459740159b30685c552788b6c7518f6442a88
MATLAB
1,668
45
function [ad] = PL2AdBySource(filename, source, channelInSource) % PL2AdBySource(filename, source, channelInSource): read all a/d data for the specified channel from a .pl2 file % returns a/d values in millivolts % % examples: % % ad = PL2AdBySource(filename, source, channelInSource) % ad = PL2AdB...
18221fd35ba052a206236d19e530ded136093e1ef57c10c2e7772c0b131a511a
MATLAB
1,669
61
% Figure 7.1: Logistic regression % Section 7.1.1 % Boyd & Vandenberghe, "Convex Optimization" % Original by Lieven Vandenberghe % Adapted for CVX by Argyris Zymnis - 01/31/06 % % We consider a binary random variable y with prob(y=1) = p and % prob(y=0) = 1-p. We assume that that y depends on a vector of % explanatory ...
3744f6e0a3ca50692b92d85fc2e5868e2d07d2cfcfe9d9a50606abbf6d93f50d
MATLAB
1,669
53
function CBIG_ASDf_CCA_plotBar(score_names, struc_coeff, output_name) % CBIG_ASDf_CCA_plotBar(score_names, struc_coeff, output_name) % % This function plots the CCA behavioral score structure coefficients vs raw behavioral scores as % bar plot. If output_name is specified, the plot will be saved. % % Input: % - sco...
6e6c554ece6d6e269dc4671396f2ac453e73aa0cb1ef7ff1180c78090ea3c3b7
MATLAB
1,669
61
function Sigmoid = ea_SigmoidFromEfield(varargin) vizz=0; % map E-field to sigmoid function % by Till Dembek Efield = varargin{1}; if nargin == 1 minEfieldthresh = 0.061; % Astrom et al. 2014, 7.5µm, 1.5V maxEfieldthresh = 0.351; % Astrom et al. 2014, 2.5µm, 5V reestimatesteepness = 0; elseif nargin == 3 ...
d449e0c880b15f9188d442351e29532c4bbedd4ab4e8f08df4bbb22a0beb725d
MATLAB
1,669
43
function parms = SD_registerPairOfSpheres(fixed_sphere, moving_sphere, SD_atlas, reg_parms) % SD_registerPairOfSpheres(fixed_sphere, moving_sphere, SD_atlas, parms) % % Diffeomorphic registration of 2 spheres. % Calls SD_registerAtlas2SphereMultiRes by creating a fake atlas using moving_sphere. % % Just need to pass ...
ead670bfa3c7da9681686b056f2944ad00d23113a272d501f21263a743a9013d
MATLAB
1,669
49
function ff = draw_edges_LE(V, topo, strain, fignum) % DRAW_EDGES_LE Plot every edge of the tissue network (rather than cell % polygons), each drawn in a distinct color, under Lees-Edwards sheared % PBC. % % ff = DRAW_EDGES_LE(V, topo, strain, fignum) draws each edge as a % short line segment from its first vertex...
31b436fe52b32faee8e99d2245824a22dd45ad72d9300aea43802779f32ab587
MATLAB
1,670
62
function valnew=surfdiffuse(node,tri,val,ddt,iter,type1,opt) % % valnew=surfdiffuse(node,tri,val,ddt,iter,type1,opt) % % apply a smoothing/diffusion process on a surface % % author: Qianqian Fang, <q.fang at neu.edu> % % input: % node: list of nodes of the surface mesh % tri: triangular element list of the surf...