sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e7d13dbc78b71df4b3af1fac059713fcab2879cd9ccb0e3a0f8c58f6c2f7ee03
MATLAB
1,105
30
function [dip, p_value, xlow,xup]=hartigansdipsigniftest_ss(xpdf,nboot) % function [dip,p_value,xlow,xup]=HartigansDipSignifTest(xpdf,nboot) % % calculates Hartigan's DIP statistic and its significance for the empirical p.d.f XPDF (vector of sample values) % This routine calls the matlab routine 'HartigansDipTest...
f23561cb464383a43fbff884dc4562f0635b260548cbc79bf44ae7fbee84a6b0
MATLAB
1,105
44
function L = discreteDAGlogEv(X, G, alpha, ns, prior) % G is a D*D binary adjacency matrix for a DAG % X is an N*D matrix where X(i,j) in {1,..,K} % L = log p(X|G) assuming BDeu(alpha) parameterization % This file is from pmtk3.googlecode.com [N,D] = size(X); L = 0; if nargin < 3 alpha = 1; end if nargin < 4 ...
144df53338cab9a2f3fdacda42b1e7e659958102a9fce90cdb3cb6fca9a880a8
MATLAB
1,106
51
function F = angauss( I, s, r ) % ANGAUSS Anisotropic gaussian filtering. % INPUT: % Is - Input tomogram % s - Gaussian standard deviation % r - Aspect ration in Z axis, if 1 isotropic % OUTPUT: % S - Filtered output % % See also: diff3d % % AUTHOR: Antonio Martinez-Sanchez (an.ma...
30bb95ce08fe0fc766db06c6bd9eaf4866bfd646e2e4ef84f28596a96fc2de96
MATLAB
1,106
52
%% bifft % % "Block" Inverse Fast Fourier Transform (IFFT) % % <matlab:open('bifft.m') code> % %% Syntax % % AF = bifft(A,q) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % A n1 x n2 x p matrix % q frequency resolution (default: p) ...
56b00893089f16d11de5de6fc9dc6a136baed9b5e83025e0cc02700367ba9866
MATLAB
1,106
59
function err_total = error_depth_list(param_dist,xcn_list,xpn_list,R,T,X_shape_list,ind_list); N_view = length(ind_list); err_total = []; N_pts = zeros(1,N_view); for kk = 1:N_view, xcn = xcn_list{kk}; xpn = xpn_list{kk}; ind = ind_list{kk}; xpn = xpn([1 3],:); X_shape = X_shape_list{kk}...
970bc580366b5ccccdbcf1b64d639cb498817e9387a5b60e386dbc2fc59c27a2
MATLAB
1,106
33
function pdfcrop(h,hborder,vborder) %Make the paper size, the same as the figure size, (plus an optional %border). This is important when exporting figures to pdf for inclusion in %latex for example. % %h is the handle to the current figure and is returned by the matlab figure %command as in 'h = figure;' when a new f...
d459684e1716f7849195ddd2fd1921b0f42d35eaf4444a430427b811919cc304
MATLAB
1,106
32
function y=modulo(x,N); %MODULO Congruence of a vector. % Y=MODULO(X,N) gives the congruence of each element of the % vector X modulo N. These values are strictly positive and % lower equal than N. % % See also REM. % O. Lemoine - February 1996. % Copyright (c) 1996 by CNRS (France). % % This program is free softwar...
b36c746030ec82f92563d374dd04ef87e087fff0dc08d1a3fa3b2089acfab708
MATLAB
1,107
52
function [cr,ci,wins]=pwidentification(simmat,labels) % pwidentification -- perform pairwise identification from similarity matrix % matrix % function pwidentification(simmat,labels,p) % % [Inputs] % -simmat: Similarity matrix [pred x correct] % -labels: index matrix % % % % [Outputs] % -cr: all correct...
bb667c9a7636d84979a0af48a6d1c2ea21c3ee3802b9608cca407967d9ea5866
MATLAB
1,107
39
function basicexample() % Verify that Manopt was indeed added to the Matlab path. if isempty(which('spherefactory')) error(['You should first add Manopt to the Matlab path.\n' ... 'Please run importmanopt.']); end % Generate the problem data. n = 1000; A = ra...
c988ac0d3fa316cb84476ce8437185d72d3ad24f8be1311e7cb1c4c2268f6c76
MATLAB
1,107
34
function offsetAxes(ax, offset) % this function 'despines' the x- and y-axes, letting them begin at the % first tick mark % thanks to Pierre Morel & undocumented Matlab % and https://stackoverflow.com/questions/38255048/separating-axes-from-plot-area-in-matlab % % by Anne Urai, 2016 if ~exist('ax', 'var'), ax = gca; e...
cf8d143c7ad883c86fd8c1b84ef16b0ba98fd46d9f34ca782ad00084616c72ee
MATLAB
1,108
41
function [matrix_FDR Nsig_FDR pval tval matrix_uncorr001 Nsig_uncorr001] = network_onesample_ttest(matrix,alpha_FDR); % ======================================================================== % Ruslan Masharipov, October, 2023 % email: ruslan.s.masharipov@gmail.com % ==================================================...
2a0f3e383a2d049c4fb1d8a11cf15368e0041eca6cfd970bad7c153bcb341d20
MATLAB
1,109
30
function xRoiLo = shcropx(xCents,xRoiSz,xFarLeftThresh) xmid = xRoiSz/2; % a little sloppier here than in shcropy but shouldn't matter fprintf('Median of non-far-left: %.3f\n',median(xCents(xCents>xFarLeftThresh))); tfFarLeft = xCents<xFarLeftThresh; tfRegLeft = xFarLeftThresh<=xCents & xCents<=xmid; % normal distro...
467e493c7dfbd7121fbf6a0beda5c9329fb36dea0989109fe48f3cefd6522624
MATLAB
1,109
37
function injection_time=extract_injection_time [data,timestamps,info]=read_neuralynx_file('Events.nev'); if ~isempty(data) %FOR DREADDS%%%%%%%%%%%%%%%%%%%%%%%%%%%% injection_time=1e-6*CNO_injection(timestamps,data.EventStrings); else injection_time=[]; end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if isempty(injection_ti...
4bb913e035aab20118b95db2f92f3913e53516332a864b381b3d9eb9da99e034
MATLAB
1,109
48
function [Cp,Cpint,time,TAC_extended,weights]=setPatlak(plasma,plasma_time,time,TAC_extended,weights) %reference %Check Plasma t_Cp=plasma_time; Cp=plasma; if t_Cp(1)~=0 t_Cp=[0;t_Cp]; Cp=[0;Cp]; end %Check Tissue if time(1)~=0 %DIM=size(TAC_extended); temp=zeros(length(TAC_extended)+1,1); ...
8e301db36b31ee638f7994a96ea8254095a1a2cf0d355c1457f6a648b9c3a472
MATLAB
1,109
32
function locs = mypeakseek(x,minpeakdist) % Alternative to the findpeaks function. This thing runs much much faster. % It really leaves findpeaks in the dust. It also can handle ties between % peaks. Findpeaks just erases both in a tie. Shame on findpeaks. % % x is a row vector input (generally a timecourse) ...
b6e2edcb0aa5c5e76d72894de3c809a2512cb682b5cbf858e2500cc2821c7e18
MATLAB
1,109
24
PIC = min(IB(1:t_array(2)*10)); PICdesc = min(IB(t_array(2)*10+1:length(Itotal))); subplot(5,5,pos1+ib); plot(timeV,Itotal,'k','LineWidth',lwidth); hold on; plot(timeV,IB,'r','LineWidth',lwidth); hold on ; ylabel(' ', 'FontSize',10,'FontWeight','Bold'); xlabel(' '); % txt_PICs; if abs(PIC) < 0.1 && abs(PICdesc) < 0.1 ...
b7613a421b102388b13ae7adc0d37ce528f9f58f7be80426aa576458dccced8a
MATLAB
1,109
38
function varargout = loadvar(mat_file, var_name, varargin) %LOADVAR Loads one or more variables from a MAT file. % Usage: % X = loadvar(mat_file) % returns first variable in MAT file % X = loadvar(mat_file, var_name) % [X1, X2, ..., XN] = loadvar(mat_file, var_name1, var_name2, ..., var_nameN) % C = loadvar(mat...
c374334812d474a0f6b796775a10441843c78036a2289176d871ef3f2d1e1fca
MATLAB
1,109
50
function [key, precomp_grads] = MakeKeypoint(pix, xyScale, tScale, x, y, z, sift_params, precomp_grads) k.x = x; k.y = y; k.z = z; k.xyScale = xyScale; k.tScale = tScale; [key precomp_grads] = MakeKeypointSample(k, pix, sift_params, precomp_grads); return; end function [key prec...
23861625ba7182da6d5f4b16b4b829e39074a4c5f0f26c662eabc1e42d455cbe
MATLAB
1,111
35
function disp(t, name) %DISP Command window display for a ktensor. % % DISP(T) displays a Kruskal tensor with no name. % % DISP(T,NAME) display a Kruskal tensor with the given name. % % See also DISP, KTENSOR/DISPLAY, KTENSOR % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation. % This is the MATLAB Ten...
88cd634630fe140389062c0995d324566b2cfbc2082d04f1ab2d85e6cb587d8b
MATLAB
1,111
25
% Constructor for the Error Structure function errorStruct = errorStruct_new(N_FIELDS) %// Precast empty errorStruct= struct( ... 'fieldname', cell(1,N_FIELDS), ... 'reference', cell(1,N_FIELDS), ... 'x0States', cell(1,N_FIELDS), ... 'dof_px_correct', ...
97427979a45b560456ffeaf4df5b2b2a2ad7dfcb6ce6ff2bd9bff044d3cc96d9
MATLAB
1,111
39
function [p, np] = permtst1(dif, Nit) %PERMTST1 Permutation test for means of paired replicates % % [p, np] = permtst1(dif, Nit) % % The data vector dif contains the differences between two % 'treatments' or conditions. The function makes Nit Monte Carlo sign % permutations to find whether the two data sets that produ...
bfc40e433b1087022bfdd4a0257dc7f2d5e2593294667935279467151a7552d8
MATLAB
1,111
36
function h_imstack3ResizingFcn(handles) [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); str = get(handles.hideControls, 'String'); pos = get(handles.h_imstack3, 'position'); if strcmp(str, '<<') %large state defaultWidth = 801; elseif strcmp(str, '>>') %small state ...
d1e95ae157ca43938431a6d6ba3aa16dd9f422d6469ff35ffe03a5cb0ee56e33
MATLAB
1,111
32
function hs = binaryTreeApply( X, tree, maxDepth, minWeight, nThreads ) % Apply learned binary decision tree classifier. % % USAGE % hs = binaryTreeApply( X, tree, [maxDepth], [minWeight], [nThreads] ) % % INPUTS % X - [NxF] N length F feature vectors % tree - learned tree classification model % maxD...
e39faf26e86936d72bdaeea7b4b39ffdc7319b2ae71dbcf42a8cfa0d8b50e342
MATLAB
1,111
45
%% Display various plots of a multimodal 2D function, peaks() % %% % This file is from pmtk3.googlecode.com [X, Y] = meshgrid(linspace(-2.5,2.5,40),linspace(-3,3,50)); Z = peaks(X,Y); %% find optimum by exhaustive search Zmax = max(Z(:)); % 8.0752 [rowMax, colMax] = find(Zmax==Z); % max row 38, col 25 Zmin = min(Z(...
23b16bf9a2eb5ec0675e7971fe9d83005798ff7c61da3b0bbfc8d7cefd832576
MATLAB
1,112
67
%{ _ _ ___ _ __ __ _| |__ ___ ___ _ __| |_ / __| '__/ _` | '_ \/ __|/ _ \| '__| __| | (__| | | (_| | |_) \__ \ (_) | | | |_ \___|_| \__,_|_.__/|___/\___/|_| \__| # displayStatus **Syntax** ``` C.displayStatus() ``` **Des...
e6d6876829711b26ce5dca4301cff409ed62501d20ee5ca1ee0b47aae9405765
MATLAB
1,112
25
function trx = ComputeRelativeLandmarkPos_Body(trx) pos2 = trx.pos; nfrm = numel(trx.bodytrx.x); t0 = trx.bodytrx.firstframe; t1 = trx.bodytrx.endframe; pos2(:,1,t0:t1) = pos2(:,1,t0:t1) - reshape(trx.bodytrx.x,[1,1,nfrm]); pos2(:,2,t0:t1) = pos2(:,2,t0:t1) - reshape(trx.bodytrx.y,[1,1,nfrm]); c = reshape(cos(trx.body...
f1babf1e6f99c3be0dc55fac93f9bbaa0e85a01f4e5e12013965e87b22584f88
MATLAB
1,112
37
%% Learn GGM structure using graphical lasso on flow cytometry data % HTF 2e p637 %% % This file is from pmtk3.googlecode.com loadData('sachsCtsHtf'); % 7466 x 11 %lambdas = 36; %[36 27 7 0]; lambdas = [36 27 7 0]; % same as HTF p637 %lambdas = [logspace(5,0,5) 0]; S = cov(X)/1000; % same as http://www-stat.stanford....
1aaaa5795e4fe026ca3863548a8eec8aee6aad625eaa6d19e69aaef32d8d51a9
MATLAB
1,113
38
function rd_saveAllFigs(f, figNames, figNamePrefix, figDir, fileType) % % function rd_saveAllFigs(f, figNames, [figNamePrefix], [figDir], [fileType]) % % f is a vector of figure handles. [] to save all open figures. % figNames is a cell array of figure names % figNamePrefix is a string that will be the start of all fig...
83754ba065f7b2b8c8fd8157eb823eb65159a55189ca9370cc497e564d900152
MATLAB
1,113
34
function [Y,alpha] = VBA_spm_resample(X,alpha) % Basic resample function (when no Signal Proc. Toolbox) % FORMAT [Y,alpha] = spm_resample(X,alpha) % IN: % - X: a nXm matrix of n time series % - alpha: the ration of input versus output sampling frequencies. If % alpha>1, spm_resample(X,alpha) performs upsampling o...
8841731adf56ede49046584b5c5966e20e22dc3e071120a352a1be0d6f727d0c
MATLAB
1,113
44
function [ ] = NiceSave(figname,figfolder,baseName,varargin) %NiceSave(figname,figfolder,baseName,figtype) formats the figure for best viewing %and saves it as a .pdf in figfolder with name recname_figname.pdf % %INPUTS % figname string with title of figure % figfolder folder to save figure to % baseName ...
c568e37e58ab90e5d278b12dca182b16633c6ba39bc957c81543161e87fd48b0
MATLAB
1,113
20
function [ypeak, xpeak, MaxValue] = CorrRegionImage(CroppedImage, Image, yMinRange, yMaxRange, xMinRange, xMaxRange) if (nargin == 2) % Only two input arguments, search for max correlation over all image range CC0 = normxcorr2(CroppedImage,Image); % correlate CroppedImage(small area) and BestImage(full image) ...
2ea1d908f311ef77b218b56e10b3ecd47e08f6e3ad3bee8b3ab05f216f418a46
MATLAB
1,114
42
function [stimmat, stimparams] = getGratingFlashStimulus(stimdesc, spX, spY, bwflag) %UNTITLED Summary of this function goes here % Detailed explanation goes here Nwidths = numel(stimdesc.stripewidths); Nstimuli = sum(stimdesc.Nphases .* stimdesc.Norientations); stimparams = zeros(Nstimuli, 3); stimmat = zer...
d0f490baa5a35ff9f66288b55ddd749bb19a1064507055668c258376ca4525a3
MATLAB
1,114
37
function [Xtrain, ytrain, Xtest, ytest] = mnistLoad(classes, Ntrain) % Load a subset of mnist corresponding to chosen classes % Optionally take a subset of those to reduce training set size % There are about 6000 training examples of each class, 1000 test % This file is from pmtk3.googlecode.com if nargin < 1, class...
e24b3e4654d25e04f9498c6e0cadd7bebc842ecd0de09ff726dae694f0926300
MATLAB
1,114
35
function SetLblFilePathRoot(oldlblfile,newlblfile,oldroot,newroot) % oldlblfile = '/groups/branson/bransonlab/DataforAPT/JumpingMice/projects/202308avgc.lbl'; % newlblfile = '/groups/branson/home/bransonk/202308avgc.lbl'; % oldroot = 'X:\DataForAPT\JumpingMice' % newroot = '/groups/branson/bransonlab/DataforAPT/Jumpin...
44b11eab0de6cf79c27dd3d780b4f878653710a5d0a437f3a66a80eb446762dc
MATLAB
1,115
60
% _ _ % ___ _ __ __ _| |__ ___ ___ _ __| |_ % / __| '__/ _` | '_ \/ __|/ _ \| '__| __| % | (__| | | (_| | |_) \__ \ (_) | | | |_ % \___|_| \__,_|_.__/|___/\___/|_| \__| % % estimateDelay % % computes delays between all channels % and stores it in common % this is mean...
5595c2fca508b3656927adf3dda474d91dffbbb44926b7378030cc4af029b2a3
MATLAB
1,115
51
function [fx,dfdx,dfdp] = f_DCMwHRFext(Xt,Theta,ut,inF) % % DCM for fMRI evolution function (including Balloon model) % function [fx,dF_dX,dF_dTheta] = f_DCMwHRF(Xt,Theta,ut,inF) % This function evaluates the evolution function DCM for fMRI, including % the Balloon HRF model. ut = ut(inF.confounds.indu); nx = length...
8859d09cd5f5d66f083fbc6e13828c7e9a14fb96c28b60c5bf6162440565a5a5
MATLAB
1,115
35
function channel_map = channel_mapping( subject ) % % CHANNEL MAPPING % % INPUTS % subject - 'W' | 'T' % % OUTPUTS % channel_map - 2d array of channel numbers (rows, cols) % if strcmp( subject, 'W' ) % subset of MT channels channel_map = ... [ 45 53 36 60 13 21 4 28; ...
ab26a25d49bb7e6b24497990ffd633730b2cc56e3eebaae94126e5d1292f1a59
MATLAB
1,115
58
function [anybad,wh] = iimg_check_volinfo(maskInfo,imgInfo) % Checks a series of image .mat files and dims against a reference % (maskInfo) % % :Usage: % :: % % anybad = iimg_check_volinfo(maskInfo,imgInfo) % % :Inputs: % % **maskInfo** and **volInfo :** % are spm-style volume info structures % % see spm_v...
ba89d01e1c5010fb79bc8b09aef67fb37c2e0769c4eeb90f214bcd79e787fd07
MATLAB
1,115
50
function [rho pval] = circ_corrcl(alpha, x) % % [rho pval ts] = circ_corrcc(alpha, x) % Correlation coefficient between one circular and one linear random % variable. % % Input: % alpha sample of angles in radians % x sample of linear random variable % % Output: % rho correlation coeffic...
f57b1e79747220e71d70a9cb387b18fdbe0f1a581e69bca599206de214ff1894
MATLAB
1,115
46
function [gx,dgdx,dgdp] = g_rigid2D(x,P,u,in) % apply rigid body 2D spatial transform (rotation and translation) % function [gx,dgdx,dgdp] = g_rigid2D(x,P,u,in) % IN: % - x: [useless] % - P: the 3 rigid body transform parameters % - u: [useless] % - in: contains the original image (in.Y) % OUT: % - gx: vector...
48785b91cf32a88171e53d2324052b82b6bdcfa339b8b7922611ba2421db228a
MATLAB
1,116
49
%% Fit loopy MRF 1-2-3-1 using iterative proportional fitting % %% % This file is from pmtk3.googlecode.com clqs = {[1 2], [2 3], [1 3]}; NC = length(clqs); N = 3; % Some count data C = reshape([53 414 11 37 0 16 4 139], [2 2 2]); C = normalize(C); Cpot = tabularFactorCreate(C, 1:N); counts = cell(1, NC); for c=1:NC...
72291f9c6af2882ccfdf7f74edaa182c179dc2010086e4c5de3e46a84f322ce9
MATLAB
1,116
36
function y = pinvNx2(x) % PINVNX2 computes a pseudo-inverse of the slices of an Nx2xM real-valued matrix. % Output has dimensionality 2xNxM. This implementation is generally faster % than calling pinv in a for-loop, once M > 2 siz = [size(x) 1]; xtx = zeros([2,2,siz(3:end)]); xtx(1,1,:,:) = sum(x(:,1,:,:).^2,1); xtx...
ad2bfd5f15cb9f7111deb46795e9a1b5bb15254506993feeece1a6c676126fd0
MATLAB
1,116
56
function X = gaminv(P,A,B) assert((isequal(size(A),size(P)) && isequal(size(B),size(P))),'P, A and B must be of common size or scalars'); sz = size(P); X = zeros(sz); k = find((P < 0) | (P > 1) | isnan(P) | ~(A > 0) | ~(B > 0)); if (any(k)) X(k) = NaN; end k = find((P == 1) & (A > 0) & (B > 0)); if any(k) X...
c2bea7e85ddac6e422b67ba63472cdbe6a8321ed88549ca2fa4a608570defac9
MATLAB
1,116
38
% HIFDE_MV Multiply using hierarchical interpolative factorization for % differential equations. % % Typical complexity: O(N) in all dimensions. % % Y = HIFDE_MV(F,X) produces the matrix Y by applying the factored matrix F % to the matrix X. % % Y = HIFDE_MV(F,X,TRANS) computes Y = F*X if TRANS =...
0bab574a402269646e4cf908f916402432df16b756b8946a08cffc6e4351dfa4
MATLAB
1,117
43
% Written by Einat Peled % einatspeled@gmail.com % % Input: OneImage, should contain one spot (one mini event) % Output: keep only the top NumMaxPixels of OneImage function OneImage_CorrAmp_thresh_MaxPixels = GetMaxPixels(OneImage_CorrAmp_thresh, NumMaxPixels); % [i,j,v] = find(X) row, column, value OneIm...
1b38c5a78120d75608093a0105aef780d9b258ca26ecadd28663a4678803f4a7
MATLAB
1,117
36
function saveLbl(old_bundled_lbl,new_bundled_lbl,new_lbl_obj_savestruct) tname = tempname; mkdir(tname); try fprintf('Untarring old project %s into %s\n',old_bundled_lbl,tname); fnames = untar(old_bundled_lbl,tname); % AL20190424: untar() function output in blatant contradiction with % M-help ntname = numel...
552db51c7147076f393bea57ccfe3468520f484dc8fa4f25bea58986e47720b5
MATLAB
1,117
38
function v = calculate_bvc_tunings(v) sig_d0 = v.bvc.sig_d0; beta = v.bvc.beta; max_d = v.bvc.max_tuning; n_eqns = v.bvc.n_dist_tunings; alpha = sym('alpha'); eqn_vars = alpha; for i = 1:(n_eqns-1) eval(sprintf("x%i = sym('x%i');",i,i)); eval(sprintf('eqn_vars = [eqn_vars, x%i];',i)); end eqn1 = x1 == (x1/...
8013e4375272f22de010f7fe58639c30d1ed338f328e78303c863112f57f0152
MATLAB
1,117
41
function [isAFirst, ppInds] = GetTrihexyDrugConds(fNames) % function [conds, ppInds] = GetTrihexyDrugConds() % Load up the drug conditions from the TrihexyDrugConds.xlsx file, return % whether each person did A or B on their first session % % Inputs: % fNames is a cell array of strings containing TRI_000_0 (ID numbe...
3a1d7a317ce9de04080f2df694b8f34524acf9f73cccf1af3e588423e28c21d7
MATLAB
1,121
35
function h_saveAnnotationROI3(handles) global h_img3 [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); roiobj = sort(findobj(handles.imageAxes,'Tag', 'annotationROI3')); bgRoiobj = sort(findobj(handles.imageAxes,'Tag', 'BGROI3')); fiducialObj = findobj(handles.imageAxes, 'T...
e0494505e7802184e8b5769617da076e1a61e77741b93c8de65aaf7a31ae5a73
MATLAB
1,121
45
genename='MYC'; choose_pool=1; time=[0.5 1 2 4 8 16 24 48 72 96]; x=strcmp(c_name,genename); a=[]; a1=[]; a2=[]; a3=[]; gene_profile=c_pool(x,:); a(:,1)=mean(gene_profile(:,1:3),2); a(:,2)=mean(gene_profile(:,4:6),2); a(:,3)=mean(gene_profile(:,7:9),2); a(:,4)=mean(gene_profile(:,10:12),2); a(...
b9fc8848365c7298d183fbdbdc2cec8e170a9ee6481300492c081287c7f1855b
MATLAB
1,122
38
% HIFDE_SV Solve using hierarchical interpolative factorization for % differential equations. % % Typical complexity: same as HIFDE_MV. % % Y = HIFDE_SV(F,X) produces the matrix Y by applying the inverse of the % factored matrix F to the matrix X. % % Y = HIFDE_SV(F,X,TRANS) computes Y = F\X if T...
c05aed49ffd8b9739f8b0330fe57fb03d5b405fa69d940c8f4db169abaa44b90
MATLAB
1,122
38
function [adj, sz_links] = CBIG_components_subgraphs(adj) % Script to get components sub-graph. % % function [adj, sz_links] = CBIG_components_subgraphs(adj) % Input: % adj:adjacency matrix with values going from 1 to number of components with % more than 1 node. The script assues that the adj matrix is a symm...
d30779f276a9462920be4570cbf98e6c65dba53d7dcc615444250989ab42b7f7
MATLAB
1,122
41
function FBC = FbCrop( FB, delta ) % Crop a 2D filterbank (adjusting filter norms). % % Takes a filter bank and crops it by cropping off delta pixels from each % side. Ensures that the mean response of each filter is 0 and that the L1 % norm is 1, i.e. sum(sum(abs(F)))==1. % % USAGE % FBC = FbCrop( FB, delta ) % % INP...
5f3a4efc7d0321d388be7c3095849fe5d75af5f40d9cccb52ac8149ada4f22f9
MATLAB
1,123
37
% +------------------------------------------------------+ % | Phase Difference Measurement | % | with MATLAB Implementation | % | | % | Author: M.Sc. Eng. Hristo Zhivomirov 12/01/14 | % +--------------------...
f928984eb3fc08fff36000ea43517b0d1d9cd157bb9443e723fba15270106890
MATLAB
1,123
51
% Geometry of Ridge Regression %{ setSeed(0); mu = [3; 3]; sigma2 = 1; Sigma = [3,0;0,1]; N = 100; X = gaussSample(mu, Sigma, N); xbar = mean(X); mleCov = X'*X; %} xbar = [3;3]; S = [3,0;0,1]; Mu0 = [0;0]; Sigma0 = eye(2); hold on; %axis([-5 8 -4 8], 'nolabel'); axis equal gaussPlot2d(xbar,S,'color','r'); %gaussPl...
260a52dec93cb0f0bcbe8f113d4c17cf52b2194938f68b019fcd02bc1108d9c1
MATLAB
1,124
30
% CROSSCORRELATIONHISTOGRAM calculates cross correlation histogram at a given % crossCorrelationHistogram.m % % Copyright 2008 Vanderbilt University. All rights reserved. % John Haitas, Jeremiah Cohen, and Jeff Schall % % This file is part of JPSTH Toolbox. % % JPSTH Toolbox is free software: you can redistribute...
8b2e0940403a45529a7eceeafd8943cb6cca2605b188c8e12af28e9abdc43c16
MATLAB
1,124
40
function outpoints = tal2mni(inpoints) % Converts coordinates to MNI brain best guess % from Talairach coordinates % FORMAT outpoints = tal2mni(inpoints) % Where inpoints is N by 3 or 3 by N matrix of coordinates % (N being the number of points) % outpoints is the coordinate matrix with MNI points % Matthew Brett 2/2/...
a1681f537b341b5edded1e4bfcbaf7b306acec52cf3da799916f3f4f2414624d
MATLAB
1,124
43
function [flyid,trial,movpath] = parseSHfullmovie(m,varargin) noID = myparse(varargin,'noID',false); [flyid,idx] = regexp(m,'[\\/]fly?(\d+)[\\/]','tokens','start'); if isempty(flyid) [flyid,idx] = regexp(m,'[\\/]fly?(\d+)[\\/_]','tokens','start'); end if isempty(flyid) [flyid,idx] = regexp(m,'[\\/]fly_?(\d+)[\\/]'...
60c24bc10111aa33ab58276d5fe6b236b82a947760d4ce11e0cdf580a67ec776
MATLAB
1,125
36
function distance = distancePointToLineSegmentV(p, a, b) % distance = distancePointToLineSegmentV(p, a, b) % p is a matrix of points (d x n) % a is a matrix of starts of line segments % b is a matrix of ends of line segments % copied from % http://stupidmatlabhacks.tumblr.com/post/18727965430/distance-from-point-to-th...
ea3672471937235348b5a99a863f8a3b156d1a61b46f20bc35e2d1ffb3d8e4a4
MATLAB
1,125
43
function outTable = convertToTableCore(featureLexicon,inParams) % deal with optional arguments if nargin<2 || isempty(inParams) inParams=struct(); end %featureLexicon = ReadXMLParams(featureconfigfile); allpf = fieldnames(featureLexicon.perframe); pftypeList = {}; for pfndx = 1:numel(allpf) curpf = allpf{pfndx}; ...
7f657a717e979e0a086a5623633d5bdef72e2c99d55a0102c1dc17d8bbadaac4
MATLAB
1,126
40
function crc = CRC8(Vector, Len) % % COMPUTE CRC % CRC is the acronym of Cyclic Redundancy Check, and represents a function whose % input is a set of bytes (also called byte stream), and whose output is a numerical value, % usually a 16 or 32 bit integer. % The term CRC is used to refer to both the function a...
f8e3f4dc11d526ffccac4c34827e7b351a37d8f07b1a0d28120bb3535038a5ad
MATLAB
1,126
27
function DV = fplayer(P,beta,player,game) % derives the player's decision variable given a 2x2x2 payoff table % function DV = fplayer(P,beta,player,game) % The payoff table is such that game(:,:,i) is the Ui(a,b), the payoff % player i receives given that player 1 has played a and player 2 has % played b. The agent hol...
3b21a01dbe20f436dbe35462bc18f8bf9959fd2a424af6a5b63da7b184749cb4
MATLAB
1,127
43
function [lpos,lposTS,lpostag] = toarray(s,varargin) % Convert to old-style full arrays % % lpos: [npt x 2 x nfrm x ntgt] % lposTS: [npt x nfrm x ntgt] % lpostag: [npt x nfrm x ntgt] logical [nfrm,ntgt] = myparse(varargin,... 'nfrm',[],... % num frames in return arrays 'ntgt',[] ... % num tgts " ...
696a8038193b811556f7287fe7882f5a34081a6b1221e69cdaa3e399574a973b
MATLAB
1,127
34
function [theta,phi,inF,inG,x0] = prepare_metaToM(kToM_level,seq_length,game,role) % set basic params for meta-ToM learner engaging in dyadic games % function [f,g,theta,phi,inF,inG,x0] = prepare_metaToM(kToM_level,seq_length,game,role) % theta = [-2;-2]; % prior log-volatility (k-ToM & BSL) phi = [-1;0]; % (log-) te...
b03fd8e1c9faae927962f6df0d41c986aa1b070e100da0255bfa42c548246dc4
MATLAB
1,127
37
function [Dm, varargout] = do_variance_normalization(Dm) % [Dm] = do_variance_normalization(Dm) % Do variance normalization of rows. % Assumes stats/pandas representation: % rows are observations, cols are data dimensionality (or variables). % % Parameters % ---------- % Dm : matrix % ...
d2915538ca8741c516e008077d97b44624b275e6c402150bdd4b3d7e2d7b1dca
MATLAB
1,127
44
%% Reproduce figure 3 of Zou and Hastie JRSSB 2005 % %% % This file is from pmtk3.googlecode.com loadData('prostate'); ndx = find(istrain); y = y(ndx); X = X(ndx,:); X = centerCols(X); X = mkUnitNorm(X); y = centerCols(y); [n p] = size(X); lambda2 = 1000; w0 = larsen(X, y, lambda2, 0, 1); wLS = X\y; denom = sum(ab...
329c2727995f5f2b5bf7d2d43f2b10513185b9463e7c6795c656895aedb750d8
MATLAB
1,128
47
%% Get Cell Centered Grid % % Creates a cell centered grid matrix in either two or three dimensions. % the outputs are matrices (in two of three dimensions) containing cell % centers. Inputs are the cell dimension vectors for the three dimensions. % Note that they can be different sizes. % % % [X,Y,Z] = getCellCentere...
47a4688596bc66f201930f3f11fba8fa98d00baaa9bf77d5b9c7f25dc7cd213d
MATLAB
1,128
34
function [dat] = ft_preproc_rectify(dat) % FT_PREPROC_RECTIFY rectifies the data, i.e. converts all samples with a % negative value into the similar magnitude positive value % % Use as % [dat] = ft_preproc_rectify(dat) % where % dat data matrix (Nchans X Ntime) % % See also PREPROC % Copyright (C) 2008, Ro...
b81e10ac55ba636748a860747a40844336ed30e6f902043faf05278d10a99611
MATLAB
1,128
38
function m = size(t,idx) %SIZE Tensor dimensions. % % D = SIZE(T) returns the sizes of each dimension of tensor X in a % vector D with ndims(X) elements. % % I = size(T,DIM) returns the size of the dimension specified by % the scalar DIM. % % Examples % A = rand(3,4,2,1); T = tensor(A,[3 4 2 1]); % size...
f6a89824486e446540091c0eca5c2c1ca416485b8ee6eb09e0bf5fb54ee9ae91
MATLAB
1,128
1
function plotegfit(data, params, nbins) % Plots an histogram of data and overlay ex-Gaussian PDF with parameters params = [mu sigma tau] % data must be a vector % nbins is optional and allows explicitly setting the number of bins % (c) Yves Lacouture, Universite Laval % Version 2.0 27/02/03 [n,m]=size(data); if min(n,m...
29ac6bf6d32b8e150d84e3da254103e3fb200ef160a12a87f9d9560f983da0ae
MATLAB
1,129
47
%% Demonstrate training a chain-structured MRF % Based on % http://www.cs.ubc.ca/~schmidtm/Software/UGM/trainMRF.html % This file is from pmtk3.googlecode.com %% Get data setSeed(0); load rain.mat % X is 1059*28 y = X+1; % Convert from {0,1} to {1,2} representation % Plot what data looks like figure; imagesc(y(1:1...
41a4baa24890acbd20eaeca61f23dddb280e93ecec2c62978a5e90c9fccfe5c2
MATLAB
1,129
43
function [m,s,Y]=MD_mean_std(X) % Autoscaling function for MD % % INPUTS % X: data matrix % % OUTPUTS % m: mean % s: covariance matrix % Y: autoscaled data matrix % % Copyright (C) 2016 A. Folch-Fortuny and F. Arteaga % % This program is free software: you can redistribute it and/or modify % it under the terms of the ...
ec8854c30f38837914c84b71d1e51e1720182b3b1321f7ec28b70698e8310db2
MATLAB
1,129
51
%% Several ways of implementing weighted least squares % This file is from pmtk3.googlecode.com setSeed(0); N = 100; D = 5; X = randn(N,D); w = randn(D,1); y = X*w + 0.1*randn(N,1); rk = rand(N,1); % positive weights % Method 1 RRk = sqrt(diag(rk)); W1 = ((RRk*X) \ (RRk*y)); yhat = X*W1; sigma2_1 = sum(rk .* (y-yha...
543438a9c26277234f2daeea839a58bf0fc5f22f2c38d0709535493cea53143a
MATLAB
1,130
43
function Xrbf = rbfComputeFtrs( X, rbfBasis ) % Evaluate features of X given a set of radial basis functions. % % See rbfComputeBasis for discussion of rbfs and general usage. % % USAGE % Xrbf = rbfComputeFtrs( X, rbfBasis ) % % INPUTS % X - [N x d] N points of d dimensions each % rbfBasis - rbfBasis struct...
734b7d4917d02be2a988079433abf2bf03c952b903511b797681108521d178d5
MATLAB
1,130
40
clear all clc tmp=pwd; cd .. addpath(genpath(fullfile(pwd, 'utils/'))); addpath(genpath(fullfile(pwd, 'spmutils/'))); cd(tmp); % prefix of the subject folders folder_prefix='Subj'; % prefix/suffix of corresponding T1 files file_prefix='Subj'; file_suffix='.nii'; image_dir=fullfile(pwd, 'imgs'); group_m...
783933e317098c0e9dd93ba13a1ac63216548f1ad2180eab8b2db923ce4f79e9
MATLAB
1,130
33
function [h] = boxplot_grouped(data,group,group1_label,group2_label,color,legend_flag) %Boxplot for 2 independent variables % INPUTS TYPE DESCRIPTION % % group double categorical array describing conditions (4 in total) for data % array % group1_label cell...
edeab26ecd6fbeac54c3f21bdaa44b3867ec0a15474116f5b2a8aeadcff3e1a8
MATLAB
1,130
24
clear all %% %Define Parameters [opt] = ParameterOptions(); %% %Generate Pathway Amplitude & Gradient Waveform basis set %First Dictionary [PathwaySignalFirstOrder,GwaveFirstOrder,TransFirstOrder] = PathwayOperatorOrder(opt,'First'); %Second Dictionary [PathwaySignalHigherOrder,GwaveHigherOrder,TransHigherOrder] = Path...
0450bb6a22e478ac2977b6b4b84713a1a8ac5dd6e77ba9f0ae36fb43024bb404
MATLAB
1,132
45
% DurationPlaceForFluorescencePLSR.m % Sarah West % 7/27/23 % Takes duration_place for cont. rest & walk averaged across 1 second % You don't have to worry about rolling overlap, becuase you don't do that function [parameters] = DurationPlaceForFluorescencePLSR(parameters) MessageToUser('Duration for ', parame...
37bd9affe826c943c6ac6becd59aa2d7426ecf03673a96feae587d25213b6684
MATLAB
1,132
23
%% Hjorth parameters % Hjorth Activity 活动性:衡量信号波幅的偏离程度,是时间函数的方差var % Hjorth Mobility 移动性:衡量坡度的变化,为信号一阶导数方差的平方根 除以 信号方差的平方根 % Hjorth Complexity 复杂性:衡量一个振幅上有多少个标准的坡 % X: single channel EEG signal (either a row vector or a column vector) % See also: % feat_HjorthActivity, feat_HjorthComplexity %% Reference % ...
5c907d3bd2a42eb3de58f83571d985e862a20210a9a0c76ee9dc304845d6c881
MATLAB
1,132
47
% _ _ % ___ _ __ __ _| |__ ___ ___ _ __| |_ % / __| '__/ _` | '_ \/ __|/ _ \| '__| __| % | (__| | | (_| | |_) \__ \ (_) | | | |_ % \___|_| \__,_|_.__/|___/\___/|_| \__| % % callback when channel_label_picker is used function updateChannel(self, src, ~) d = dbstack; i...
b49ca2cafc02a85b70f2d3116869fe14eba9da7383e07fd05a13ef24b431ae8f
MATLAB
1,132
39
function f = filterBinomial1d( r, show ) % 1D binomial filter (approximation to Gaussian filter) % % Creates a binomial filter of size 2*r+1 x 1. This can be used to % approximate the Gaussian distribution with sigma=sqrt((2*r+1)/4). For % large r, should give same output as: % g = fspecial( 'Gaussian', [2*r+1,1],sqr...
bf68151043ded1e2c751e5cf572a45f073a5b1260724e7464bd5449eea21d11a
MATLAB
1,132
43
function [pg, name] = pmlChapterPages(tocfile) % Return a list of the starting, (hard cover) pages of the chapters in PML. % (skips the preface so that pg(1) = 1, not e.g. xxv) %% Input % tocfile - the path to the pml.toc file % (default = C:\kmurphy\local\PML\Text\pml.toc) % %% Output % % pg - a list of the startin...
5265a81114a9659d41b3e5cb4d0bb8fc7342f4fd0d9edf0adb54078d6d314e91
MATLAB
1,133
40
function [ ] = computeTBrain( ws ) %The function generates a vector of t values comparing the consistencies %along the blue and red dimensions for all voxels in the brain %write message to screen sprintf('Computing voxels'' temporal consistency asymmetry cofficients') %% set empty vectors [t_vec, p_vec] = deal(nan(s...
5e5cb45ccdaee7cc2bf26136a76c44427d65009929f2933234313e4f46592301
MATLAB
1,133
37
function C = mrdivide(A,B) %MRDIVIDE Slash right division for sparse tensors. % % MRDIVIDE(A,B) is called for the syntax 'A / B' when A is a sparse % tensor and B is a scalar. % % Example % X = sptenrand([4 3 2],5); % X / 3 % % See also SPTENSOR. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation...
88e5b1bb1309edfbd61c7e810d070eb86a4117d52ceefa709d858d7057c13041
MATLAB
1,133
37
function C = mldivide(A,B) %MLDIVIDE Slash left division for sparse tensors. % % MlDIVIDE(A,B) is called for the syntax 'A \ B' when A is a scalar and B % is a sparse tensor. % % Example % X = sptenrand([4 3 2],5); % 3 \ X % % See also SPTENSOR. % %MATLAB Tensor Toolbox. %Copyright 2015, Sandia Corporation...
a171940e1a74bba75003f609abe6913586e810e1535a9c07dc04fa66f2aaaadb
MATLAB
1,133
37
classdef (Sealed) NetworkTypes % defines the available network types % as enumeration (available at R2013a) enumeration LinLatt, SqrLatt, CircSqrLatt, CubLatt, ComplGraph, BarabAlbGraph, HolmeKimPLGraph, WattsStrogGraph, ConnWaStGraph, ...
c4f883f13335037a85ae2934cb7f6d1ccc3336ccc1f997420ec82c636aec11cb
MATLAB
1,133
28
%% Draw from truncated normal distribution function samples = DrawFromTruncatedNormal( mu, sigma2, lowerBound, ... upperBound, nSamples) % Draw nSamples from a truncated normal distribution with mean mu and % cariance sigma. Truncation is acheived by resampling if the drawn ...
ee16223a2d5a73212840304efc4aea987bfb0cd2500fc0be96764c72f0aa9d37
MATLAB
1,133
32
function DM = ft_preproc_online_downsample_init(factor) % function DM = ft_preproc_online_downsample_init(factor) % % Initialize an downsampling model with the given factor. % Copyright (C) 2010, Stefan Klanke % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and details....
f52491fd0fbf20654adacef287c2b21cd06ab4ce126feac869010586097a10a3
MATLAB
1,133
53
%% Reproduce Figure B.1 p447 from Bernardo94 % %% % This file is from pmtk3.googlecode.com ns = [5 20]; [styles, colors, symbols] = plotColors; for ni=1:length(ns) n = ns(ni); mus = -1.8:0.1:1.8; M = length(mus); n0 = 1; n0B = 5; mu0 = 0; r1 = (1/n) * ones(1,M); r2 = (pi/(2*n)) * ones(1,M); r3 = (mus-mu0).^2; r4 = ...
0730025c2ab089e7f34108c744fd1103d7829609ba277e0395f859dd09204238
MATLAB
1,134
48
function outIndex = multinomialR(inIndex,q); % PURPOSE : Performs the resampling stage of the SIR % in order(number of samples) steps. % INPUTS : - inIndex = Input particle indices. % - q = Normalised importance ratios. % OUTPUTS : - outIndex = Resampled indices. % AUTHORS : Arnaud Doucet an...
14144ff2a5a96a29c9b8636888b4ac26e5ce6e04177d1fa42097ad1a808f5c34
MATLAB
1,134
29
function timeout(fExpr, fTimeout) % TIMEOUT Interrupt execution of script of function after specified period of time % % fExpr - MATLAB expression, function or script to run % fTimeout - timeout in seconds % % This function uses undocumented command window method to % programatically send Ctrl+C after sp...
8ec7dc92816c62472a7b6d83d18700465f63eef09d6d60e0dc734458278e22fb
MATLAB
1,134
30
function Draw_Foci(foci,faces) % This function draw spheres of a specified color and radius at the % location given by the structure foci. Fields include: location, color, % radius. It is assumed that coordinate space and voxel-index space are % exactly aligned. foci.color are rows of RGB values [0,1]. if ~exi...
9bc0a96d54bdeebcc04a8569e86a7e5a7afe7c319d2cb914558d39c320dbdc4e
MATLAB
1,134
21
function test_AR_GRONe_SA_training_conda() % Test training on a project using some of AR's flybubble videos. % That project is a multianimal project. if ispc() , warning('conda backend is not supported on Windows, so %s always passes on Windows', mfilename()); return end linux_project_file_path...
eb0f3db87058cf349d1fa9c91c24ab6f06d878e21eb4218b01a44d2a9deb8d6c
MATLAB
1,134
33
function [N,M]=divider(N1); %DIVIDER Find dividers of an integer. % [N,M]=DIVIDER(N1) find two integers N and M such that M*N=N1 and % M and N as close as possible from sqrt(N1). % % Example : % N1=258; [N,M]=divider(N1) % F. Auger - November 1995. % Copyright (c) 1996 by CNRS (France). % % This program is free so...
2d315f98739c1e92e3524bdac096ba2ae37a3c7b8215d28a1cafb16322c8cd5c
MATLAB
1,135
30
function [tau] = fit_tau_to_data(euclidean_distances,similarity_distribution,df,v) fun = @(x) tau_fit(df, v, similarity_distribution, euclidean_distances, x(1)); tau = ... fmincon(fun, ... v.fit.tau_init, [],[],[],[], v.fit.tau_lb, v.fit.tau_ub, [], ... optimset('TolX', 0.0001, 'TolFun', 0.0001, 'MaxFunEv...
6b3278346a733718a1acdff3aef34771b44b98fcd5bf31951605175d666b9b41
MATLAB
1,135
36
function [lh,th,mm] = annotate_ttest_data(ax,x1,x2,y_level,capSize,y_symbol_mult,label,symbol,labelArgs,symbolArgs,lineArgs) if (nargin < 5) || isempty(capSize) capSize = 2; end if (nargin < 6) || isempty(y_symbol_mult) y_symbol_mult = 2; end if (nargin < 7) || isempty(label) ...
fb9d6602a8fd52ed7f2c3054cc111eab8f8c300c8b415cd60b4763d42e4f610f
MATLAB
1,135
28
function [kept,added]= ... setDifferencesScoreFeatures(scoreFeaturesOld,scoreFeaturesNew) % Given an old and new scoreFeatures, computes a boolean array that tells % which elements of the old one are retained in the new one (kept), and a % boolean array indicating which elements of the new one are not present in % th...
320bd72493c02cd48d892a42fd95002c0837356ef81108a2f3042908d9e260c9
MATLAB
1,136
33
function [h,p] = VBA_groupBMC_btwGroups(Ls,options) % test for between-groups difference in model frequencies % function [h,p] = VBA_groupBMC_btwGroups(Ls,options) % IN: % - Ls: {nmXns_1, nmXns_2} array of log-model evidences matrices of each group (nm models; ns_g subjects in the group). % - options: a structure c...
a47ea2ca9b7294d7816b6728996238b040b153f032ce2f5197662c7e93895697
MATLAB
1,136
43
function [u] = get_U_basis(T,dt,n,btype) % build input basis function set on temporal grid % function [u] = get_U_basis(T,dt,n,btype) % IN: % - T: end time (in sec) {1e2} % - dt: temporal resolution (in sec) {1} % - n: number of basis functions {16} % - btype: 'Fourier' or 'RBF' {'Fourier'} % OUT: % - u: nX(T...
66ecf2702cfe9b8d5075d949790f69297a933ee4ddfdb67e8c3a3a477741dc5d
MATLAB
1,137
45
function model = rvmSimpleFit(X, y, gamma, varargin) %% Fit a relevence vector machine, i.e. logreg + rbf kernel + ard % Does not use sparseBayes package, so is much slower % This file is from pmtk3.googlecode.com pp = preprocessorCreate('kernelFn', @(X1, X2)kernelRbfGamma(X1, X2, gamma)); K = nunique(y); if K <= ...