sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
f29e65b32f36678f28e98e3dd1e161903ba7ecc7ccc92a2240028f7fea9de05f
MATLAB
562
16
function [errCode] = ddt_write_v(filename, nch, npoints, freq, d) import CMBHOME.PLX2Mat.* % ddt_write_v(filename, nch, npoints, freq, d) Write data to a .ddt file % % [errCode] = ddt_write_v(filename, nch, npoints, freq, d) % % INPUT: % filename - if empty string, will use File Open dialog % nch - number of channels...
169da331ac056ee8465194eb42da6dfef17206f40f30e7a46a6bda6a975509b9
MATLAB
563
20
function options = ea_detsides(options) if isfield(options.subj, 'recon') && isfile(options.subj.recon.recon) load(options.subj.recon.recon, 'reco'); sides = []; if isfield(reco,'native') for el=1:length(reco.native.markers) if ~isempty(reco.native.markers(el).head) side...
47990dde4bb30b191bb60c05e3b9784d3dc175420708cbd8731150147a4d9606
MATLAB
564
18
function [node,elem,face]=v2m(img,isovalues,opt,maxvol,method) % % [node,elem,face]=v2m(img,isovalues,opt,maxvol,method) % % volumetric mesh generation from binary or gray-scale volumetric images % shortcut for vol2mesh % % author: Qianqian Fang (fangq <at> nmr.mgh.harvard.edu) % % inputs and outputs are similar to tho...
aa833036e9154ec7d09b61e6463fc56158866e82de419004ae125316ae4cf43c
MATLAB
564
17
function obj=geom_hline(obj,varargin) % geom_abline Display an horizontal reference lines in each facet % % Example syntax: gramm_object.geom_abline('yintercept',1,'style','k--') % See geom_abline for details p=inputParser; my_addParameter(p,'yintercept',0); my_addParameter(p,'style','k--'); my_addParameter(p,'extent'...
0b665876e571a01f2eec63a372ec425035bd014e2f85b634fa6acd50a0ee3184
MATLAB
565
14
function emat=ea_antsmat2mat_empirical(options) % Extra empirical check of the scrf matrix moving = options.subj.brainshift.anat.moving; anchor = options.subj.brainshift.anat.anchor; mov = ea_load_nii(moving); [vxx, vyy, vzz] = ind2sub(size(mov.img),1:100:numel(mov.img)); XYZ_mov_vx = [vxx; vyy; vzz; ones(1,length(vx...
0f7aedf655dc65a663cc528c1ff3add99de339d916e04c8bf2b433809fe39a78
MATLAB
565
14
function varargout = ChaosLibrary(varargin) %CHAOSLIBRARY (deprecated) Use chaos_library instead. % ChaosLibrary has been renamed to chaos_library. This shim forwards every argument and % output unchanged, so existing scripts keep working, and warns once per % session. % % Silence with: warning('off','ChaosLibr...
26d8fddb568e3ab3b2ddfee6679d1ca14d40106b03cba0be31dde15a6a17caf5
MATLAB
565
22
fniis=dir('*.nii'); for fnii=1:length(fniis) nii=ea_load_nii(fniis(fnii).name); nii.img=round(nii.img); of=fopen([fn,'.txt'],'w'); for c=1:max(nii.img(:)); [xx,yy,zz]=ind2sub(size(nii.img),find(nii.img==c)); XYZ=[xx,yy,zz,ones(length(xx),1)]'; XYZmm=[nii.mat*XYZ]'; XYZmm=XYZmm...
2a9fd3f057a4f5c76e179d2535eec05636615e5f24d564ba12c137ae018a1b0e
MATLAB
565
29
function y=myfilter(x,ncu,ts) % Usage ... y=myfilter(x,ncu_or_fco,ts) hp_flag=0; if ncu<0, hp_flag=1; ncu=abs(ncu); end; if (exist('ts')), df=(1/length(x))*(1/ts); ncu=round(ncu/df); disp(sprintf(' actual cutoff = %f (%d)',ncu*df,ncu*2)) end; x=x(:); xft=fft(x); %if (ncu>length(x)/2), ...
d197d32070adebde28b70f91e48c69ac05041439d2b5bc8a66f272fc7677e895
MATLAB
565
14
function varargout = Surr_findrho(varargin) %SURR_FINDRHO (deprecated) Use surr_find_rho instead. % Surr_findrho has been renamed to surr_find_rho. This shim forwards every argument and % output unchanged, so existing scripts keep working, and warns once per % session. % % Silence with: warning('off','Surr_find...
a44d470c0e167ed2f4f48edb39f33afbadb8ed42f5c7165737579794d6e28150
MATLAB
567
24
function mpgMean = apply_RF_matlab(signal, trainedML, MLdebias) % Apply pretrained Random Forest regressor % % Author: % Dr. Marco Palombo % Cardiff University Brain Research Imaging Centre (CUBRIC) % Cardiff University, UK % 8th December 2021 % Email: palombom@cardiff.ac.uk Mdl = trainedML.Mdl; Slope = trainedML.Slop...
1f68fdacd6f5095aed25a8f1942aab3e7a143d74a33f4201f41026aefbd7c57e
MATLAB
568
23
function [yes] = isfilextension(fname, extension) % See also CHECK_FILE_EXTENSION, CLEAR_FILE_EXTENSION. % % File: isfilextension.m % Author: Ioannis Filippidis, jfilippidis@gmail.com % Date: 2012.06.22 % Language: MATLAB R2012a % Purpose: check if file has the desired extension % Copyright: Ioa...
3e66dda5673f5a9db0aa6878e8b222a46d63afc441073ca54b7b82681d9fc5dd
MATLAB
568
14
%gaussian cut function g = gaussian_cut(x, a, x0, sigma, xcut) g = a .* exp(-(x - x0) .^ 2 / (2 * sigma .^ 2)); g(x < xcut) = 0; % if diff(g(1:2))<0%wierd shape % if length(g(1:find(g==max(g)))) < length(g(end:-1:find(g==max(g))-1)) % g(1:find(g==max(g))) = g(find(g==max(g))...
548200de4f0b298f4f1538b5344713c8febb39bff82db5752669000ec7c4f7b1
MATLAB
568
16
function tree = setfilename(tree,filename) % XMLTREE/SETFILENAME Set filename method % FORMAT tree = setfilename(tree,filename) % % tree - XMLTree object % filename - XML filename %__________________________________________________________________________ % % Set the filename linked to the XML tree as file...
4db0b4ac57edd81ce086a631cd748fbb654fea0a596afc302c39242943b7df69
MATLAB
569
20
function prob = montecarlo(A,b,Sigma,notrials); % Probability estimate using Monte Carlo methods % % Estimates the probability that a random vector x in R2 % with mean zero and covariance Sigma satisfies Ax <= b, % based on 100 * notrials trials. Sigma must be PSD. m = size(A,1); R = chol(Sigma); % Y = R^{-T}X has...
af958b90456c83bfe247d74de309ab05f79220f3c1d3e7a5066c9876ff17a575
MATLAB
569
21
function shuffledArray = kshuffle(inputArray, DIM) % % shuffledArray = kshuffle(inputArray, DIM) % % Shuffles a matrix by row or column dimension. % % Kian Torab % kian.torab@utah.edu % Department of Bioengineering % University of Utah % Version 1.1.0 - March 4, 2010 switch DIM case 'r...
cf6f8641096a792a0b9b9e91dc412984ad7c3aeed46c12c889a2b523c1661d73
MATLAB
569
16
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 % Guillaume Flandin ...
0c5bfeca552965e5b4fb9c12286f101d2989a9e59006e0d53232e06fac8d09aa
MATLAB
570
19
function ea_chirp(options) if ~exist('options','var') options.prefs=ea_prefs; end try if options.prefs.env.logtime; f=fopen([options.root,options.patientname,filesep,'ea_timelog.txt'],'a'); fprintf(f,[date,': Process took %.2f seconds\n'],toc(options.tic)); fclose(f); end end try ...
2433df9eb2873588725044fb1f89dcad89835e450c22c7df42a45fd89e0c7965
MATLAB
570
12
function ea_convert_spm_warps(subj) % Convert SPM deformation field into ITK format forwardBaseName = subj.norm.transform.forwardBaseName; inverseBaseName = subj.norm.transform.inverseBaseName; if isfile([forwardBaseName, 'spm.nii']) ea_spm_fwd_displacement_field_to_ants([forwardBaseName, 'spm.nii'], [forwardBase...
32d4de441ebb0854b219b519d9d267f26c87c6fccdb1369ceec317cc63c8e57b
MATLAB
570
39
% % computes the principal eigenvector of a [nm nm] markov matrix % % j harel 6/06 function [v,iter] = principalEigenvectorRaw( markovA , tol ) if ( sparseness(markovA) < .4 ) markovA = sparse(markovA); end D = size(markovA,1); df = 1; v = ones(size(markovA,1),1)/D; oldv = v; oldoldv = v; iter = 0; while ( ...
4399edc2ff4f1c7331ede85f2945a7f598660ec6468956249025d75742132b9e
MATLAB
570
35
function y2=ybin(x,bsize) % Usage ynew=ybin(x,binsize) if bsize==1; y2=x; if nargout==0, show(y2), clear y2, end; return; end if prod(size(x))==length(x), x=x(:); end; ydim=size(x,1); iend1=floor(ydim/bsize)*(bsize); if size(x,2)>1, y=x(1:bsize:iend1,:); %[bsize iend1 iend2], for mm=2:b...
4f26794e290ed95a33f2e3138e3c2589bceec5b971447355830d498cfe1201e6
MATLAB
570
22
EXCLUDE_DEMO_TRIALS = 1; COL_TRL = 4; switch TYPE case 'AM' COL_DIR = 7; COL_RESPONSE_DIR = 10; COL_RESPONSE = 11; COL_RESPONSE_INITIAL = 12; COL_TIME_START = 14; COL_TIME_STOP = 15; COL_TIME_RESP = 16; COL_MAX = 16; case 'SFM' ...
bc04b580c2ddc75454d1299cbcd4e6da8506ad713180018bc0b9005a72c0c007
MATLAB
570
22
function epochIdx = indexepochs(epochLength, samples) % Produce a start and end index (in samples) for each epoch in a record, % based on the given epoch length, and the total number of % samples in the record % % Required inputs: % % epochLength = Epoch length in samples % % samples = Total samples in the record % % O...
5adc291a56060cd6e1bd267495bea416b6f6e378e1ad702b82f42a4147bfb0ed
MATLAB
571
21
function [f,df,lambda] = nll_poissPlasticity(bta,X,Yy,opts) % The log of the binned slow rate (opts.rate) is used as a regressor, with the % weight fixed to be 1. Only the basis parameters affect the likelihood and its % gradient. % Coupling component cc = X*bta; % Predicted rate in bins of size dt (can be interprete...
a41cdea000dc83739e724676cd0ae028598cc1e8ee6b7f281b710718a2f1e015
MATLAB
571
21
function ea_gencheckreg(~,~,handles) % function to simply export checkreg figures for selected patients from % Menu disp('Generating check-reg figures for selected patients...'); leadfigure=handles.leadfigure; ea_busyaction('on',leadfigure,'dbs'); options=ea_handles2options(handles); options.macaquemodus=getappdata(...
cdfa8e7786cb9ecb558ed4ebd6125c1880e73bdb6be8b8f1e569c29869e1573f
MATLAB
572
22
% Local Regression and Likelihood, Figure 7.4. % % Censored Local Likelihood % % Author: Catherine Loader % % NEED: this is given problems for unknown reasons. something % to do with censored observations and the ibeta routine. % if i replace this by % res[ZLIK] = th*y-y*log(p) % res[ZDLL] = y*p % res[ZDDLL] = y*p*(1-p...
2d93e29631da900527036ea7a901acb1db053a2ec819c7e8e5f6f7dc5808f118
MATLAB
573
16
function plugin_reactivate(foldername); % get plugin path % --------------- fullpluginfolder = fullfile(fileparts(which('eeglab.m')), 'deactivatedplugins', foldername); if ~exist(fullpluginfolder) error([ 'Could not find folder ' foldername 'in deactivatedplugins folder' ]); end; disp(...
ac4406080afd51f3555b8920277fa125d970763b5e2cb0ea4f7c6860bbf63f21
MATLAB
573
17
function version_number = get_ndt_version % This function returns the neural decoding toolbox version number. % It assumes that the current neural decoding toolbox contains a directory % with the current toolbox version in the path in the form ndt.x.y.z/ curr_function_dirname = which('get_ndt_version.m'); start_in...
4a399256f1c2ff923c264c8530b57527dbf4aef24f87b4bc81d7054b5c8c8327
MATLAB
575
29
function yhat=spence15(y) % function for Spencer's 15-point graduation rule. % set out following Spencer's hand-calculation method, % which isn't the shortest computer program! osev = ones(7,1); n = length(y); y = [ osev*y(1); y; osev*y(n) ]; n = length(y); k = 3:(n-2); a3 = y(k-1) + y(k) + y(k+1); a2 = y(k-2) + y(k+...
5f094ae5807220e7ad3a4dc5917d3393b8af0a38ed2e59127517ffbc8105eecf
MATLAB
575
25
function yhat=lfsmooth(varargin) % % a simple interface to locfit. % output is a vector of smoothed values, at each data point. % all locfit options, except evaluation structures, are valid. % % Example, to smooth a time series of observations, % % t = (1:100)'; % y = 2*sin(t/10) + normrnd(0,1,100,1); % plot(t,y,'.'); ...
8b915ea484a1a4f644af1d01549ad8bc823bf9403fe46cfc37e321a5bb672c53
MATLAB
575
20
function ea_conda_setproxy(proxy) arguments proxy {mustBeTextScalar} = '' % proxy to set end if isempty(proxy) proxy = inputdlg('Set proxy for conda and pip', '', 1, {'http://'}); end if ~isempty(proxy) && ~strcmp(proxy, 'http://') proxy = proxy{1}; else return; end ea_cprintf('*Comments', 'Set pro...
ca6cfa1cb5874dfbb986ea42d715178ab488d209ef6870ba66dc3aec7c993738
MATLAB
575
4
websave(fullfile(basePath,'20170505_396um_0um_merge.lfp'),'https://buzsakilab.nyumc.org/datasets/TingleyD/DT9/20170505_396um_0um_merge/20170505_396um_0um_merge.lfp') websave(fullfile(basePath,'20170505_396um_0um_merge.CA1Ripples.events.mat'),'https://buzsakilab.nyumc.org/datasets/TingleyD/DT9/20170505_396um_0um_merge/2...
0def5e18d2dd0d9f45bfcb7b22e83c42c749e7f6f36a75bc5848e9fe5b2ca3ba
MATLAB
576
14
function varargout = RelPhase_Disc(varargin) %RELPHASE_DISC (deprecated) Use rel_phase_disc instead. % RelPhase_Disc has been renamed to rel_phase_disc. This shim forwards every argument and % output unchanged, so existing scripts keep working, and warns once per % session. % % Silence with: warning('off','RelP...
6bffc1b8c10d43a57c1ccc276f01df974e8af8981b9372676c2bb97f2687ed8c
MATLAB
576
24
function subfun_plot_scatter_regression( x , y , xlim , ylim ) % figure; hold on; % draw mdl = fitlm(x, y); xfit = linspace(min(x), max(x), 200)'; [yhat, yCI] = predict(mdl, xfit); fill([xfit; flipud(xfit)], [yCI(:,1); flipud(yCI(:,2))], ... [0.8 0.8 0.8], 'EdgeColor', 'none'); % 灰色置信区间 scatter(x, y, ...
70047e18a1fa7e0ba01f3b8155ea31fe6743e2721ceaf3681512274f5921c0fa
MATLAB
576
19
function [mu, sigma2] = CBIG_compute_mu_sigma2(stats, idx1, idx2) try % LME beta1 = stats.Bhat(idx1); beta2 = stats.Bhat(idx2); beta1_var = stats.CovBhat(idx1, idx1); beta2_var = stats.CovBhat(idx2, idx2); beta12_cov = stats.CovBhat(idx1, idx2); catch % glmfit beta1 = stats.beta(idx1); beta...
7e7c86c5e46ac8729a445931f602b1dbb27625a0a7968afa4eeeddfc46f9c8e4
MATLAB
576
14
function varargout = RelPhase_Cont(varargin) %RELPHASE_CONT (deprecated) Use rel_phase_cont instead. % RelPhase_Cont has been renamed to rel_phase_cont. This shim forwards every argument and % output unchanged, so existing scripts keep working, and warns once per % session. % % Silence with: warning('off','RelP...
a172227dabd18c61fce4d4b0d0c4e5157af90e25722536ded55d166a9885736a
MATLAB
576
11
%load('SS52244_exp1_5_n7.mat') fr = 44; % first data frame for pfnpc = 40, first for pfnd and pfna = 44 [left right] = alignDataSines(allflies,[6:10],fr); thing = [left{10};right{6};left{9};right{7};left{8};right{8};left{7};right{9};left{6};right{10}]; thing = [thing(:,8) thing]; figure; shadedErrorBar([1:9],mean(...
7241a7ceb3c7f452779f1f82b8a07b40da10784796d65bdd4a3bf27ab049c5ce
MATLAB
577
17
function varargout=ea_normalize_apply_normalization(options) % Wrapper function to apply normalization to pre- an post-op images % % __________________________________________________________________________________ % Copyright (C) 2014 Charite University Medicine Berlin, Movement Disorders Unit % Andreas Horn if isc...
46624a825c76238744c233c6d82a232260d39b12620c9a68c8b898ba9f3c15af
MATLAB
578
11
function tifStimParamTable = stimParams2TifTable(tifFiles) tempStim = load(strrep([tifFiles(1).folder filesep tifFiles(1).name],'.tif','_Pulses.mat')); tempParams = extractStimParams(tempStim.params, tempStim.pulse); tifStimParamTable = cell2table(struct2cell(tempParams)','VariableNames',fieldnames(tempParams)); ...
4ab0419d53095cbc7f7b90108f7e6f28002ab41dee61770a825497b6909f534f
MATLAB
579
17
function p = parent(tree,uid) % XMLTREE/PARENT Parent Method % FORMAT uid = parent(tree,uid) % % tree - XMLTree object % uid - UID of the lonely child % p - UID of the parent ([] if root is the child) %__________________________________________________________________________ % % Return the uid of t...
53534e3d3c221d2eef63bbe57b6701261c78547f58a2599a6a6c98340974c115
MATLAB
579
17
function filename = getfilename(tree) % XMLTREE/GETFILENAME Get filename method % FORMAT filename = getfilename(tree) % % tree - XMLTree object % filename - XML filename %__________________________________________________________________________ % % Return the filename of the XML tree if loaded from disk and an em...
5b005fb8155ee07326db9e2e6d78702446c8741dee3287db4d4b348d986b090d
MATLAB
579
24
function y0 = invlink(y,fali) % inverse link function for locfit. % y is a vector of raw fitted values. % fali is the integer [family link] vector from locfit. % output is the inv. link. link = fali(2); switch(link) case 3 % identity y0 = y; case 4 % log y0 = exp(y); case 5 % logit -...
5f3dafa38e6bad0445866cc5fb168797dc49d0079a6c9586471ffa0fd0bbc502
MATLAB
579
29
function ea_dcm2niix(dicomdir, outdir) % Wrapper for dcm2niix if nargin < 2 outdir = dicomdir; end if ~exist(outdir, 'dir') mkdir(outdir); end ea_libs_helper; basedir = [fileparts(mfilename('fullpath')), filesep]; dcm2niix = ea_getExec([basedir, 'dcm2niix'], escapePath = 1); if strcmp(outdir(end),filesep...
95a485875b5342949fa338a97be1194d26b66ceb9f2699b511e9605ef54cbed7
MATLAB
579
22
function [handles, data2plot] = dan_scale_psg_data(handles, data2plot) % Scale the data so that it plots correctly with one channel above the next % etc %% % Authors: Dan Denis % Date: 2021-07-14 %% for chan_i = 1:size(data2plot, 1) scaledData(chan_i,:) = data2plot(chan_i,:) * -1; if isempty(get...
68a7d3a8b44333a21452ac7b5c38d12dfce424f41da2ea62e7e4447b675369f1
MATLAB
580
29
function [mrs nii_orig] = ea_DPS_nifti_to_hardi(niiName,bvecname,bvalname) nii_orig = ea_load_untouch_nii(niiName); nii = nii_orig; mrs = ea_DPS_nifti_to_mrs(nii); if nargin == 1, bvec = importdata([niiName(1:end-3), 'bvec']); bval = importdata([niiName(1:end-3), 'bval']); else bvec = importdata(bvecname...
d2efe4ae21661ef772585bdb635f830bc662e49c802d0ccdcad07db86c864414
MATLAB
580
29
function [] = gen_pep_barplot(PEP, models, outpath) % generate barplot for models protected exceedance proabilities if nargin > 2 ifSave = true; else ifSave = false; end nModels = numel(models); f = figure; ax = axes; bar(ax, PEP, 'FaceColor', [.5, .5, .5]); xlims = [0.25, nModels+.75]; xlim(ax, xlims); xtic...
6e424697c086e2a0dd1dadb8a95e6e7b80e0eaa85a13ebe78b729aded08c9705
MATLAB
581
30
function [coeff meanval_sq] = computeFiberCorrelation(bDir,bD) n = size(bDir,2); C = abs(bDir'*bDir); Q = exp(-bD * C.^2); Q = Q - repmat(mean(Q),[size(Q,1) 1 ]); P = Q*Q; [alpha idx] = sort(C(:)); beta = P(idx); nfac = sqrt(beta(end)); beta = beta / nfac^2; Q = Q /nfac; meanval_sq = 0; %sum(Q(1,:))^2/n; %beta ...
336edd7d96a4ae1a00cca774b5a511ae5ab544211a75f699c249621f7f34bce1
MATLAB
583
16
function bool = onoff2bool(onoff) %ONOFF2BOOL Substitutes 1 for 'on' and 0 for any other string. % BOOL = ONOFF2BOOL(ONOFF) returns logical 1 if ONOFF is equal to the % string 'on' and logical 0 otherwise. % % BOOL2ONOFF and ONOFF2BOOL improve readability for Matlab settings % (e.g., Handle Graphics prop...
5f369d3cf73d899daa400b209e5fe0627d4742a330937079f00844971edd8744
MATLAB
583
18
function obj=geom_funline(obj,varargin) % geom_funline Display a custom curve in each facet % % Example syntax: gramm_object.geom_funline('fun',@(x)3*sin(x),'style','k--') % The 'fun' argument allows to pass an anonymous function to % plot p=inputParser; my_addParameter(p,'fun',@(x)x); my_addParameter(p,'style','k--')...
8148470addae8227a5c91e52b43201d8ff169e119f44b7e9adf63146bca52536
MATLAB
583
23
function y=myaffine2d_label(im1,xx,imsize,mask) % Usage ... y=myaffine2d_label(labelim1,[x0,y0,r0,sx0,sy0],imresize) % % Uses translation, rotation and scaling of im1 % if im2 is included in imresize then im1 is rescaled to match im2 first athr=0.7; for mm=1:max(im1(:)), tmpim1=double(im1==mm); tmpim2=my...
c33528445c4487a68413eea6d1fcb10d3b381b30bb5aac0e374305edf1058d2a
MATLAB
583
26
function [w_ent] = ent_weighted(wrp) N = length(wrp); % get size of the weighted recurrence plot for j = 1:N si(j) = sum(wrp(:,j)); % compute vertical weights sums end % Compute distribution of vertical weights sums si_min = min(si); si_max = max(si); bin_size = (si_max - si_min)/49; % compute bin size count = 1; ...
48f279d4939190160e703fef12b281a385964633585ac01274d79a636a931a17
MATLAB
584
20
function y = pow_pos( x, p ) %POW_POS Internal cvx version. narginchk(2,2); if ~cvx_isconstant( p ), error( 'Second argument must be constant.' ); elseif ~isreal( p ), error( 'Second argument must be real.' ); end p = cvx_constant( p ); if nnz( p < 1 ), error( 'Second argument must be greater than or eq...
a6205a76fb93f9ceb302f0227f90a6f333db17af3f4bfe2c1ca87afb67ee5326
MATLAB
584
29
function X=ea_graphvarmat2mat(txtfname,parcellation) parcfid=fopen([ea_space([],'labeling'),parcellation,'.txt']); labA=textscan(parcfid,'%f %s\n'); labels=labA{2}; X=nan(length(labels)); d=dir(txtfname); for fi=1:length(d) fid=fopen(d(fi).name); A=textscan(fid,'%s'); M=cellfun(@str2double,A{1}); top...
fe6c7f5968fb134447599b403ad164c613cd669761db68ba17f2603403586edd
MATLAB
585
27
function yhat=spence21(y) % function for Spencer's 21-point graduation rule. % set out following Spencer's hand-calculation method, % which isn't the shortest computer program! oten = ones(10,1); n = length(y); y = [ oten*y(1); y; oten*y(n) ]; n = length(y); k = 4:(n-3); y1 = -y(k-3) + y(k-1) + 2*y(k) + y(k+1) -y(k+3...
111d9deac7db8e553cf6978af2d3ba027df05704977399be0dcee9e3c517ccbd
MATLAB
586
30
function C = cmult(A,B,idxA,idxB) szA = size(A); szB = size(B); szA = [szA ones(1,max(idxA)-length(szA))]; szB = [szB ones(1,max(idxB)-length(szB))]; if nargin == 2, idxA = length(szA); idxB = 1; end; permA = 1:length(szA); remainA = setdiff(permA,idxA); permA = [remainA idxA]; permB = 1:length(szB); rem...
b45038742cf10a9e1c55923d9cb619c3dd31850b9eb79e4dc51738b34ec53193
MATLAB
586
22
function K = kuratowski_subgraph(A,varargin) % KURATOWSKI_SUBGRAPH Identify a Kuratowski subgraph % % K = kuratowski_subgraph(A) is just a wrapper around the % boyer_myrvold_planarity_test to get the subgraph as the first output % argument. % % K is empty if the graph A is planar. % % Example: % A = clique_graph([...
c74ef1e7e7d971c7a382bf1b2bd57917a13446136172a3d633f505a9d14defec
MATLAB
586
24
function iscoreg=ea_seemscoregistered(options) % function checks if all anatomical images in folder are coregistered or % not. iscoreg=1; directory=[options.root,options.patientname,filesep]; [~,presentfiles]=ea_assignpretra(options); if length(presentfiles)==1 % only one anatomical image present, nothing to coreg...
760085f43eaf01c6341f5cf805c4f7c72fb09cad6f9b687e64d8e39b97a95e65
MATLAB
587
19
function [P bins] = ProbDist1D(x, nbins); %PROBDIST1D % Usage: [P bins] = ProbDist1D(x, nbins); % % This function calculates the discrete probability distribution for a % variable that is in a one dimensional phase space. It is simply a % normalized histogram using 'hist', so nbins can take any form that hist % can...
e16f8849fde2fd31e7f98897dfe31016886d58974b968a1c1234add514246e38
MATLAB
587
23
function ea_settransparency(resultfig,togglestates) xsliceplot=getappdata(resultfig,'xsliceplot'); ysliceplot=getappdata(resultfig,'ysliceplot'); zsliceplot=getappdata(resultfig,'zsliceplot'); if ~isempty(xsliceplot) if isvalid(xsliceplot) set(xsliceplot,'FaceAlpha',togglestates.xyztransparencies(1)) end ...
6374e8467129d2d658aeab7c66b67645dd2db76e925453c061b1fba44811a232
MATLAB
588
9
%----------------------------------------------------------------------- % Job saved on 30-Apr-2018 13:45:07 by cfg_util (rev $Rev: 6460 $) % spm SPM - SPM12 (6470) % Written by Nanbo Sun and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md %-------------------------------------------...
798d9f08fd9b6ddff961a4203a62b571328b7f813b174373d3973547df1cefdf
MATLAB
589
21
function h = createStopButton hmain = gcf; pos = get(hmain,'Position'); h = figure(539375677); %set(handle,'title','FiberGT Progress Control'); set(h,'NumberTitle','off'); set(h,'resize','off'); set(h,'MenuBar','none') set(h,'ToolBar','none') set(h,'Tag','stopbuttonpresent'); set(h,'Name','Progress Control'); set(h,'P...
d2476d4c49afc214d5dbaaf136fae7d1fe19e2529f78d1ce1f08d5d938fce644
MATLAB
589
29
function [ element_num, element_order ] = gmsh_mesh2d_element_size_example ( ) %*****************************************************************************80 % %% GMSH_MESH2D_ELEMENT_SIZE_EXAMPLE: element size information for the example. % % Licensing: % % This code is distributed under the GNU LGPL license. % ...
52d559f42d617d5d6084019b516359969a6331538098e36660a00e797b8ba252
MATLAB
590
19
function intersect=TriangleTriangleIntersection(P1,P2,P3,O1,O2,O3,ignore_corners) for i=1:6 switch(i) case 1 A=P1; B=P2; C=P3; E1=O1; E2=O2; case 2 A=P1; B=P2; C=P3; E1=O2; E2=O3; case 3 A=P1; B=P2; C=P3; E1=O3; E2=O1; case 4 ...
9b7128904f878b0d5132d3f01b9115ad557f81834d13f3d6e66131afebf44662
MATLAB
590
15
fileexpnum = '21D07-g7_Mar2822_f1e4'; %thor expt root name trlcat = 1; zsplit = 0; skip_mc = 0; [trl_dirs_corr, FOV] = NDK_Motion_Correction5D(fileexpnum, trlcat, zsplit, skip_mc); save('regroi_vars.mat', 'trl_dirs_corr', 'FOV') %save so can run register_rois without motion correction, if need to % load regroi_te...
220d372a186aec68276b17fd11137b31cca910c9b2d24b165d37dfe368af287e
MATLAB
591
21
function out = ittikochmap( img ) params = makeGBVSParams; params.useIttiKochInsteadOfGBVS = 1; params.channels = 'CIO'; params.verbose = 1; params.unCenterBias = 0; % % uncomment the line below (ittiDeltaLevels = [2 3]) for more faithful implementation % (however, known to give crappy results for small images i.e. ...
2e578002dc0e687b7c4b6b18b5dc7585bb577b2f6618678e545ac525939269a6
MATLAB
591
32
function ea_archivefolders(hobj,evt,cmd,handles) options = ea_handles2options(handles); options.uipatdirs = getappdata(handles.leadfigure, 'uipatdir'); options.leadprod = 'dbs'; setappdata(handles.leadfigure,'handles', handles); options.leadfigure = handles.leadfigure; for pt=1:length(options.uipatdirs) disp(...
8ecd5a1d87c884fd4106329153ed7c98784420a46b0125e953f28f4928664926
MATLAB
591
21
function dff = getdff(trace) if ~isempty(trace) f = quantile(trace,0.4,1); % This seems to work nicely for most signals, but it may need to be changed for highly active cells fmean = mean(trace,1); b = ones(1, size(trace,2)); th = max(trace,[],1)*0.01; dff = []; for k = 1:size(trace,2) i...
bc4ad59e4c464b5b5299db2328dda3bf3415e8f3acb714a1c405e9524c8f7440
MATLAB
591
30
function i4mat_transpose_print ( m, n, a, title ) %*****************************************************************************80 % %% I4MAT_TRANSPOSE_PRINT prints an I4MAT, transposed. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 10 September 2009 % % Author: % %...
f201dc2c954a7bd7ba39b16acc01f1b869c5c64aba72656957b05ffbd379b112
MATLAB
592
21
function [chan] = bz_GetBestRippleChan(lfp) %[chan] = bz_GetBestRippleChan(lfp) %eventually this will detect which lfp channel has the highest SNR for the % ripple componenent of SPWR events.... [b a]=butter(4,[140/625 180/625],'bandpass'); for i=1:length(lfp.channels) filt = FiltFiltM(b,a,single(lfp.data(:,i)))...
64b4acb5651c6a3dcdbe3f194395449e1b44ed18fab812e2355e7ee282c4c620
MATLAB
593
17
function out=ea_arenopoints4side(coords_list, side) %returns true if there are no valid points for this side (if points is empty or if it is all nan) %this is helpful for determining if it is a valid side with .coords_mm, .coords_acpc, .trajectory %Enrico Opri, 2020 %this assumes hardcoded R side a...
f921ac18ded46b077aa3f3ab4b7a5c748c51eef181098e411f9c791ca74c6170
MATLAB
593
21
function output_cell = CBIG_MMLDA_matrix2cellstr(input_mtx) % output_cell = CBIG_MMLDA_matrix2cellstr(input_mtx) % % Tranform an array to a cell array. % % Input: % - input_mtx : input matrix % % Output: % - output_cell : ouput cell array % % Example: % input_mtx = [1, 2]; % output_cell = CBIG_MMLDA_matrix...
39152b98fbe579bae1a26a0f031562bf5eb6f84be2fdba8e2d3b375cddba77fc
MATLAB
594
19
function [ y, symm ] = cvx_s_symmetric_ut( m, n, symm ) %CVX_S_SYMMETRIC_UT Symmetric matrices (upper triangle storage). if m ~= n, error( 'Symmetric structure requires square matrices.' ); end symm = false; nsq = n * n; ntr = 0.5 * ( nsq + n ); c = 0 : n - 1; c = c( ones( 1, n ), : ); r = c'; mn = min( r, c...
8da4166fa10773ac17d27d2f0bd57e60bf065c68fc61c939eb7e6a0449d2849a
MATLAB
594
19
function [ y, symm ] = cvx_s_symmetric( m, n, symm ) %#ok %CVX_S_SYMMETRIC Symmetric matrices (lower triangle storage). if m ~= n, error( 'Symmetric structure requires square matrices.' ); end symm = false; nsq = n * n; ntr = 0.5 * ( nsq + n ); c = 0 : n - 1; c = c( ones( 1, n ), : ); r = c'; mn = min( r, c ); m...
92466d30aedb3f00bf89c4118e7cc3c010c7a3e906dbc3f46b5f51a0297cc8b3
MATLAB
594
22
% Local Regression and Likelihood, Figure 7.4. % % Censored Local Likelihood % % Author: Catherine Loader % % NEED: this is given problems for unknown reasons. something % to do with censored observations and the ibeta routine. % if i replace this by % res[ZLIK] = th*y-y*log(p) % res[ZDLL] = y*p % res[ZDDLL]...
b710a5d39bde4e0f03b1ebb2545cf4113c727980d284951f62d291527f2dbcdb
MATLAB
594
22
function varargout=volface(t) % % [openface,elemid]=volface(t) % % find the surface patches of a volume % % author: Qianqian Fang, <q.fang at neu.edu> % date: 2009/10/13 % % input: % t: input, volumetric element list, dimension (ne,4) % % output: % openface: list of faces of the specified volume % elemid...
dc757255923c2bdd7346f4625132094974c9dbc19247957a818ab829f8c4256b
MATLAB
594
21
function ea_bias_field_correction(inputimage) % Wrapper for ANTs N4BiasFieldCorrection ea_libs_helper; basedir = [fileparts(mfilename('fullpath')), filesep]; N4BiasFieldCorrection = ea_getExec([basedir, 'N4BiasFieldCorrection'], escapePath = 1); cmd=[N4BiasFieldCorrection, ... ' --image-dimensionality 3' ... ...
117aef0aa477fdb2ae9af32a5a1da16e262ca56f4ba6787fa4f0a2a38494f601
MATLAB
595
23
% Local Regression and Likelihood, Figure 7.6. % % Estimating the mean survival time using a local weibull % (transformed Gamma) model. load heart; z = 0.625; ts = (surv+0.5).^z; fit = locfit(age,ts,'cens',cens,'family','gamma','nn',0.8); i = find(cens==0); figure('Name','fig7_6: mean survival time local weibull'); pl...
24685efd3d3077e0f00d8a54d3936be749ea6e8725a13ed39b972f6e9933ebb1
MATLAB
595
37
function [V,E] = quadinv(N,NW) % calculates the quadratic inverse eigenvectors % % Input % N: number of samples % NW: time-bandwidth product % % Output % V: The quadratic inverse eigenvectors % E: the quadratic inverse eigenvalues x = 0:N-1; indx = find(x); y = ones(size(x))*(2*NW/N)^2; y(indx) = (...
86665368b32ee421ec899e038f14f9c858fa0f428def7655f85662540af875f6
MATLAB
595
16
if ismac compflags = ''; elseif isunix compflags = 'COMPFLAGS=''$COMPFLAGS -static-libstdc++'''; elseif ispc compflags = 'COMPFLAGS="$COMPFLAGS /MT"'; end mex(compflags, 'AccumulateBilin.cpp'); mex(compflags, 'AccumulateBilinWeighted.cpp'); mex(compflags, 'anisoDiffusion.cpp'); mex(compflags, 'anisoDiffusionH...
aa1d7c91b2963a8894aac07cdd65e6d70f94be80643b6241eaad74333faaacea
MATLAB
595
19
function fieldExist = myIsField(inStruct, fieldName) % inStruct is the name of the structure or an array of structures to search % fieldName is the name of the field for which the function searches fieldExist = 0; f = fieldnames(inStruct(1)); for i=1:length(f) if(strcmp(f{i},strtrim(fieldName))) fieldExist ...
043aaee7c6da9be7971fce9ff8560db347d6877be0059ee35d036ff6a29941e1
MATLAB
596
17
function filename = getfilename(tree) % XMLTREE/GETFILENAME Get filename method % FORMAT filename = getfilename(tree) % % tree - XMLTree object % filename - XML filename %__________________________________________________________________________ % % Return the filename of the XML tree if loaded from disk a...
80285f9e43c1684dc9f9e6b1c51740acfea7f37c2225749be9e7d26990951ba2
MATLAB
597
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 % ___________________________________...
4fdaf14a743416cd327256aa1659bfeb866ab9de4e5ff1b310682f77b94a6441
MATLAB
598
23
function w = rcoswin(N) %RCOSWIN Raised cosine window. % % IOSR.DSP.RCOSWIN(N) returns an N-point raised cosine window. % % See also GAUSSWIN, CHEBWIN, KAISER, TUKEYWIN, WINDOW. % Copyright 2016 University of Surrey. assert(isscalar(N) && round(N)==N, 'iosr:rcoswin:invalidN', 'N must be a scalar and w...
abb643ddd42e5965eda3195f53f1109e212995235acb9038c278f89472c4b33a
MATLAB
598
16
%% convertMedtronicCoordToLPI - be careful with that % % Andreas Husch % Centre Hospitalier de Luxembourg, Dept. of Neurosurgery / % University of Luxembourg - Luxembourg Centre for Systems Biomedicine % 2014 - 2017 % mail@andreashusch.de, husch.andreas@chl.lu function pointsLPI = convertMedtronicCoordToLPI(pointsInMm,...
01a3c824071986e41b52052eac07311b48a06f65397cb8c25d483f447d690922
MATLAB
599
13
% std_findoutlierclust() - determine whether an outlier cluster already exists % for a specified cluster. If so, return the outlier cluster index. % If not, return zero. This helper function is called by % pop_clustedit(), std_moveoutlier(), std_renameclust(). funct...
0e6749ead2412edaafb2583eba51934e656c1a2b863914389d9d10eba142ab96
MATLAB
600
16
function sels=ea_storeupdatecortex(jtree,h) for root=1:length(h.sg) for branch=1:length(h.sgsub) %side sels.branches{branch}=h.sgsub{branch}.getSelectionState; for leaf=1:length(h.sgsubfi{branch}) sels.leaves{branch}{leaf}=h.sgsubfi{branch}{leaf}.getSelectionState; if isfiel...
9bd8a9e85493643ab257c992db379a3fdf0443fac1813deafac3cbc2e36e7887
MATLAB
600
16
% List of open inputs % Population to ICBM Registration: Dartel Template - cfg_files % Written by Nanbo Sun and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md addpath(spm_dir) nrun = 1; % enter the number of runs here jobfile = {[script_dir '/CBIG_MMLDA_population_to_ICBM_job.m']};...
f677cbe4d46eeda859e8bfa7f67fdd45885ef29944bc2444fba8d96013459193
MATLAB
600
20
function worked = next(vr) %WORKED=NEXT(VR) % Advances to the next frame in the video. Returns 0 if the next frame is % not available. % % After the videoReader constructor is called, NEXT, SEEK, or STEP should % be called at least once before GETFRAME is called. % % See videoReader/getinfo for more details on...
3f934c04544cb413eb01d341ddfd160d985c0c456d925af4eb668f968cfe64c9
MATLAB
602
22
function [power_spectrum, power_spectrum_norm] = calc_power_spectrum(data) % calc_power_spectrum.m % % Calculate spatial power spectrum from eigenmode analysis % % Inputs: data : data [NxP] % N = number of modes, P = number of independent data % % Outputs: power_spectrum ...
845bf2fb5511ed59c16c08867028770168fac461d2addced733437ec54fe5155
MATLAB
602
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 (int32) % val - the read values % % This function is normally called by file_array/subsref % ______________________________...
3d094312854042af080a1967432db02b3d13db52e463764d6fd5ab4291ab1a62
MATLAB
603
24
function y0 = invlink(y,fali) % inverse link function for locfit. % y is a vector of raw fitted values. % fali is the integer [family link] vector from locfit. % output is the inv. link. link = fali(2); switch(link) case 3 % identity y0 = y; case 4 % log y0 = exp(y); case ...
c9b96ba679e37a1d0b24cbc58c26a8e593a4a3deaddf7b0fc8791a02b8878058
MATLAB
603
18
function s = struct(this) % Struct method for GIfTI objects % FORMAT s = struct(this) % this - GIfTI object % s - a structure containing public fields of the object %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % Guillau...
e242cd718a9d02c3b259d634b7bb92aae160c1ed09da46d1435b4f1fc990e898
MATLAB
603
19
function logprobs = getLogProbsGMM(model, metrics, comps2Use) % Compute log probabilities for feature vectors under a supplied GMM, with % the logprob computed using the desired number of GMM components if nargin < 3 comps2Use = 1:model.NumComponents; end % Compute likelihoods % Full mixture LLR for all neurons N...
0cd4c94676c658b5f343b802540e19b59b0aeb688a61e02ea94689ea7ee6394e
MATLAB
605
17
function [n, npw, ts, wave] = plx_waves(filename, ch, u) import CMBHOME.PLX2Mat.* % plx_waves(filename, channel, unit): Read waveform data from a .plx file % % [n, npw, ts, wave] = plx_waves(filename, channel, unit) % % INPUT: % filename - if empty string, will use File Open dialog % channel - 1-based channel numbe...
45d952d7409267902d63797a12459e4cfde7ce71e25258977dd996a9fd4044ed
MATLAB
605
29
%%%% % specifiy here the norm used for the likelihood % chi2 = (S-M)'*W*(S-M) %%%% function [W Q] = createWeightingScheme(ten,bweight) % be careful: not really included in the hashnum (sometimes there is an ambig.) so you have to rm -r /tmp/mesoGT/* b = squeeze(ten(1,1,:) + ten(2,2,:) + ten(3,3,:)); % for the mo...
5fd9969bfa68f76a9ff6b0e7ba8a5c9ad6f1f9a1b07c442b07196cb3bd4a77e6
MATLAB
605
26
function [ft, w] = ctfft(f, t) % ctfft.m % % Calculate continuous fourier transform using FFT % % Inputs: f : function to take fourier transform [1xT] % T = length of time % NOTE: f must be centered around 0 % t : time vector [1xT] % % Outputs: ft : Fourier transform of function ...
8d8f783b1230f97648266adb1146b92a09479db527ab6d0a27a9cddf4c2bbf7e
MATLAB
605
19
function coordsmm=ea_read_fiducials(path,options) % Small function to read fiducials (coordinates of electrode contacts) in % Slicer3 format. % __________________________________________________________________________________ % Copyright (C) 2014 Charite University Medicine Berlin, Movement Disorders Unit % % Andreas ...
c5b1174182b15b9362cf72f40c13de21a269bbb6ac7bcc812a1e72c37cc32a41
MATLAB
605
19
function [P bins] = ProbDist1D(x, nbins); %PROBDIST1D % Usage: [P bins] = ProbDist1D(x, nbins); % % This function calculates the discrete probability distribution for a % variable that is in a one dimensional phase space. It is simply a % normalized histogram using 'hist', so nbins can take any form that his...
0f32f7738df1a2dedba1cd2ca089de9590a4f5fcf3b68022849d9dfb4abbfb45
MATLAB
606
23
% Local Regression and Likelihood, Figure 2.6. % % Influence and variance functions. load ethanol; d = [2 3]; a = [0.49 0.59]; main = {'Local Quadratic','Local Cubic'}; f=['a','b']; for (i=1:2) figure('Name', sprintf( 'figure2_6%c: Influence and variance functions', f(i) ) ); fit = locfit(E,NOx,'nn',a(i),'deg',d(i...
29c5785ec6fba1200f72a585db519540e8577f488a48671688b4213cd350aafe
MATLAB
606
23
function z = svec( x, nrm ) if nargin < 2 || isempty( nrm ) || isequal( nrm, 'fro' ), nrm = 2; elseif ~isnumeric( nrm ) || length( nrm ) ~= 1 || nrm < 1, error( 'Second argument must be a number between 1 and Inf, or ''fro''.' ); end if ~isreal( x ) && nrm ~= 2, z = vec( x ); return else [ xR, y ]...
47a9cb087578a4fda6eadcae3bb8683d5d527c4be67e39918c8b1fb27c6e7c40
MATLAB
606
20
function montage = dan_empty_montage(psg) %% % Authors: Dan Denis % Date: 2021-07-14 %% % Fill montage struct with default info montage.chanList = psg.chans; montage.hideChans = []; montage.showChans = {psg.chans.labels}'; montage.reref = cell(length(psg.chans), 1); ...