sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
ccb665a1dafb664917bfd33e6312d64b9284ec0e300c55c8757416c18310d69a
MATLAB
260
7
function structName_avgWinProb = CBIG_sortByAvgProbWinningFactor(label_structName_avgWinProb) avgWinProb = cell2mat(label_structName_avgWinProb(:, 3)); [~, ind] = sort(avgWinProb, 'descend'); structName_avgWinProb = label_structName_avgWinProb(ind, [2 3]);
fd6dc13718d90ce097506377fa696489416f143be29a174866bb3f2d477ca813
MATLAB
260
12
function listing = dir_without_dots(varargin) if nargin == 0 inputFolder = pwd; elseif nargin == 1 inputFolder = varargin{1}; else error('Too many input arguments.') end listing = dir(inputFolder); listing(startsWith({listing.name}', '.')) = [];
5e00af615e03750bb51e03954fc2142186531f96e92b1bc4a55d20640dea25d2
MATLAB
261
7
% SPIKES % % Files % GetSNR - it would be nice to write something like this for the new file format....? % IsolationDistance - IsolDist = IsolationDistance(Fet, ClusterSpikes, m) % L_Ratio - [L, Lratio] = L_Ratio(Fet, ClusterSpikes)
9004978efe7e1380fabe98bfd866cdebb82f68dbbec55041425228d6c636a44d
MATLAB
262
7
function y = subsref( x, S, cheat ) global cvx___ y = subsref( cvx___.problems( x.index_ ), S ); % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
e9eba86d3d44edd8712f39722c5edb328af4ddc0c67bb94ac80a27937a9f5e2e
MATLAB
262
6
function x = cvx_collapse( x, keeptemp, tocell ) x = cvx_collapse( x.value_, keeptemp, tocell ); % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
0deb5c91b11d4434bb3654d427c0416c6f2d786cbe9dcbc6bb1fb336494b8ad6
MATLAB
265
7
function circularfit fmodel = fittype('a*exp(kappa*(cos(x-mu)-1) ) / (2*pi*besseli(0,kappa,1))',... 'independent', 'x'); xx = min(abs(mu-x), mu+2*pi-x); y = exp(-xx.^2/(2*1^2)); figure, plot(x, y) [fitobject1, gof1] = fit(x', y', fmodel, 'Startpoint', [1,1,1]);
2917e5e8a1f900dfd4f9344064210a3b889e49fb1bddb98ca3dd9aa44066c51a
MATLAB
265
9
% Local Regression and Likelihood, Figure 4.4. % Author: Catherine Loader % % AIC plot for a local poisson regression. load mine; a = (0.4:0.05:1)'; figure('Name','fig4_4: AIC plot for local poisson regression' ); aicplot(a,extrp,frac,'family','poisson','deg',1);
44997fa83b26212cd356feba143b22200919d76253c4c264457d96580b5d4d0f
MATLAB
265
11
function roi=ea_struct2roi(s,resultfig,ht) s.plotFigureH=resultfig; s.htH=ht; roi=ea_roi; props = fieldnames(s); for p = 1:numel(props) if ~ismember(props{p},{'controlH','plotFigureH','patchH','toggleH','htH'}) roi.(props{p})=s.(props{p}); end end
6a341c85172e67ab15719e58eafcddab455bc1571dc5b0261d7a5d981fcae3c6
MATLAB
265
10
% Local Regression and Likelihood, Figure 4.1. % Author: Catherine Loader % % Local Likelihood (Poisson Regression). load mine; fit = locfit(extrp,frac,'family','poisson','deg',1,'alpha',0.6); figure('Name','fig4_1: Poisson Regression'); lfplot(fit); lfband(fit);
93ae103c1204efdff28cd1a6c30cf72e076d09425d31bcceb0023d731391a7e5
MATLAB
265
11
% Local Regression and Likelihood, Figure 9.1. % % Hardle's Motorcycle accelaration dataset. Just a scatterplot! % % Author: Catherine Loader load mcyc; figure('Name','fig9_1: motorcycle scatterplot'); plot(time,accel,'.'); xlabel('Time'); ylabel('Acceleration');
9e34c000d0b4626ad1d42240f464764fe090b4af5a9b234fcf31574fc6ef435a
MATLAB
265
10
% DECOMMENT remove comment from a single line % % DECOMMENT('# this is a comment') returns ''. % % DECOMMENT('key = "value" # comment') returns 'key = "value"'. function out = decomment(in) all_parts = splitby(in, '#', {'"', ''''}); out = all_parts{1}; end
a467b1dc1d8fc213adc690d5e600fd665d720f92e8df23899562ec95eee6e0e8
MATLAB
265
9
function y = var( varargin ) %STD Internal cvx version. y = square_pos( std( varargin{:} ) ); % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
a87a7391922e2b2170cebd2924f889700aab98fb65e314df16ea55c3f7ead2d4
MATLAB
266
7
function y = cvxaff( x ) global cvx___ y = subsref( cvx___.problems( x.problem_ ).duals, x.name_ ); % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
9ab139db3b2aadb722031c1f9b6ae794af1fea9508eb16176c0762413c87e743
MATLAB
267
10
function X = poly_detrend_cols(X, degree) %NIRSPROC.POLY_DETREND_COLS Column-wise polynomial detrend. % X = POLY_DETREND_COLS(X, degree) t = (1:size(X,1))'; for k=1:size(X,2) pc = polyfit(t, X(:,k), degree); X(:,k) = X(:,k) - polyval(pc, t); end end
75fd2eb40c7490c8390ee9e37ffce1f6e3eba0b69efc3187e650bb78ba0b1fe2
MATLAB
268
15
function [ a ] = cell2mat2( b ) % cell2mat, but rotates vectors where 90* off if iscell(b) if ~(all(cellfun(@(x)size(x,1),b)==size(b,1))||all(cellfun(@(x)size(x,2),b)==size(b,2))) b = b'; end a=cell2mat(b); else a=b; end end
8911e112f92264e4178f1390ed3d5288abc9684405d57fda97bf7df05cb10efe
MATLAB
268
7
function disp( x, prefix ) %#ok if nargin < 2, prefix = ''; end disp( [ prefix, 'cvx base object' ] ); % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
898bd3392a365be3a9142eb8787ed44830748dc0871bc9d85176433a0b4fdaeb
MATLAB
268
8
function fig = configureFigureToPDF(fig,figName) setOpts = {fig,'RendererMode','manual','Renderer','painters',... 'PaperOrientation','landscape','Color',[1,1,1]}; if exist('figName','var') setOpts = cat(2,setOpts,{'Name',figName}); end set(setOpts{:}); end
b01966a0ddce4b40ded6d6edd5a18b8c7bead5d50f3012e48e856935764eca4a
MATLAB
268
7
function y = cvx_value( x ) global cvx___ y = cellfun( @cvx_value, x, 'UniformOutput', false ); % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
d7889b1f790f4ff68a30a0c90f66569cdd97da50bc495dfa203f92bbc7be262d
MATLAB
268
16
function nx=ea_vecnorm(x,p) % Vector / matrix norm. % This is a work-around for missing `vecnorm` function prior Matlab 2017b. if nargin<2 p=2; end if isvector(x) nx=norm(x,p); else nx=x; for i=1:size(x,2) nx(:,i)=norm(x(:,i),p); end end
ea4a8454e7e61c03a9e11956983f87ed719031c22218b1c8ca8951d6c5463253
MATLAB
268
8
function ret = myendswith(string, ending) %endsWith needs java, but we only need one string+pattern at a time... if length(ending) > length(string) ret = false; else ret = strcmp(string((end - length(ending) + 1):end), ending); end end
fadc519bc8ed9f81e71255cd04d6567fc87fa861b7e7a42b9f453751c4bc1f28
MATLAB
268
9
[nvar, names, types] = nex_info('test.nex'); [n, ts] = nex_ts('test.nex', 'neuron1'); [adfreq, n, ts, fn, d] = nex_cont('test.nex', 'continuous1'); [adfreq, n, ts, nf, w] = nex_wf('test.nex', 'wave1'); [n, nm, nl, ts, names, m] = nex_marker('test.nex', 'marker1');
24fa3925b9a8895f1f4846799c173a7313d226df8e86beb01acc8b9f2fc5d8e9
MATLAB
269
11
function ip=subsasgn(ip,S,B) % INPLACE/SUBSASGN Support Matlab subscript assignment % % This function supports subscript assignment just like Matlab matrices. % % Example: % ipa = inplace(cumsum(ones(5,1))); % ipa([2 4]) = 1; % ipa ip.subsasgn(S,B);
51f7a0dbf062958d45dcce3fab1acf37dbaa93a118eb68579e0fea2dc3ade14f
MATLAB
269
13
function data = gaus_smooth(times, range, sigma) %¸ß˹ƽ»¬ number_of_times = length(times); data = zeros(size(range)); for i = 1:number_of_times data = gaussmf(range,[sigma, times(i)]) + data; end data = data/(sigma*(pi*2)^0.5);
616f820683f5565a43acae1bde3b4e3de5142a229e3342a9b4385d52f9da225f
MATLAB
269
8
function y = cvx_subsref( x, varargin ) temp.type = '()'; temp.subs = varargin; y = subsref( x, temp ); % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
631d4ad9062cb0c249dade937034c9ca7d52ffa87581bac8f3da67563791edcf
MATLAB
269
12
function out = ndims(fa) % Number of dimensions %_______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: ndims.m 1143 2008-02-07 19:33:33Z spm $ out = size(fa); out = length(out);
8a3a6f7101f65fbcb2f7a135770bc6e51dafd8f2832cf0e19465ecdad7a4f08c
MATLAB
269
14
function calcRadius4rtst(im,maskim,rang) arange=[-20:2:20]; for mm=1:length(arange), tst(mm)=calcRadius4(im,maskim,rang+arange(mm)); tstr1(mm)=tst(mm).D(1); tstr2(mm)=tst(mm).D(2); end; subplot(211) plot(rang+arange,tstr1) subplot(212) plot(rang+arange,tstr2)
b34834210413edaeb515cc52ed27d79bfc87fbaaf45a65edda4f2965b16bf0d9
MATLAB
269
11
function ipi = ipint32(a) % IPDOUBLE Create a int32 type that supports inplace modification % ipi = ipint32(v) creates an inplace int32 object from any int32 % matrix v. % % Example: % ipd = ipint32(ones(5)); ip = inplace(a); ipi = class(struct([]),'ipint32',ip);
0208041f924fc6f0452e8d99b28e2d847f53469908341aede23e25c034d603d4
MATLAB
270
6
function x = subsasgn( x, S, y ) error( 'Subscripted assignment not allowed for these objects.' ); % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
13dca6bdac7fc1780f9e1c3e2c90130d8866b4b7aefd1e5930a8cd7a8412b129
MATLAB
270
6
function x = subsasgn( x, S, y ) error( 'Subscripted assignment not allowed for cvx problem objects.' ); % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
7c88dee9a792b930854e31411d1a8488602cedb95208feaf626375ce6fa92ba7
MATLAB
270
9
function [cfg, def] = cfg_mlbatch_appcfg % Auto-configuration file for batch system. cfg_util will scan the MATLAB % path for cfg_mlbatch_appcfg files and evaluate all of them. if exist('spm.m','file') cfg = impexp_cfg_NiftiMrStruct; else cfg = []; end def = [];
f09b4d504c9de339353162fe1daae1af8d29242e61706da97b2a2c0fff55adc6
MATLAB
270
12
function corr_pval=vassarp(vector_r,num_cells) %corr_pval=vassarp(vector_r,num_cells) % 2017 A.Leo tdist=nan(length(vector_r),1); corr_pval=nan(length(vector_r),1); tdist=vector_r./(sqrt(((1-(vector_r.^2))./(num_cells-2)))); corr_pval=1-tcdf(tdist,num_cells-1); end
1255c834c34c26aca0bd94a8b8a13aeabc3eb782bf3a0673689a107766b9a321
MATLAB
271
11
function cmap = cmapAreas5() % Manually chosen colors for area-specific plots from SGK25 % Scale colorcet map values so they are more distinguishable cmap = [[60 115 146]; [64 155 146]; [127 174 112]; [192 163 91]; [246 142 109]]; cmap = cmap ./ 256; end
13897a664f75bccfe94c8414a6679e896e458dfee190cc987e912834bb133627
MATLAB
271
7
function [dOD_760, dOD_850] = split_wavelengths(dOD_hp, wl_idx) %NIRSPROC.SPLIT_WAVELENGTHS Split ΔOD columns into 760 and 850 blocks. % [dOD_760, dOD_850] = SPLIT_WAVELENGTHS(dOD_hp, wl_idx) dOD_760 = dOD_hp(:, wl_idx==1); dOD_850 = dOD_hp(:, wl_idx==2); end
151d8618e570f712f871c25fd8ede3a5b88d854bdfa15c9c4f499a22d50efea5
MATLAB
271
10
function y = pow_p( x, p ) %POW_P Internal cvx version. narginchk(2,2); y = pow_cvx( x, p, 'pow_p' ); % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
49a01bac972f11379e203a7f17ab56a90dcc0a2611ebbadd7a698ed53186ae1d
MATLAB
271
14
function out=select_aes(aes,sel) %Extract a logical selection out of an aes structure fields=fieldnames(aes); for k=1:length(fields) if isempty(aes.(fields{k})) out.(fields{k})=[]; else out.(fields{k})=aes.(fields{k})(sel); end end end
1b06b2ab066acb7e139a8dd8b957db6c619e8f618b40135e3f229b8ea82a25be
MATLAB
274
9
% Local Regression and Likelihood, Figure 4.4. % Author: Catherine Loader % % AIC plot for a local poisson regression. load mine; a = (0.4:0.05:1)'; figure('Name','fig4_4: AIC plot for local poisson regression' ); aicplot(a,extrp,frac,'family','poisson','deg',1);
5df152672e3b40576421e1e9d9222bee64f70ba8af37c2276ee69732a40f9bde
MATLAB
275
13
function s=ea_roi2struct(obj) props = properties(obj); for p = 1:numel(props) if ~ismember(props{p},{'controlH','plotFigureH','patchH','toggleH','htH'}) s.(props{p})=obj.(props{p}); else s.(props{p})=[]; end end if ~exist('s','var') s=[]; end
3153ef830dd82ff170178f244a928181d4753c74c1c49e168f8da1457dc1b11f
MATLAB
276
8
function result=ea_mahalanobis_cov(x,val) % This function is the same as ea_mahalanobis but only optimized for a % specific input. It is called from ea_mcdcov % % Is is equal to ea_mahalanobis(x,[0; 0],'cov',val) with size(val) = [2 1] result=sum(x*pinv(diag(val)).*x,2)';
3da1f9983405a47cbca0c116fc2976f1ba3deab33817daa36187994fd8643ee7
MATLAB
276
11
function ipd = ipdouble(a) % IPDOUBLE Create a double type that supports inplace modification % ipd = ipdouble(v) creates an inplace double object from any double % matrix v. % % Example: % ipd = ipdouble(ones(5)); ip = inplace(a); ipd = class(struct([]),'ipdouble',ip);
3fcb8e8309bd11d207445ec1f3dc6a09f5b637d53962bce10ff727966af7127c
MATLAB
276
9
[nvar, names, types] = nex_info('test.nex'); [n, ts] = nex_ts('test.nex', 'neuron1'); [adfreq, n, ts, fn, d] = nex_cont('test.nex', 'continuous1'); [adfreq, n, ts, nf, w] = nex_wf('test.nex', 'wave1'); [n, nm, nl, ts, names, m] = nex_marker('test.nex', 'marker1');
414167595a1a5b8561b0d64efbbbc4a0b0f8319e450088920468ea65a296ce36
MATLAB
276
19
function Ihat=ea_getlookup_improvement(ptvta,othervta,otherI,exponent) if ~exist('exponent','var') exponent=1; end weights=sum(othervta.*repmat(ptvta,size(othervta,1),1),2); weights=(weights).^exponent; weights=weights./sum(weights); Ihat=sum(otherI.*weights);
93b97e20761144f645445b27d3512b1b11753cc5f4560de94acdecb1191706b5
MATLAB
276
12
function folder = layoutDocRoot() %layoutDocRoot Return the location of the GUI Layout Toolbox documentation. % % folder = layoutDocRoot() % % See also: layoutRoot % Copyright 2014 The MathWorks, Inc. folder = fileparts( mfilename( 'fullpath' ) ); end % layoutDocRoot
6f04e4977ee9a9d025089eb67188aed5c60515103081b8ea6afb0fee212d84fc
MATLAB
277
10
function attrs = myattrs(tree, varargin) uid = root(tree); if ~isempty(varargin) uid = varargin{1}; end attrs = attributes(tree, 'get', uid); if ~iscell(attrs) attrs = {attrs}; % treat one attribute just like multiple attributes end end
8217f068993114149e960c7d6633f658277f4e8faa3add60cd41dfba6a790336
MATLAB
277
13
function obj = set_stat_options( obj , varargin ) % set_line_options Set statistics options p=inputParser; my_addParameter(p, 'alpha', 0.05 ); my_addParameter(p, 'nboot', 200 ); parse(p,varargin{:}); for obj_ind=1:numel(obj) obj(obj_ind).stat_options=p.Results; end end
f104ba69a1ac9a101f683ee39298c8cccbc0baa26dda4c23e7dc03126ff42915
MATLAB
277
12
function Cont=Contingency(Mem1,Mem2) if nargin < 2 | min(size(Mem1)) > 1 | min(size(Mem2)) > 1 error('Contingency: Requires two vector arguments') return end Cont=zeros(max(Mem1),max(Mem2)); for i = 1:length(Mem1); Cont(Mem1(i),Mem2(i))=Cont(Mem1(i),Mem2(i))+1; end
f2062d20f68e7b5f0411cc79009c686568bf97bdf25c485b2790b7c76eb90d17
MATLAB
277
13
function MUAMap(pos,nShanks) for ii=1:nShanks spikesii=GetSpikeTimes([ii -1]); [map,stats]=FiringMap(pos,spikesii,'smooth',1,'nBins',[200 100]); subplot(7,3,ii) PlotColorMap(map.rate,map.time) set(gca,'YDir','Reverse') clim([0 35]) xlabel([int2str(ii)]); end
0f10b7953015551e3ea97d12479bd336e9e675b23ec04f29491eab2fc00f3073
MATLAB
278
19
% Builds and solves a simple inequality-constrained linear program echo on n = 10; A = randn(2*n,n); b = randn(2*n,1); c = randn(n,1); d = randn; cvx_begin variable x(n) dual variables y z minimize( c' * x + d ) subject to y : A * x <= b; cvx_end echo off
53d8b6c2b647294084a8e9d7e2544fbe1ee670fe8b9d3312840d097a40e878aa
MATLAB
278
20
% Builds and solves a simple linear program echo on n = 100; A = randn(0.5*n,n); b = randn(0.5*n,1); c = randn(n,1); d = randn; cvx_begin variable x(n) dual variables y z minimize( c' * x + d ) subject to y : A * x == b; z : x >= 0; cvx_end echo off
b00ab55c3f6fa0231c5b90987be579586fd20b91ca37ab1a0a689692d3053a14
MATLAB
278
19
function ret = fileexists(fname) if iscell(fname), ret = true; for k = 1:length(fname), ret = ret && fileexists(fname{k}); end; return ; end; ret = false; fi = fopen(fname); if fi == -1, return; else ret = true; fclose(fi); return; end;
3bbba4c641f68b97bf193c05b69614b07d1f74ba86131880352d4f710808f53a
MATLAB
279
11
function alpha = circ_rad2ang(alpha) % alpha = circ-rad2ang(alpha) % converts values in radians to values in degree % % Circular Statistics Toolbox for Matlab % By Philipp Berens, 2009 % berens@tuebingen.mpg.de - www.kyb.mpg.de/~berens/circStat.html alpha = alpha / pi *180;
3bd5dee476aa31d270fed4cfdc90c981bc07b327ba2aba676710037a01b5465f
MATLAB
279
14
function y=ring(inmat,x0,y0,wx,wy,ang,rrw) % Usage ... y=ring(inmat,x0,y0,wx,wy,ang,rrw) if length(rrw)==1, rrw=[rrw rrw]; end; tmp1=ellipse(inmat,x0,y0,wx+rrw(1),wy+rr(2),ang,1); tmp2=ellipse(inmat,x0,y0,wx,wy,ang,1); y=tmp1-tmp2; if nargout==0, show(y), clear y end;
4144285eb683615ef607a1c2d72db6285086e228fa8042673e66460c668e704f
MATLAB
279
9
function [norm] = normforbump(data) % data is the first output of concat_dFF (aka 'hdb' or something) norm = {}; for w = 1:length(data) s{w} = sum(data{w},2); % sum intensity across columns (= AUC) norm{w} = data{w}./s{w}; % divide every column value by AUC end
64a64e87be07d0b7f088c54f0ea299460bd196a514093326a33a3f21ff9be9a3
MATLAB
279
12
function angles = normalizeAngles(angles) sel = find(angles>=180); while ~isempty(sel) angles(sel) = angles(sel)-360; sel = find(angles>=180); end sel = find(angles<-180); while ~isempty(sel) angles(sel) = 360+angles(sel); sel = find(angles<-180); end
a21b6b62ba189a3aacaf8d844a5b4f2c91aa3f0ef8e6ca5496dd145ae9cab287
MATLAB
279
11
function alpha = circ_ang2rad(alpha) % alpha = circ_ang2rad(alpha) % converts values in degree to radians % % Circular Statistics Toolbox for Matlab % By Philipp Berens, 2009 % berens@tuebingen.mpg.de - www.kyb.mpg.de/~berens/circStat.html alpha = alpha * pi /180;
a8a319fffc62c77c36f45bc613218f58df23bd937fd4ef6fd34d39a75cfb2923
MATLAB
279
10
function [gauss] = Gauss(x,mu,s) %Gauss(x,mu,s) returns a normalized gaussian with mean mu and standard %deviation s p1 = -.5 * ((x - mu)/s) .^ 2; %Term in the exponent p2 = (s * sqrt(2*pi)); %Normalization gauss = exp(p1) ./ p2; %Put it all together! end
305e6d5b7d66ae7872b81405667d1ac7281922d60306d29be92ce7b29a30d015
MATLAB
281
11
function l = length(x) % Overloaded length function for file_array objects % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: length.m 1143 2008-02-07 19:33:33Z spm $ l = max(size(x));
6536aa64f9b5e6aaff0c83b35846e73d00353bd454193e9c9a32ef4888a526b8
MATLAB
281
13
function bz_PreprocessExtracellEphysAnimal(basepath) if ~exist('basepath','var') basepath = cd; elseif isempty(basepath) basepath = cd; end %% Assuiming one already did bz_SetAnimalMetadata bz_RunAnimalMetadata(basepath); %% making an xml if needed bz_MakeXML(basepath)
c7d081f673a3e815a1d5519c2d288ca3b6f719f3149bfb4981e841ded0a1059e
MATLAB
281
8
function a = gt( x, y ) b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '>' ); if nargout, a = b; end % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
d4f832f0963a3cb6d229279c35f1edf9a81c6e7c89575f1cc2574a442cbef9fc
MATLAB
281
8
function a = lt( x, y ) b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '<' ); if nargout, a = b; end % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
2216e1a951ae380bcbd82ac6790e840a765038923fec78a42a97cd78ec81bdda
MATLAB
282
8
function a = ge( x, y ) b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '>=' ); if nargout, a = b; end % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
294866c090cfb0ebc4e04302cdb9af9a1927f040947a2df020fcabfffb1091fa
MATLAB
282
11
function pnew = getBestRows( p ) % given collection of p = [ a b ; a1 b1 ; a2 b2 .. ] % trims out instances where bi = bj , choosing row with maximum a. bs = unique(p(:,2)); Nbs = length(bs); pnew = zeros(Nbs,2); for i=1:Nbs, pnew(i,:) = [ max(p(p(:,2)==bs(i),1)) bs(i) ]; end
64ff1fee4ee29e29bcb935ba79228bade0d4a5c68e8f3967a92fe719e015b039
MATLAB
282
12
function [v] = plx_mexplex_version() % plx_mexplex_version(): returns mexPlex DLL version % % [v] = plx_mexplex_version() % % INPUT: % None % % OUTPUT: % v - mexPlex DLL version as a number. For example, version 180 corresponds to version 1.8.0. [v] = mexPlex(29);
841a440eff844b7555ba52c996283cdea4f33fb1bf407a8d03c7f2a325b27ade
MATLAB
282
13
function distmap = test_breadth_first_search(A,u) distmap = ipdouble(zeros(size(A,1),1)); distmap(u) = 0; function on_tree_edge(ei,u,v) distmap(v) = distmap(u)+1; end breadth_first_search(A,u,struct('tree_edge',@on_tree_edge)); distmap = double(distmap); end
84d711c994cac261f0e3ef5fa7d7d0dd13e39e604f9d91861ae34c5aa6ed54ba
MATLAB
282
8
function a = ne( x, y ) b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '~=' ); if nargout, a = b; end % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
ad03985680833b7c636acb9413eb0560a182a7ea9a30d21ecbab162be1dbf6de
MATLAB
282
8
function a = le( x, y ) b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '<=' ); if nargout, a = b; end % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
b12440ca8cf1c62d7377b493cc03b08b01a25b07d3c9dfd12e5b24b04d7bc536
MATLAB
282
8
function a = eq( x, y ) b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '==' ); if nargout, a = b; end % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
b240b0164dbc241e089f6180994e8de1f3c0058fb075575ef51be895713d5902
MATLAB
282
11
% READ parse TOML data from a file % % READ('file.toml') loads the contents of `file.toml` and parses % that data into a MATLAB struct. % % See also FILEREAD, TOML.DECODE function toml_data = read(filename) raw_text = fileread(filename); toml_data = decode(raw_text); end
c8a7b3b26a1fb3c5bc1755a48cdb2d4154a73d17358ee629c2fa02e660f1c0f8
MATLAB
282
8
function a = in( x, y ) b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '==' ); if nargout, a = b; end % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
ee2290e95b43ea5a31cd525ac0e33e785c7918e1bf2662871e29b228810b7a81
MATLAB
282
8
function [dRatioAll, dRatio] = computeDevRatio(trialAll) devFreqAll = [trialAll.devFreq]; stdFreqAll = cellfun(@(x) x(1), {trialAll.freqSeq}); dRatioAll = roundn(devFreqAll ./ stdFreqAll, -2); dRatio = unique(dRatioAll); dRatio(dRatio == 0) = []; return; end
5e740ed49087a2264944fa9367bca5a589feb8dcf78470128f6dd492dfe7e6cd
MATLAB
284
13
function out = R_contrast( fparam , img , imgR, imgG, imgB, typeidx ) if ( nargin == 1 ) out.weight = fparam.contrastWeight; out.numtypes = 1; out.descriptions{1} = 'Intensity Contrast'; else out.map = myContrast( img , round(size(img,1) * fparam.contrastwidth) ); end
2857d0767101091863732c0867dbd9b56b97c6c6b2ff0bdc6c9105b305decd20
MATLAB
285
16
function onoff=ea_bool2onoff(b) % translates 'on' / 'off' to 1 / 0 and vice versa if ischar(b) switch b case 'on' onoff=1; case 'off' onoff=0; end else % isnumeric(b) if b onoff='on'; else onoff='off'; end end
c9b447e49329305f71fee398342ba186b64a1a741629314502e2a0b05ddbf50c
MATLAB
285
5
signatures_to_plot = {'FAPS','VIFS','reddan'}; % NPS, VPS, SIIPS, etc., etc. myscaling = 'raw'; % 'raw' or 'scaled' mymetric = 'dotproduct'; % 'dotproduct' or 'cosine_sim' plugin_signature_condition_contrast_plot
4a104588b75eb2784490d27af19e186468ff6b35316fa4d9f2ba4af2779107c2
MATLAB
287
11
function showbTensor(ten) %% for k = 1:size(ten,3), [U D] = eigs(ten(:,:,k)); dir(:,k) = U(:,1)*sqrt(D(1,1)); end; dir = dir;%.*repmat(sign(dir(3,:)),[3 1]); figure(1000) ; plot3(dir(1,:),dir(2,:),dir(3,:),'*'); hold on; plot3(-dir(1,:),-dir(2,:),-dir(3,:),'g*'); hold off;
bdcd1a358975581e0b0ab49e289bfe5a618666fed02aafccef6ff4c24ca2dde7
MATLAB
287
13
function my_addParameter(parser,name,value) %To maintain compatibility with older versions persistent old_matlab if isempty(old_matlab) old_matlab=verLessThan('matlab','8.3'); end if old_matlab addParamValue(parser,name,value); else addParameter(parser,name,value); end end
0d845cd101971b661937673a270277c8eb479e38d31f61b4898b4aa3f244e8d0
MATLAB
288
10
function cvx_optval = square_pos( x ) %SQUARE_POS Internal cvx version. narginchk(1,1); cvx_optval = pow_pos( x, 2 ); % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
237942b70822464cb110f6fefa38b57849eeff8f35c4f5c2a6c7f7d6ee56d743
MATLAB
288
10
function cvx_optval = square_abs( x ) %SQUARE_ABS Internal cvx version. narginchk(1,1); cvx_optval = pow_abs( x, 2 ); % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
c99ea38747e1fb6249c3e6731aba9ed3fa1d0ecec03d58e746d77454ebcfc989
MATLAB
288
13
function y=erbRate2hz(x) %ERBRATE2HZ Convert ERB rate to Hz. % % Y = IOSR.AUDITORY.ERBRATE2HZ(X) converts the ERB number X to the % eqivalent frequency Y (in Hz). % % See also IOSR.AUDITORY.HZ2ERBRATE. % Copyright 2016 University of Surrey. y=(10.^(x/21.4)-1)/4.37e-3; end
eb68d0a83d20580e691f5bde81a3d3d55e08988d7d5538ba227f65aac2df894f
MATLAB
288
7
if ispc() mex -v mexlf.c liblfev.c liblocf.c libmut_win.c libtube.c mlfut.c mex -v mexpp.c liblfev.c liblocf.c libmut_win.c libtube.c mlfut.c else mex -v mexlf.c liblfev.c liblocf.c libmut.c libtube.c mlfut.c mex -v mexpp.c liblfev.c liblocf.c libmut.c libtube.c mlfut.c end
06ea5fc801d9ce39fea4ebfc16ac18290b8c5f923a602b252ca738cd18033093
MATLAB
289
11
function y = cvx_isaffine( x, full ) %#ok narginchk(1,2); if nargin == 1, y = true; else y = true( size( x ) ); end % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
7b038195b4f87675f7f25041290cec2682531c1fbb9e25479d40c603b4739ace
MATLAB
289
11
function ea_get_ANN_env env = ea_conda_env('SynthSeg'); env.force_create if ~env.is_created ea_cprintf('*Comments', 'Installing SynthSeg conda environment for TensorFlow...\n'); env.force_create; ea_cprintf('*Comments', 'Done.\n'); end env.system('pip3 install matplotlib');
cbae827c24eb1791434e12b4aa4487a07d641a0b3b4a8678841448df3aa047f2
MATLAB
289
11
function alpha = circ_rad2ang(alpha) % alpha = circ-rad2ang(alpha) % converts values in radians to values in degree % % Circular Statistics Toolbox for Matlab % By Philipp Berens, 2009 % berens@tuebingen.mpg.de - www.kyb.mpg.de/~berens/circStat.html alpha = alpha / pi *180;
0802153b9be6312fce5070cfba80172d9e88f6273c19c6e2e2eff13bcdd02ded
MATLAB
290
8
function handles = generateDendritemask(handles) handles.roimask = zeros(size(handles.im_norm)); for k = 1:length(handles.dendrite) ii = handles.dendrite(k).dend_pixel; dendroi = zeros(size(handles.im_norm)); dendroi(ii) = 1; handles.roimask = handles.roimask + dendroi; end
8152cf8f18353367b446495eb50d4f8d4cd0cf8a5b4c08eb9a7d4396806fe416
MATLAB
290
18
function h = sfigure(h) % SFIGURE Create figure window (minus annoying focus-theft). % % Usage is identical to figure. % % Daniel Eaton, 2005 % % See also figure if nargin>=1 if ishandle(h) set(0, 'CurrentFigure', h); else h = figure(h); end else h = figure; end
f09820b0e19fb8af8563685f023e4d850b56666e85b28397d71094eec4b5f48b
MATLAB
290
10
function [field] = FindFieldHelper(map,x,y,threshold,circX,circY) %[field] = FindFieldHelper(map,x,y,threshold,circX,circY) % Helper function to pass arguments to FindField in order to avoid moving % around compiled function field = FindField(map,x,y,threshold,circX,circY); end
2fd96e87f3b31d637953d84283675575d339fddb45a70bdbed2dffc06e83841c
MATLAB
291
11
function y = cvx_isconstant( x, full ) %#ok narginchk(1,2); if nargin == 1, y = true; else y = true( size( x ) ); end % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
c3b35a71329f78d98a29f9a03ee8359c300accc8e94462469110a9cb1025ea5e
MATLAB
291
11
function y = cvx_id( x ) y = cellfun( @cvx_id, x ); if isempty( y ), y = -Inf; else y = max( y( : ) ); end % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
d0d8e3725909a3a99c7dc6ff3df1dae52c7f2748b58442c52b1e1ebe8eb922ff
MATLAB
291
15
function n_brackets = is_section(str) section_regexp = '^\s*\[{1,2}(.+?\.?)+\]{1,2}$'; section_name = regexp(str, section_regexp, 'ONCE'); if ~isempty(section_name) if str(2) == '[' n_brackets = 2; else n_brackets = 1; end else n_brackets = 0; end end
f4b132ad9ad7466a9f3ed2289fd91061b659a89e4cb5bc4ef73b8077d6695d1f
MATLAB
291
7
function color = Cmar %Cmar Maroon color vector. % CMAR returns [0.8 0.0 0.5]. This can be supplied as the 'Color' % property to HandleGraphics objects, extending the, e.g., 'k' style of % specifying common colors (& saving a tiny bit of typing). color = [0.8 0.0 0.5];
1d179c26ff2406fc4a0fc7a4731c4b296b87b967ad78704a1000c997ec125215
MATLAB
292
11
function spy( prob, reduce ) if nargin < 2 || ~reduce, A = extract( prob ); else A = eliminate( prob ); end spy( A' ); % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
3725a340ea2b809fceccd6c2353de6fab10fcec444bc3bf1d17b0849e20db99b
MATLAB
292
10
% Written by [xxx] and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md addpath('ad/cds/'); addpath('xxxx/fsf/'); addpath([CBIG_CODE_DIR '/xxx']) addpath /dadf/dafsf rmpath('ad/cds/'); rmpath('xxxx/fsf/'); rmpath([CBIG_CODE_DIR '/xxx']) rmpath /dadf/dafsf
6021cae660fa1b9c2cbfbc0f8658335f8b10b345f280125d10ffc0dd3c2d65cb
MATLAB
292
10
function [ ci m ] = ci_mean( raw, errorProb) %SE_MEAN Summary of this function goes here % Detailed explanation goes here if nargin==1 errorProb = 0.05; end [se m] = se_mean(raw); %df = size(raw,1)-1; df = sum(~isnan(raw))-1; %changed on 29.04.2015 ci = se .* tinv(1-(errorProb*0.5),df);
952ae6f12b7c0a57cf712c110a8ca620eb0ad0320cf6db30acdca5c5a8b77a4e
MATLAB
292
13
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 filename. % % See also XMLTREE tree.filename = filename;
aa2c6afbc1279a2238691ff3e3e1e5aea0925cdb6a59352137373e8342f5cb1a
MATLAB
292
7
function v = cvxin superiorto('cell','struct','cvx','cvxtuple'); v = class( struct( 'active', false, 'value', [] ), 'cvxin' ); % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
fda4833c9a7204de7540ac13767e28e9d793301993aaacb0f832008d87eff071
MATLAB
292
11
function y = cvx_basis( x ) if isempty( x ) y = sparse( 1, 0 ); else y = sparse( reshape( x, 1, numel( x ) ) ); end % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
62f2ea4d46d4d62b6cd7b6bf3a6da1aa75a7cadd38e0a031f620c77f3ca333a0
MATLAB
293
5
signatures_to_plot = {'NPS' 'NPSpos' 'NPSneg' 'SIIPS'}; % NPS, VPS, SIIPS, etc., etc. myscaling = 'raw'; % 'raw' or 'scaled' mymetric = 'cosine_sim'; % 'dotproduct' or 'cosine_sim' plugin_signature_condition_contrast_plot
85460b1f942736112656ff50cd2ff9878492a20c94739fd7d6252dd321475f05
MATLAB
293
9
%% rowNorm - row-wise eucliadian norm % % Andreas Husch % Centre Hospitalier de Luxembourg, Dep. of Neurosurgery / % University of Luxembourg - Luxembourg Centre for Systems Biomedicine % 2014 - 2017 % mail@andreashusch.de, husch.andreas@chl.lu function d = rowNorm(A) d = sqrt(sum(A.*A, 2));
d6ec3f648e68b39b56085d5b41f556df135ee83844ff1f2a46b747a1d66c9ad8
MATLAB
293
11
% Local Regression and Likelihood, Figure 5.5. % Author: Catherine Loader % % Bivariate Density Estimation. load trimod; fit = locfit([x0 x1],'nn',0.35); emp = sort(fitted(fit)); v = emp(floor([0.05 0.5]*225)); figure('Name','fig5_5: Bivariate density estimation' ); lfplot(fit,'contour',v);
0304d2e8981f5d1d8a8eb44f224f45405056b7e2413ce52504217bf5559a6186
MATLAB
294
12
function c = myconv2(a,b) % % conv2 with 'same' and repeating boundary condition % vpad = ceil(( size(b,1) - 1 ) / 2); hpad = ceil(( size(b,2) - 1 ) / 2); ap = padImage( a , vpad , hpad ); cp = conv2( ap , b , 'same' ); c = cp( vpad + 1 : vpad + size(a,1) , hpad + 1 : hpad + size(a,2) );
42bec7dbacecc69539428ecd0dc8a3d1bd09c6bf12e7cbad26190d194bccda88
MATLAB
294
11
% Local Regression and Likelihood, Figure 6.2. % Author: Catherine Loader % % Local smooth of CO2 dataset, main trend. load co2; fit = locfit(year+month/12,co2,'alpha',0.5,'deg',1); figure('Name','fig6_2: CO2 Dataset: Local smoothing, main trend' ); lfplot(fit); xlabel('Date'); ylabel('CO2')
45822a241bb64be2eef8f63d5b256eb1511627d7a2f82f55895b6843a08197c1
MATLAB
294
10
function x = cvx_zeros( s ) if cvx_use_sparse( s, 0, 1 ), x = sparse( s(1), s(2) ); else x = zeros( s ); end % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.