sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
656237aaa245c665be79ca6ae38d0af30c5dbf232ad5c12d9c120d9191619400
MATLAB
294
7
function color = Cmrd %Cmrd Muted red color vector. % CMGR returns [0.1 0.8 0.4]. 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.9 0.3 0.3];
94b2d60d54e52c5cc4707fb641d6a2bd3c9c7595d33d36205e31415a1b853a1b
MATLAB
294
7
function color = Cdgy %Cdgy Dark gray color vector. % CDGY returns [0.4 0.4 0.4]. 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.4 0.4 0.4];
a5323a8d99d65dfe53596342db2b3d2e237fb9be8f3f980c4f2d6650c5572aa2
MATLAB
294
5
signatures_to_plot = {'NPS' 'NPSpos' 'NPSneg' 'SIIPS'}; % NPS, VPS, SIIPS, etc., etc. myscaling = 'raw'; % 'raw' or 'scaled' mymetric = 'dotproduct'; % 'dotproduct' or 'cosine_sim' plugin_signature_condition_contrast_plot
aac59051365ef57717a407c0a4bb88c8341f9ffa6a5820074551d3dbe1881263
MATLAB
294
11
function getBinaryClassifiersTest(blockTagsAC,features,folderpath,nameTag) classes = ['OC';'OH';'OW';'CH';'CW';'HW']; for cla = 1:6 class1 = classes(cla,1); class2 = classes(cla,2); perfMat = binaryClassTest(class1,class2,blockTagsAC,features,folderpath,nameTag); end end
35b5b801a82534b25a4f692e4b1beff97226cee28f6a9604ca1e7fcc46c2f3e0
MATLAB
295
8
function y = cvx_subsasgn( y, varargin ) temp.type = '()'; temp.subs = varargin(1:end-1); y = subsasgn( y, temp, varargin{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.
65d75737bf9b244d77abcc5d3a2fb3776ebc2965f5c4e596e6af3d28af0186a8
MATLAB
295
7
function color = Clgy %Clgy Light gray color vector. % CLGY returns [0.7 0.7 0.7]. 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.7 0.7 0.7];
b90df4c284b62035be8dfc9db8dde1dad951089812197de2761a33807f82d73d
MATLAB
295
7
function color = Cmbl %Cmbl Muted blue color vector. % CMBL returns [0.0 0.4 0.8]. 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.0 0.4 0.7];
e76528ea0c81236f865e4a1c9e2f2c865b93107c9f2de7bd5ce2dbc4fd787820
MATLAB
295
7
function y = wrapped_1gaussian(x, a, mu, sigma) if nargin==2 y = a(1) * exp(-min(abs(x - a(2)), a(2)+2*rad2deg(pi)-x).^2 ./ (2 * a(3)^2)); else % fmodel = 'f(x) = a1*exp(-((x-b1)/c1)^2)'; y = a * exp(-min(abs(x - mu), mu+2*rad2deg(pi)-x).^2 ./ (2 * sigma^2)); end
1095521881547a3e9990bceb6422eac23d781c0229bf5fd53a4ac66537a0cc54
MATLAB
296
8
function D = ea_sqdist(X1, X2) % Pairwise square Euclidean distance between two sample sets % Input: % X1, X2: dxn1 dxn2 sample matrices % Output: % D: n1 x n2 square Euclidean distance matrix % Written by Mo Chen (sth4nth@gmail.com). D = bsxfun(@plus,dot(X2,X2,1),dot(X1,X1,1)')-2*(X1'*X2);
4500fd2b6b7fc6745ab1564173b1d75c7401bf3f38e7e4f73f8ef929def3c7da
MATLAB
296
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 import CMBHOME.Utils.circ.* alpha = alpha * pi /180;
5069a2d19839706821d418ebda8b6ff924b6b915a9ca83344e98162eb1ce7a35
MATLAB
296
11
function y = cvx_isnonzero( x, full ) %#ok narginchk(1,2); if nargin == 1, y = nnz( x ) ~= 0; else y = x ~= 0; 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.
7b1ad5ba912752fdcec9da851b97ef452c789d28d094b047ee983c677005ccca
MATLAB
296
7
function color = Cmgr %Cmgr Muted green color vector. % CMGR returns [0.1 0.8 0.4]. 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.1 0.8 0.4];
ada794020690fb3a3aeaf3369432e8f97d443e9c0a51fd7d2b178ac6296e3ba8
MATLAB
296
7
function y = cvxdual( prob, name ) y = class( struct( 'problem_', prob, 'name_', name, 'attached_', false ), 'cvxdual', cvxobj ); % 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.
0602fb52d3fdffad09bf1f042e35ab2974509e018d9929845cff034f5d177af9
MATLAB
297
11
function out = Kropff(self) %Uses Kalman filter from Kropff et al. 2015 Velocity output is stored as %out.v import CMBHOME.* xvec = CMBHOME.Utils.nanInterp(self.b_x,'spline'); yvec = CMBHOME.Utils.nanInterp(self.b_y,'spline'); out = CMBHOME.Session.speed_kalman(xvec, yvec, self.fs_video); end
e26caf0ab7bc7d207ecaa01314bb63f22d5e0adc81a4616a57d028d9256ea568
MATLAB
298
9
function a = in( x, y ) narginchk(2,2); 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.
ee4d331b96cea0ef0b242607dd7a8cb98196890b5762fdca3e87c64187c3320b
MATLAB
298
6
% Sparse solution heuristics % % sparse_solution.m - Computing a sparse solution of a set of linear inequalities % sparse_infeas_dual.m - Detecting a small subset of infeasible linear inequalities % sparse_infeas.m - Finding a point that satisfies many linear inequalities help Contents
00c3f767a44a5ad3a6ae55df3f883422ed91c0f1206a2dda0cd15a6ce6b092a7
MATLAB
299
42
fig1_1 fig1_2 fig2_2 fig2_3 fig2_4 fig2_5 fig2_6 fig2_7 fig3_1 fig4_1 fig4_2 fig4_3 fig4_4 fig5_1 fig5_2 fig5_3 fig5_4 fig5_5 fig5_6 fig6_1 fig6_2 fig6_3 fig6_4 fig6_5 fig6_6 fig6_7 fig7_1 fig7_2 fig7_3 fig7_4 fig7_5 fig7_6 fig8_1 fig8_2 fig8_3 fig9_1 fig9_2 fig10_1 fig11_1 fig11_4 fig11_5 fig13_1
5f778fbda13d46d6c7bb697e9a3d08fc5475d974a44992a31180e11f9ea62129
MATLAB
299
9
function display( x ) long = ~isequal(get(0,'FormatSpacing'),'compact'); if long, disp( ' ' ); end disp(x); if long, disp( ' ' ); 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.
863c0fff48da310b7d81e118207652e96859975585a8533d326342ec1412e66c
MATLAB
299
11
function o = vertcat(varargin) % Vertical concatenation of file_array objects. % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: vertcat.m 1143 2008-02-07 19:33:33Z spm $ o = cat(1,varargin{:}); return;
a20b3a28cc519a344d6818134fe15b95d8ef3f3ed6a4b21e5acf5fd0720197d0
MATLAB
299
12
function options=ea_amendtoolboxoptions(options) if ~isfield(options,'lc') % might be predefined from an exported script.. try options.lc = options.prefs.machine.lc; catch options.lc = []; end end % append 2D options. options.d2 = ea_tdhandles2options([], options.d2);
45809f1020cd61ae19e6f6f1b510d1947472807e2dcd24e6e90b9ee56ac0e3eb
MATLAB
300
15
function distmap = test_depth_first_search(A,u) distmap = -1*ones(size(A,1),1); distmap = ipdouble(distmap); distmap(u) = 0; function on_tree_edge(ei,u,v) distmap(v) = distmap(u)+1; end depth_first_search(A,u,struct('tree_edge',@on_tree_edge)); distmap = double(distmap); end
75cee4e1405153987b6a177c353392bd1e87edc65a53d38aba43c238c6be6bae
MATLAB
300
17
function plotbyfactor(x,y,f) % % very simplistic version of plotbyfactor. % no symbols, will crash if more than 8 levels. % z = unique(f); cols = ['b','r','g','m','c','y','k','w']; for (i = 1:length(z)) u = find(f==z(i)); plot(x(u),y(u),'.','color',cols(i)); hold on; end; hold off; return;
8ec2d41182758ba6149716d80c58339977173fd826c9408fbabfc3012bae63f0
MATLAB
300
11
function narginchk(imin, imax) narg = evalin('caller', 'nargin'); if narg < imin, me = {'MATLAB:narginchk:notEnoughInputs', 'Not enough input arguments.'}; elseif narg > imax, me = {'MATLAB:narginchk:tooManyInputs', 'Too many input arguments.'}; else return end throwAsCaller(MException(me{:}));
9c1a6a5e10e5f9ff09bb13fe856d5e21e4b45068aec53b88a673dffd4ff5a636
MATLAB
300
10
function y = cvx_readlevel( x ) if ndims( x ) <= 2, y = sparse( size( x, 1 ), size( x, 2 ) ); else y = zeros( 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.
b12d489c00f55b3fa2d9edda63936c59f22b4adfafce97cd63437085cf1c26a7
MATLAB
300
12
% mex all the ccode cd(fullfile(ea_getearoot,'ext_libs','mesoft','ccode')); %display('mexing c-code'); %ft_make cd .. % add the neccesary paths disp('adding MATLAB-path'); addpath(pwd) addpath(fullfile(pwd,'ccode')); addpath(fullfile(pwd,'aux_mfiles')); addpath(fullfile(pwd,'sphereInterpolation'));
b48b6d7fe8864bda3b888bbd0ad82c39f2d5129c6e151cc45acbfa4d73d2c237
MATLAB
300
6
function [inter,F2,nF2,Tnew]=VolumeCheckNew(V,F,nF,T,nT,Frows,F_Local,F_Local_new, Vertex_id,Vertex_id_Local,Volume_Original) nTold=nT; [V,F,nF,T,nT]=process(V,F,nF,T,nT,Frows,F_Local,F_Local_new, Vertex_id); F2=F; nF2=nF; inter=VolumeCheck(V,F,nF,T,nT,Volume_Original); Tnew=T(nTold+1:nT,:);
ee0012e942931f3d8e75d97fca0e83f56f19100c30176ab111e2bc4fff041034
MATLAB
300
10
function varargout = permute(varargin) % Can not be permuted. % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: permute.m 1143 2008-02-07 19:33:33Z spm $ error('file_array objects can not be permuted.');
2f13ffb12d93697f9f5a8661a78e8b6040da3053dfd4ebbd258533230d8b14c0
MATLAB
302
8
function Ne=vertex_neighbours(FV) % This function VERTEX_NEIGHBOURS will search in a face list for all % the neigbours of each vertex. % % Ne=vertex_neighbours(FV) % Ne=ea_vertex_neighbours_double(FV.faces(:,1),FV.faces(:,2),FV.faces(:,3),FV.vertices(:,1),FV.vertices(:,2),FV.vertices(:,3));
48d899366960ff676368d1620ceb928b2027b80b6f7eb09bee140b6c39aafaef
MATLAB
302
9
function smODF = smoothHardi(ODF,bDir,numit) smODF = ODF; for k = 1:size(hardi,4); D = eye(3)*0.2 + single(bDir(:,k)*bDir(:,k)'); smODF(:,:,:,k) = anisoDiffusionHomogenous(single(squeeze(ODF(k,:,:,:))),[D(1,1) D(2,2) D(3,3) D(1,2) D(1,3) D(2,3)]',single([0.1 numit])); fprintf('.'); end;
a2cbc408210a50ad916678bb11600d870c0b7f3c6088a68f2ef870419aa01fff
MATLAB
302
11
% Finds the number of k-neighbors (k links away) for every node % INPUTS: adjacency matrix, node index, k - number of links % OUTPUTS: vector of k-neighbors indices % GB, May 3, 2006 function kneigh = kneighbors(adj,ind,k) adjk = adj; for i=1:k-1; adjk = adjk*adj; end; kneigh = find(adjk(ind,:)>0);
264a767767534b7256f9f546d4850e538552556c2a91a5278692e4793c122242
MATLAB
303
11
function o = horzcat(varargin) % Horizontal concatenation of file_array objects % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: horzcat.m 1143 2008-02-07 19:33:33Z spm $ o = cat(2,varargin{:}); return;
ba372dfc0656e43e4e1086b0ee91f607e5900c53097baa9d1e85092096055982
MATLAB
303
19
% cleanmex cd util mex('myContrast.cc'); cd ../ cd algsrc mex('mexArrangeLinear.cc'); mex('mexAssignWeights.cc'); mex('mexColumnNormalize.cc'); mex('mexSumOverScales.cc'); mex('mexVectorToMap.cc'); cd ../ cd saltoolbox/ mex('mySubsample.cc'); mex('mexLocalMaximaGBVS.cc'); cd ../
bdd3d262efba068e93ba312e37fa3f94f61a162ec21dd3555c45dd51a6852795
MATLAB
303
8
function GCO_ExpandOnAlpha(Handle,Alpha) % GCO_ExpandOnAlpha Perform a single alpha-expansion step. % GCO_Expansion(Handle,Alpha) takes the current labeling and performs % a single expansion step on label Alpha. GCO_LoadLib(); gco_matlab('gco_alphaexpansion',Handle,int32(Alpha)); end
c3b17c6982fe40ed8e756349e6a083f788082ec7ffcbf534fdf26bc2c8f12799
MATLAB
303
16
function y=rot2d(x,angle) % Usage ... y=rot2d(x,angle) % % x is a row vector and angle is in degrees angle=angle*(pi/180); rotm=[cos(angle) -sin(angle);sin(angle) cos(angle)]; if size(x,1)==1, y=(rotm*(x.')).'; else, for m=1:size(x,1), y(m,:)=(rotm*(x(m,:).')).'; end; end;
02222c4e2ef8193061ec859f1f0e2167a210727bd005294a1d4043b89eccd2be
MATLAB
304
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);
ae6325b1f89820e51b7a78cb887bc2b4202bf0e94bdbebf545a422c2bb26ff82
MATLAB
304
12
function p = testCoeffSig(beta,nullval,SE,dof,twotail) %%% Calculates the p-value in a test of significance for a %%% coefficient compared to a null value. dof is degrees of freedom; %%% twotail is boolean. tstat = abs(beta-nullval)/SE; p = 1-tcdf(tstat,dof); if twotail p = 2.00*p; end
d42a873fe99161c3032cc3e07e0b528542dad42d6bb2781c8883f7d2bb810cf1
MATLAB
304
14
function ea_checkcoregallmri(options,usebrainmask,usefa) if ~exist('usebrainmask','var') usebrainmask=0; % by default dont use brain mask. end if ~exist('usefa','var') usefa=1; % by default use it. end ea_coreg_all_mri(options,usebrainmask) if usefa ea_coreg_fa(options,usebrainmask); end
47311adbb91ca2669e4be740c75b836c1d698e833198e9d032e4f06b8fd90d45
MATLAB
305
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')
56dc79cce06fdce09c4247361ba2aa42c1b1b643f44a6251b82e6810aa0b0809
MATLAB
305
9
%% getIntensityForLabel % % Florian Bernard % Centre Hospitalier de Luxembourg, Dep. of Neurosurgery / % University of Luxembourg - Luxembourg Centre for Systems Biomedicine % 2014 - 2017 function intensity = getIntensityForLabel(labelNames, label) intensity = find(strcmp(labelNames, label)) - 1; end
7289c3a9a2cbb779ba92f03b21fcd6f64b77cedb2e916a59ca7f570434c8deab
MATLAB
305
11
function y = cvx_vexity( x ) sx = size( x ); if cvx_use_sparse( sx, 0, true ) y = sparse( sx(1), sx(2) ); else y = zeros( sx ); 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.
00fc2a373a1df6fd9feeabfc930561a695021bdf27e35c4a76f8f1de8c0b9ba5
MATLAB
306
14
function display(obj) % Display a NIFTI-1 object % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: display.m 1143 2008-02-07 19:33:33Z spm $ disp(' '); disp([inputname(1),' = ']) disp(' '); disp(obj) disp(' ')
3371400cef17bc5081da9c1e22ff5cfad5a307f367334e681b8c295c57422fca
MATLAB
306
12
function rotatemat=rri_bootprocrust(origlv,bootlv) %syntax rotatemat=rri_bootprocrust(origlv,bootlv) % - from PLS toolbox %define coordinate space between original and bootstrap LVs temp=origlv'*bootlv; %orthogonalze space [V,W,U]=svd(temp); %determine procrustean transform rotatemat=U*V';
79e3ded94955e2087939af9ddd92a6a3532554a117e43d15e063b9355abbc797
MATLAB
306
11
function computeSpatialDecay = checkProbeGeometry(channelPositions) % check if there are enough close-by channels to compute spatial decay % (i.e. is it a high density probe or not) if min(diff(unique(channelPositions(:, 2)))) < 30 computeSpatialDecay = 1; else computeSpatialDecay = 0; end end
3e5db448eae8a66edf6f06edd42e334d7a6a0cfa7b9542728a079b778973c85d
MATLAB
307
14
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 the parent of a node. % % See also XMLTREE p = tree.tree{uid}.parent;
26361f5788fd191d8ed00c3bffb26e18c87c1f8835ab62cc70f6e0360ef49853
MATLAB
308
12
function tt = time(td) %TIME Extract the time portion of tall calendar durations. % T = TIME(D) % % See also CALENDARDURATION/TIME. % Copyright 2016 The MathWorks, Inc. td = tall.validateType(td, mfilename, {'calendarDuration'}, 1); tt = elementfun(@time, td); tt = setKnownType(tt, 'duration'); end
d253864870ace183c0069cc6ef4d0310783cb8d20d6bc77bfb8d01e2f333baf6
MATLAB
308
6
function x = double( v ) %#ok error( 'Disciplined convex programming error:\n Constraints may not appear in if/then statements.', 1 ); %#ok % 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.
00e14fe8eb80ba5b8b222b273e0bffa780215fa23b581f30414aad4aa13add55
MATLAB
309
14
function display(obj) % Display a file_array object % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: display.m 1143 2008-02-07 19:33:33Z spm $ disp(' '); disp([inputname(1),' = ']) disp(' '); disp(obj) disp(' ')
89e2dd4452d4970afac4c3084d2932f17f048544ed7de2434f4f9cc3569a018d
MATLAB
309
6
function x = logical( v ) %#ok error( 'Disciplined convex programming error:\n Constraints may not appear in if/then statements.', 1 ); %#ok % 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.
3f25a6ebdd3949fac608e4ce04336764e284b5f3ecc953ca4555f102a95fe990
MATLAB
310
12
function out = double(fa) % Convert to double precision % FORMAT double(fa) % fa - a file_array % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: double.m 1143 2008-02-07 19:33:33Z spm $ out = double(numeric(fa));
52b324608a15bf61a8d81aa8b9dedd3f86b4a5254b1f196316f6222bcd41ffe7
MATLAB
310
8
function fatlines(wid,ii) dlha = get(gca,'children'); if nargin==0, wid=2; end; if isempty(wid), disp(sprintf(' #lines= %d',length(dlha))); return, end; if ~exist('ii'), ii=[1:length(dlha)]; end; if isempty(ii), disp(sprintf(' #lines= %d',length(dlha))); end; set(dlha(ii),'LineWidth',wid); clear dlha
7d75ea6e9be55862532bc08946823edb528ea37e94d501e3d8435d23ca46187a
MATLAB
310
8
for type = 1:19 A = flydata([flydata.trtype]==type); figure; set(gcf,'Position',[151 68.2 1121.2 790.8]) for i = 1:length(A) subplot(3,ceil(length(A)/3),i); imagesc(A(i).gaussianfluor); colormap('gray'); caxis([-1 6]) end sgtitle(['SS02255 Exp1&5 type: ' int2str(type)]); end
8edd07b265b4ac91e1e13e0c984b3a1483d58ada2ce4b98f064876ba440ebb79
MATLAB
310
9
function varargout = ctranspose(varargin) % Transposing not allowed % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: ctranspose.m 1143 2008-02-07 19:33:33Z spm $ error('file_array objects can not be transposed.');
88d818f850d45bb381f93522cc1f844794fcfad455cebf1036ec547383af5a11
MATLAB
311
13
function bz_mySQL = bz_database_credentials % Credentials used when connecting the Buzsakilab metadata-database % % v1.0 % % % By Peter Petersen % petersen.peter@gmail.com bz_mySQL.address = '77.104.157.210'; bz_mySQL.table = 'Datasets'; bz_mySQL.userid = 'buzsakid_users'; bz_mySQL.password = 'BuzsakiLab9';
383172b5e4f61f4037353ae51e6457341d5597e3cc9a99ac20d02e17c525aa03
MATLAB
312
10
function [files] = jdir(folder, regexp) % Grabs current directory, moves cd to folder, selects all files % according to regexp (e.g. '*.avi'), then returns to original % directory. %[files] = jdir(folder, regexp) home = pwd; cd(folder); files = dir(regexp); cd(home); end
2cbb9f46852619d9a037a0e83ceee3ef2e81ae2cd546d0721ba112c422248064
MATLAB
313
10
function varargout = transpose(varargin) % Transposing is not allowed. % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: transpose.m 1143 2008-02-07 19:33:33Z spm $ error('file_array objects can not be transposed.');
5c3d1361f1f2114a369ca3047c6d49a4db6e43ba7d1dec577a2de0f8fd5c9862
MATLAB
313
10
function dopapersize(newsize) % newsize needs to exist (e.g. newsize=[9 8]; ) set(gcf,'Units','inches'); papersize=get(gcf,'Position'); newpapersize=[papersize(1:2) papersize(3:4).*(newsize./[8 6])]; set(gcf,'Position',newpapersize); set(gcf,'PaperSize',newsize); set(gcf,'PaperPositionMode','auto');
d69add2b5bf7f19b1cd97ffe4123faa84cf0115f3403ac526b2ec998900957fa
MATLAB
313
10
function smODF = smoothODF(ODF,bDir,numit) smODF = ODF; for k = 1:size(ODF,1); D = eye(3)*0.2 + single(bDir(:,k)*bDir(:,k)'); smODF(k,:,:,:) = anisoDiffusionHomogenous(single(squeeze(ODF(k,:,:,:))),[D(1,1) D(2,2) D(3,3) D(1,2) D(1,3) D(2,3)]',single([0.1 numit])); fprintf('.'); end; fprintf('\n');
e5b0561885fec05267d1db0aab09e639ff913c68383b0f5d631e97ad7274628a
MATLAB
313
17
function cm_data=eco_kos(m) cm = [0 0 0; 126 40 127; 51 104 156; 167 210 140; 254 205 8; 255 253 25]/255; if nargin < 1 cm_data = cm; else hsv=rgb2hsv(cm); cm_data=interp1(linspace(0,1,size(cm,1)),hsv,linspace(0,1,m)); cm_data=hsv2rgb(cm_data); end end
6ab5181be972a87f77beab22622cc4ea0fde071d9d17cc52b3280677212eca97
MATLAB
314
14
function result = nonzeroCoef(beta,bystep) if nargin < 2 bystep = false; end result = abs(beta)>0; if ~bystep result = any(result,2); end %------------------------------------------------------------- % End private function nonzeroCoef %-------------------------------------------------------------
22c05f1ddf9e51623fd20808c85136b6a4fb8ef98aa792701d600c85e2f9a627
MATLAB
315
13
function y=hz2erbRate(x) %HZ2ERBRATE Convert Hz to ERB rate % % Y = IOSR.AUDITORY.HZ2ERBRATE(X) converts the frequency X (in Hz) to the % eqivalent ERB number Y. % % See also IOSR.AUDITORY.ERBRATE2HZ, IOSR.AUDITORY.MAKEERBCFS. % Copyright 2016 University of Surrey. y=(21.4*log10(4.37e-3*x+1)); end
1ad02ae49ff180540f1cd68ef32a9663eca5e4a92ae6e970966ff40dc2c5ddc8
MATLAB
316
9
function dat=quickstrongestdir(headpath,fileexpnum) %use this one when the data has been analyzed before and saved. cd('extracted2') savefilename=strcat(fileexpnum,'_analysis2'); load(savefilename); cd(headpath); %0 for popvec,1 for maxvec dat=plotstrongestdir_save(avgdiff,redtemps,ROIs,Xpix,Ypix,FrameRate,0); end
424d0e9c74e4fc10be3b8ceeba89c270c0317787415d210016f02d37dc20e46d
MATLAB
316
8
function [ddtData] = get_all_from_ddt(filename) ddtData =[]; [dirstr, name, ext] = fileparts(filename); ddtData.FileName = [name ext]; [ddtData.raw.nch, ddtData.raw.npoints, ddtData.raw.freq, ddtData.raw.d] = ddt(filename); [ddtData.v.nch, ddtData.v.npoints, ddtData.v.freq, ddtData.v.d] = ddt_v(filename);
4fe2da31ffb38e9dfefd27e7fcf262ab23dc3e93ca9b7ad2188f80ffaa6bbfb5
MATLAB
318
9
function mydelete(filename) %fix matlab's "error if doesn't exist" and braindead "send to recycling based on preference" misfeatures if exist(filename, 'file') recstatus = recycle(); cleanupObj = onCleanup(@()(recycle(recstatus))); recycle('off'); delete(filename); end end
1a2db4f4f67d8d1d1557dfd4d150b0265b67be0fa80e08bb5b89411ad4ad2794
MATLAB
319
13
function ea_dicm2nii(indir,outdir) % Wrapper for dicm2nii (Xiangrui Li, https://github.com/xiangruili/dicm2nii) % % USAGE: % % ea_dicm2nii(indir,outdir) % % INPUTS: % indir: DICOM folder % outdir: output folder for NIfTI files setpref('dicm2nii_gui_para', 'save_json', true); dicm2nii(indir, outdir, 1)
617f0378639b78fb054f50dd115f9afcd315ddc264bf837fac19b98179e27d0c
MATLAB
319
12
function d = double(ipa) % INPLACE/DOUBLE Return the data as a Matlab double type. % d = double(ipa) returns a double array. Changing d will not change the % ipa data. % % Example: % ipa = inplace(cumsum(ones(5,1))); % d = double(ipa); % d(2) = 10: % Doesn't change ipa % ipa d = ipa.get_a();
7b62a57262bb4629d63932a58c8d0da4253aee9b08cd1446f937ce797c2e7b7c
MATLAB
319
19
function chkinputdatatype_SleepScore(varargin) %CHKINPUTDATATYPE Check that all inputs are double % Copyright 2009-2013 The MathWorks, Inc. %#ok<*EMCLS> %#ok<*EMCA> %#codegen for n = 1:nargin if ~isa(varargin{n},'double') error(message('signal:chkinputdatatype:NotSupported')); end end % [EOF]
a5e1d99c345cdaeabe8a6e7efd618af154ca399ad3d59c0cd6d532be01210832
MATLAB
319
14
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 empty % string otherwise. % % See also XMLTREE filename = tree.filename;
52046486f3e84429ada5fa7b104bf31d267ed21ca43bd4cf745c198f2e813930
MATLAB
320
12
% WRITE serialize MATLAB data as TOML and write to file % % WRITE('file.toml', struct('key', 5)) writes the text `key = 5` to % the file `file.toml`. % % See also TOML.ENCODE, TOML.READ function write(filename, matl_strct) fid = fopen(filename, 'w'); fprintf(fid, '%s', encode(matl_strct)); fclose(fid); end
26ffdc663f755d535ecc926faa06fd9286f02b722700811dc9a7aae84b6a89c4
MATLAB
321
18
function [R1, t1] = PointCloud_reg(XX, YY) x0 = mean(XX,2); y0 = mean(YY,2); n = size(XX,2); Y_center = bsxfun(@minus, YY, y0); Xshifted = bsxfun(@minus, XX, x0); H = Y_center*Xshifted'; H = H/n; [U, ss, V] = svd(H); R1 = V*U'; if det(R1)<0 B = eye(3); B(3,3) = det(V*U'); R1 = V*B*U'; end t1 = x0 - R1*y0;...
4a206fee9e5ca03fa3a291b825c8d9f56327ac5b99dfb542447aca680d5ec955
MATLAB
321
14
function this = eegobj(EEG); if nargin == 1 if isa(EEG, 'eegobj') this = EEG; return; end; for index = 1:length(EEG) TMP(index).EEG = EEG(index); end; else TMP.EEG = eeg_emptyset; end; this = class(TMP, 'eegobj'); ...
4d2d2d3acaddbf77bf4b5eb35921addedb56c64d3ee8a2e72e4be868c73bf480
MATLAB
321
17
function triu_ind = calc_triu_ind(matrix) % calc_triu_ind.m % % Calculate upper triangle indices of matrix % % Input: matric : data matrix (array) % % Output: triu_ind : indices of upper triangle (vector) % % Original: James Pang, Monash University, 2022 %% [M, N] = size(matrix); triu_ind = find(triu(ones(M,N),1)); ...
01de4204edc477f6e39f125da1bc0b50d0e5fefd789c332ddf2afd7697a6d4ff
MATLAB
322
21
function jacob = jacobianR(f, x0, m, heps) if nargin < 3 m = length(f(x0)); end if nargin < 4 heps = 2.220446e-16^(1/3); end n = length(x0); jacob = zeros(n, n); hh = zeros(m, n); for i=1:n hh(i) = heps; jacob(:, i) = (f(x0 + hh) - f(x0 - hh)) / (2*heps); hh(i) = 0; end end...
34cfee9683539e63b5314fe36795f0bb774632ee59a29aa7016041a942267c17
MATLAB
322
11
function biosigpathlast str2doublepath = fileparts( which('str2double') ); sopenpath = fileparts( which('sopen') ); if strcmp(str2doublepath,sopenpath) rmpath(str2doublepath); str2doublepat2 = fileparts( which('str2double') ); addpath(str2doublepath,'-begin'); addpath(str2doublepat2,'-begin'); end...
a6a49c3c4a0287d5dba1c5b5aaab6dac82a90f11f318cccac6e739877b97257c
MATLAB
322
18
function spk = dff2spk(dff) tau_d = 20; tau_r = 5; nMax = 80; pars = [tau_d, tau_r]; kernel = create_kernel('exp2', pars, nMax); % kernel.bound_pars = false; smin = 3; [cn,fn] = size(dff); spk = nan(cn,fn); for ii = 1:cn [~,spk(ii,:),~,~] = deconvCa(dff(ii,:), kernel, smin, false, false); end e...
0415d2c5da74b5399f7d7bbea6bcd3912bebedc5a40853f7d659e3f26ed1a30b
MATLAB
324
12
function a = dofontsize(sz) dlha = get(gca,'Title'); set(dlha(:),'FontSize',sz); dlha = get(gca,'XLabel'); set(dlha(:),'FontSize',sz); dlha = get(gca,'YLabel'); set(dlha(:),'FontSize',sz); dlha = get(gca,'ZLabel'); %set(dlha(:),'FontSize',sz); %dlha = get(gca,'ZTickLabels'); set(dlha(:),'FontSize',sz); a = s...
3b7d2e502f015d497083dfcb5a44f20c8133eaf65035eb9bdd84fc497e706fb1
MATLAB
324
7
% Written by Nanbo Sun and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md % normalize gamma file to probabilities gamma = load(gamma_file); gamma_norm = bsxfun(@times, gamma, 1./(sum(gamma, 2))); gamma_norm = gamma_norm(:, [1, 3, 2]); dlmwrite(prob_file, gamma_norm, 'delimiter', ',...
5a7e57836369693f75a248b9a086d6a0db9f9b85c58336d61ce17435ca40aa3a
MATLAB
324
9
if isunix compflags = ' COMPFLAGS=''$COMPFLAGS -static-libstdc++'' CXXFLAGS=''$CXXFLAGS -msse2'''; fftwlib = 'libfftw3.a'; elseif ispc compflags = ' COMPFLAGS="$COMPFLAGS /MT" CXXFLAGS="$CXXFLAGS /arch:AVX"'; fftwlib = 'fftw3.lib'; end eval(['mex -compatibleArrayDims' compflags, ' ringRm.cpp ', fftwlib...
cb4d7a634d1f2a17f54c1e73680c77aed7bf5abaf1232ac2f8410df7960dd947
MATLAB
324
10
function cvx_optval = sum_square_abs( x, varargin ) %SUM_SQUARE_ABS Internal cvx version. narginchk(1,2); cvx_optval = quad_over_lin( x, 1, 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 locat...
6681bd56b24abc81e7d32f7fc579ac33702c7cc80b35124d6359968756807b74
MATLAB
325
15
function n=num_vertices(A) % NUM_VERTICES The number of vertices in a graph. % % n = num_vertices(A) returns the number of vertices in graph A. % % Example: % A = sparse(ones(5)); % n = num_vertices(A); % % See also NUM_EDGES % David Gleich % Copyright, Stanford University, 2006-2008 n = size(A,...
bc58cd51c896c631666c1cf3c38729e50dd9a3d059e11ad25921e4ba4e26b1de
MATLAB
326
12
function y = cvx_isaffine( x, full ) narginchk(1,2); y = cvx_vexity( x ); if nargin < 2, y = nnz( y ) == 0; else y = cvx_reshape( y == 0, x.size_ ); 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 loc...
914b2312718d7450af3c546652dd65584fce7b97bc39868eaed5638f5f81d06f
MATLAB
327
11
function plotCols(Y, cmap) % plotCols - Plot columns of a matrix with specified colors. % plotCols(Y, cmap) % % Y : N x P matrix, each column plotted as a separate trace % cmap : P x 3 matrix of RGB colors (one row per column of Y) for k = 1:size(Y, 2) plot(Y(:, k), '-', 'Color', cmap(k, :)); ...
cadd7575b69cbbfd28108414d3780381e366cfdf3896fbc1639206fd252536c3
MATLAB
327
10
function z = eq( x, y ) if ~isa( x, class( y ) ) error( 'cvxprob objects may only be compared to each other.' ); else z = cvx_id( x ) == cvx_id( 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 lo...
6a33926027e0f8701890167789892ecafdd2730c24da11f8169688824ba34acc
MATLAB
329
14
clear; clc; close all; addpath(genpath('../functions/')); SUBINFO_FILE = '../../subInfo/rid_sex_mDoB_yDoB_mExam_yExam_ageExam_dx_icv_bl.csv'; GMICV_FILE = '../../vbm_810bl/gmVolAndICV/rid_gmVol_icv_bl.csv'; %!!!!!! Which score? % 1 for MMSE, 2 for MEM, 3 for EF Q = 2; ps = CBIG_pairwiseCmpMeans(SUBINFO_FILE, GMICV_...
9a80040dc6337d9ca9015de60e8c485eadb8639d0a9752796fec7317d2fd6a70
MATLAB
329
13
function y = cvx_isconvex( x, full ) %#ok narginchk(1,2); if nargin == 2, y = ~imag( x ); elseif isreal( x ), y = true; else y = nnz(imag(x)) == 0; 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 ...
69604d55028ca9e2c7a0a61a2e674979ea6d6b687208f03464fb64d463bcb549
MATLAB
330
13
function y = cvx_isconcave( x, full ) %#ok narginchk(1,2); if nargin == 2, y = ~imag( x ); elseif isreal( x ), y = true; else y = nnz(imag(x)) == 0; 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...
ba5ee4ce28017c53c8d1bb6ff9526bdd0f1f7ffab9225f49cac1dd97e697b1f7
MATLAB
330
11
if ismac compflags = ''; elseif isunix compflags = ' COMPFLAGS=''$COMPFLAGS -static-libstdc++'''; elseif ispc compflags = ' COMPFLAGS="$COMPFLAGS /MT"'; end mex(compflags, 'ea_smoothpatch_curvature_double.c'); mex(compflags, 'ea_smoothpatch_inversedistance_double.c'); mex(compflags, 'ea_vertex_neighbours_d...
bae441f8f26c90b43f6c5ba047353e5534d58a53ea5de692fb4824eb13778ee4
MATLAB
330
12
function y = cvx_isconvex( x, full ) narginchk(1,2); y = cvx_vexity( x ); if nargin < 2, y = nnz( y < 0 ) == 0; else y = cvx_reshape( y >= 0, x.size_ ); 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...
d61b754e058dced0a6cb77f93460d1d10d23b93452328a064ec96771ac5e2e8d
MATLAB
330
14
function [EnergyMatrix]=GetEnergy(peak_test) [cell_num,view_point]=size(peak_test); EnergyMatrix=ones(cell_num,view_point); for j=1:view_point for i=1:cell_num EnergyMatrix(i,j)=Sum_of_Squares(peak_test(i,j).new_sequence); if EnergyMatrix(i,j)==0 EnergyMatrix(i,j)=1; end end ...
d96ae0086b9e7ceb784043d8b81e444f71f4f81cf7148ea851f610f0a2687969
MATLAB
330
9
% This function outputs the adjacency matrix of a subgraph given the % supergraph and the node set of the subgraph % INPUTs: adj - supergraph adjacency matrix, S - vector of subgraph node indices % OUTPUTs: adj_sub - adjacency matrix of the subgraph % GB, January 5, 2006 function adj_sub = subgraph(adj,S) adj_sub = ...
446668f2ce4384e6e3ae4e7330783f5844cff3990d03f031c0b23d167eb8d3ee
MATLAB
331
12
function y = cvx_isconcave( x, full ) narginchk(1,2); y = cvx_vexity( x ); if nargin < 2, y = nnz( y > 0 ) == 0; else y = cvx_reshape( y <= 0, x.size_ ); 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 i...
aa435b439d6b71d68b46d3c7c280624e8498b021320eb9d4721f466670bd9904
MATLAB
331
14
function [orval orcilow orcihigh]=Chi2testOR(A,B,C,D) if B*C~=0 orval = (A*D)/(B*C); lnorcilow = log(orval)-1.96*sqrt(1/A+1/B+1/C+1/D); lnorcihigh = log(orval)+1.96*sqrt(1/A+1/B+1/C+1/D); orcilow = exp(lnorcilow); orcihigh = exp(lnorcihigh); else orval = NaN; orcilow = NaN; orcihigh = Na...
b67430ee83d7a7fd2eae629191c2fb4ed555eaf6b5e272c743b292cb8409f9db
MATLAB
331
15
function res=comb(dat) %Combines data in single array if originally in cells if iscell(dat) % Only worked if first element was non empty! % if size(dat{1},1)==1 %Generic solution if max(cellfun('size',dat,1))==1 res=horzcat(dat{:}); else res=vertcat(dat{:})'; end else res=d...
cf7b4af8042ce4e847c9b645a0645db09240ae078686b9dcf728ce4e32db0a07
MATLAB
331
14
close all; clear; clc; addpath(genpath('../functions/')); SUBINFO_FILE = '../../subInfo/rid_sex_mDoB_yDoB_mExam_yExam_ageExam_dx_icv_bl.csv'; GMICV_FILE = '../../vbm_810bl/gmVolAndICV/rid_gmVol_icv_bl.csv'; WINDOW_SIZE = 3; % years K = 3; system('rm *.eps'); CBIG_compare_progression(SUBINFO_FILE, GMICV_FILE, WINDOW...
cafec4f484e47aae490a1ba91d90b8e8086c802cab6f8f32fc71fd3a86085f0f
MATLAB
332
12
function y = cvx_isnonzero( x, full ) narginchk(1,2); y = any( x.basis_, 1 ); if nargin < 2, y = all( y ); else y = cvx_reshape( y, x.size_ ); 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 i...
71842698f649f8059517c3c5acb9f4d37d4da9c78cf169251440607006792b93
MATLAB
333
17
function EEG = danalyzer2eeglab(psg) % Convert a danalyzer psg struct to EEGLAB %% % Authors: Dan Denis % Date: 2021-07-14 %% EEG = eeg_emptyset(); EEG.data = psg.data; EEG.pnts = psg.hdr.samples; EEG.srate = psg.hdr.srate; EEG.chanlocs = psg.chans; EEG.nbchan = length(EEG.chanlocs); EEG.trials = 1; EEG = eeg_c...
b31094dc1d42b8eb4058e7b0fb5c683a0d32d95171ef7c3a0bfda92eb14c5598
MATLAB
333
18
function [ EKc_out , EKcw_out ] = subfun_disposalEKcData( EKc_raw ) EKc_out = []; EKcw_out = []; for i = 1:360 tmp = EKc_raw(EKc_raw(:,2)==i,1); ttmp = []; for k = 1:5 ttmp = [ttmp sum(tmp==k)]; end [~,loc] = max(ttmp); EKc_out = [EKc_out; loc]; EKcw_out = [EKcw_out; ttmp/sum(ttmp)]...
d7697334707c495dc43f6582876257f4b16a3af84a719b38e8ed4ee8c26a82bf
MATLAB
333
9
function pobj=ea_load_electrode(recon_path,side) d=load(recon_path); pobj.elmodel=d.reco.electrode(side).dbs.elmodel; pobj.color=d.reco.electrode(side).plan.color; pobj.planRelative=d.reco.electrode(side).plan.planRelative; pobj.target=d.reco.electrode(side).plan.target; pobj.relateMicro=d.reco.electrode(side).micro....
0e4b06b3fcc8a333cb05b3bc3220c14fa33f498dbcea44ed7569ccc660b99d6b
MATLAB
334
9
classdef Container < matlab.ui.container.internal.UIContainer %uix.Container Container base class % % uix.Container is base class for containers that extend uicontainer. % Copyright 2009-2015 The MathWorks, Inc. % $Revision: 1137 $ $Date: 2015-05-29 21:48:21 +0100 (Fri, 29 May 2015) $ ...
e983be1358631ebc278f24c5ac5e84865269162590249855577c939d1c8582f5
MATLAB
334
19
function [N,nam] = namenodes(dims) Nmaps = size( dims , 1 ); N = 0; for i=1:Nmaps N = N + prod( dims(i,:) ); end nam = -1 * ones( [dims(1,:) Nmaps] ); curN = 0; for i=1:Nmaps for k=1:dims(i,2) for j=1:dims(i,1) nam(j,k,i) = curN; curN = curN + 1; end ...
3db062a09a5e0c5e4e4ba3f42bbe721b53ceebbc29df761417f99d225a0d68c9
MATLAB
335
18
function [ EKc_out , EKcw_out ] = subfun_disposalYeoFNData( EKc_raw ) EKc_out = []; EKcw_out = []; for i = 1:360 tmp = EKc_raw(EKc_raw(:,2)==i,1); ttmp = []; for k = 1:7 ttmp = [ttmp sum(tmp==k)]; end [~,loc] = max(ttmp); EKc_out = [EKc_out; loc]; EKcw_out = [EKcw_out; ttmp/sum(ttmp...