sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
2f4e8599dff68947843a24bfd88989f5e3ca66950a4801099093b98113b37728
MATLAB
1,202
22
function sp_min2nat_apply(fn_mni_para,fn_mni_mask,fn_nat_img,fn_y_def,saving_dir) % this is subject-specific process [~,fn] = fileparts(fn_nat_img); matlabbatch = {}; matlabbatch{1}.spm.util.defs.comp{1}.inv.comp{1}.def = fn_y_def; matlabbatch{1}.spm.util.defs.comp{1}.inv.space = fn_nat_img; matlabbatch{1}.spm.ut...
4b3eb9acd72fff55e24e7042d851fe134af9442cf105a4f4d124e1824eea98c6
MATLAB
1,202
34
%% normpdfcol2zero % A method to nomalize the negative components of a column vector/ SDO such % that the sum of the column is 0. % % Copyright (C) 2023 Trevor S. Smith % Drexel University College of Medicine % % This program is free software: you can redistribute it and/or modify % it under the terms of t...
69c89fabcfa8abd8df413478e49008469f6f2a11e56d18854610dd9c2bda82f0
MATLAB
1,202
31
function [ pulseTime, pulseRecorded ] = utils_WaitForTRPulse( trLength, triggerKey, inputDevice, timeToWait ) % (c) Coraline Rinn Iordan 10/2017 if nargin < 3, inputDevice = -3; end if nargin < 4, timeToWait = inf; end pulseTime = -1; pulseRecorded = false; loopDelay = 0.0005; % half a milisecond! timeout = 0.050; % ...
978869592376646331163fc0f241bb6868bbd3b464c6b812b90d78976e4433ab
MATLAB
1,202
21
%% Line (Trapezoid) kx = linspace(-5,5, 256)'; ky = 0*kx; kz = 0*ky; C = [kx ky kz]; [C_rv, time_rv, g_rv, s_rv, k_rv] = minTimeGradient(C,0, 0, 0, 4, 15, 4e-3); % Rotationally variant solution [C_riv, time_riv, g_riv, s_riv, k_riv] = minTimeGradient(C,1, 0, 0, 4, 15, 4e-3); % Rotationally invariant solut...
c24b8c7c5a8360e04f5d48a5a3f0c79a739f4543e98633d108cae2e27cd4f2a9
MATLAB
1,202
31
function [ pulseTime, pulseRecorded ] = utils_WaitForTRPulse( trLength, triggerKey, inputDevice, timeToWait ) % (c) Coraline Rinn Iordan 06/2018 if nargin < 3, inputDevice = -3; end if nargin < 4, timeToWait = inf; end pulseTime = -1; pulseRecorded = false; loopDelay = 0.0005; % half a milisecond! timeout = 0.050; % ...
1c782750949a6aae063812bbda0cb963d5b029a5eecec1247886cb66bb9ff790
MATLAB
1,203
34
% This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful,...
1d97e98d118cc49953822dc07607468df8ec26148d813c2bc58f5ff88fa41d5e
MATLAB
1,203
46
function relativePath = h_getRelativePath(path1, path2) % this function try to get the relative path from path1 to path2. length1 = length(path1); length2 = length(path2); minLength = min([length1, length2]); ind = find(~(lower(path1(1:minLength))==lower(path2(1:minLength))),1);%1:ind-1 are the same for bo...
2e1c8a8835e1a414bc437bb8bc7a8d606c3f2e4d7f62fc7d0986d657c86d2b4c
MATLAB
1,203
43
function local = islocal(varargin) % Return true iff the method is locally defined in the class % which means % % (1) the method is implemented in the class, (or at least abstractly defined so long as allowAbstract = true) % (2) the method is not the class constructor % (3) the method is public % (4) the method is not ...
36e51c75dfe56bf2ba93a9d6806f24f994d54da899b5f21fcdf67c39f6d6c5c9
MATLAB
1,203
45
function [S,Vx,Vy,Vz] = getsaliency( I, s, mode ) % GETSALIENCY Get ridge saliency and its normal % INPUT: % E - Input tomogram (foreground bright), input data must be single and double % s - smoothing scale % mode: 1-> analytical (fastest), 2-> hybird (intermediate) ohterwise-> Jacobi % (...
5a84008752e471e0e35d560de5ec8c15afdbce71f4309fd70d6b5ae63caedbee
MATLAB
1,203
30
% subspace estimations are based on permutations - values won't be excactly % the same as in the paper nPCs = 5; P1 = [eye(nPCs); zeros(nPCs,nPCs)]; P2 = [zeros(nPCs, nPCs); eye(nPCs)]; eigvals_1 = eigs(Xcov{1}, nPCs, 'la'); eigvals_2 = eigs(Xcov{2}, nPCs, 'la'); % variance explained for each condition in ...
9741359d676962f9b4f8b4207e288e202ae0cd2b0d3361591a95789966fa0c05
MATLAB
1,203
37
function [FD_abs, FD_rms ] = compute_FD(mp,flag) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [FD_abs, FD_rms, FD_rmsvd ] = compute_FD(mp,afniflag) % mp: nT x 6 rigid body head movement estimates % flag: 2 if motion parameters are estimated using FSL % 1 if motion parameters are estimated usi...
b756d404dcbbd80adaf7be70c4b247787d52e61266de3a4a640f98c635303644
MATLAB
1,203
30
% subspace estimations are based on permutations - values won't be excactly % the same as in the paper nPCs = 5; P1 = [eye(nPCs); zeros(nPCs,nPCs)]; P2 = [zeros(nPCs, nPCs); eye(nPCs)]; eigvals_1 = eigs(Xcov{1}, nPCs, 'la'); eigvals_2 = eigs(Xcov{2}, nPCs, 'la'); % variance explained for each condition in ...
f56717c4e71526796eac65e2546eb2912bc50fab473d15475f1ef480ec91dddb
MATLAB
1,203
42
function [ft,tBreak]=essential_distMinAnglePair_ftFromQ(t,Q1,Q2,varargin) kFlip=1; term='both'; ivarargin=1; while(ivarargin<=length(varargin)) switch(lower(varargin{ivarargin})) case 'kflip' ivarargin=ivarargin+1; kFlip=varargin{ivarargin}; case 'term' ...
0b5e02614e2ccd3aff95a81d818efc091168abfbc3c0cbcb3d49540b336d5526
MATLAB
1,204
50
%% Make the lung cancer dgm % %% % This file is from pmtk3.googlecode.com function dgm = mkLungCancerDgm(toporder) % S % / \ % v v % CB LC % \/ \ % v v % SOB X if nargin < 1, toporder = true; end if toporder S = 1; CB = 2; LC = 3; SOB = 4; X = 5; names = {'S','CB','LC','SOB','X'}; e...
55020817feb66eed06549fcac5d60a46fd772a27c97d1337903ca0b4372358ec
MATLAB
1,204
33
function result = fillInCustomStage1(rawTCI2, stage1Spec) % Used to fill in the type of stage 1 in a custom two-stage tracker. % This is a pure function. if ~isempty(stage1Spec) if iscell(stage1Spec) , stage1ConstructorArgs = stage1Spec ; result = stage1ConstructorArgs ; elseif isa(stage1S...
e2a388daf3226e29ff4301c1d0d0e59943fe6bd7b9c042f107cbac123481d0d7
MATLAB
1,204
51
function smart_3D_plot(mask,xyz,PET2D,hemi_scan,vox_size,angulation,figures_dir,vessel) x=xyz(:,1); y=xyz(:,2); z=xyz(:,3); indx=sub2ind(size(mask),x,y,z); PET_voxs=PET2D(indx,:); peaks=max(PET_voxs,[],2); %% figure() subplot(121) isosurface(mask) % hold on % p = patch(isosurface(vessels_PET,0.5)); ...
153ee92e40e63951ff531bb9f1b2fa82f1c06cab66b5623074f0b26302fe2e45
MATLAB
1,205
55
%% PPCA Imputation Demo % Reproduce fig 12. 11 from Bishop's book % % Data from http://www.ncrg.aston.ac.uk/GTM/3PhaseData.html %% % This file is from pmtk3.googlecode.com loadData('oilFlow3Class'); ndx = 1:1000; X = DataTrn(ndx,:); % 1000x12 y = DataTrnLbls(ndx,:); % 1000x3 setSeed(0); [C, ss, mu, Z, Ximputed] = ...
11fd873232334f30fe71e9d52c1d9b8c04370e374198b5044150ed34fb6908cb
MATLAB
1,206
45
function [S,Vx,Vy,Vz] = getsaliency( I, s, mode ) % GETSALIENCY Get ridge saliency and its normal % INPUT: % E - Input tomogram (foreground bright), input data must be single and double % s - smoothing scale % mode: 1-> analytical (fastest), 2-> hybird (intermediate) ohterwise-> Jacobi % (...
21e53dd0a1685273db5f1f100040e6e230a0a97be7589eacc3a22e15c30d9066
MATLAB
1,206
64
function [boxedX,Bx,By]=boxpdf(X) % Forces the pdf of data to have a boxed distribution using a data adaptive lookup table. % % [boxedX,Bx,By]=boxpdf(X) % % boxedX=N(X) where N is an data adaptive monotonically increasing function. % boxedX vary between zero and one. % % Bx,By describes the lookup table % % (c) As...
427fcfd9127390a05c3844b7bdd1026fc22aff1612227b244b70b74560ee9562
MATLAB
1,206
39
%% Plot an MVN in 2D % %% % This file is from pmtk3.googlecode.com model = struct('mu', [0 0]', 'Sigma', [2 1.8; 1.8 2]); figure; plotContour(@(x)gaussProb(x, model.mu, model.Sigma), [-5 5 -10 10]); title('full'); printPmtkFigure gaussPlot2dDemoContourFull figure; plotSurface(@(x)gaussProb(x, model.mu, model.Sigma)...
4d380d7c59018cb637e33000cb1680fd7976f3397ae0d2862cbe01c0d76de5e4
MATLAB
1,206
33
function [D,P] = dijkstra( G, varargin ) % Runs Dijkstra's shortest path algorithm on a distance matrix. % % Runs Dijkstra's on the given SPARSE nxn distance matrix G, where missing % values mean no edge (infinite distance). Uses a Finonacci heap resulting % in fast computation. Finds the shortest path distance from ev...
89b7df306cff521452546a37b2c4e864fb512b274496c35407f243f25b8e2537
MATLAB
1,206
41
function [uniquedays,sxperday,hax,hfig] = PlotLabeledReachPosXStdPerMouse(labeldata,Sperday,uniquedays,varargin) [hax,hfig,mousename] = myparse(varargin,'hax',[],'hfig',[],'mousename',''); if isempty(hax), if isempty(hfig), hfig = figure; else figure(hfig); end hax = gca; end for i = 1:numel(labeldat...
be11e5b46b138a4df1690636defeb27c12bbb0b5ee0d2cc48fe6d38cd8131cdb
MATLAB
1,206
53
function [C, grps, G] = grp2cell(X, G, dim) %GRP2CELL Splits an array into a cell using a grouping variable. % Usage: % C = grp2cell(X, G) % C = grp2cell(X, G, dim) % [C, grps] = grp2cell(_) % % Args: % X: array with at least one dimension of the same size as G % G: grouping variable vector % dim: dimensio...
3907621ee32570d5c2ab5ab06c59fc16bf8fb321cb9c7db7c2fe4e97b2425e86
MATLAB
1,207
57
%% Cluster yeast data using Kmeans % This file is from pmtk3.googlecode.com setSeed(0); loadData('yeastData310') % 'X', 'genes', 'times'); figure;imagesc(X); %colormap(redgreencmap) % bioinfoToolbox colormap(redgreenColormap) xlabel('time') set(gca,'xticklabel',times) ylabel('genes') title('yeast microarray data') ...
722daf873ecdfd7dbd2f93027c8b3602bccaf6c14d15e5a6f80129334c99f602
MATLAB
1,207
43
%% Visualize projection onto the principal components % %% % This file is from pmtk3.googlecode.com setSeed(0); n = 5; X=[randn(n,2)+2.*ones(n,2);2.*randn(n,2)-2.*ones(n,2)]; [n d] = size(X); %%% [W, Z, evals, Xrecon2, mu] = pcaPmtk(X, 2); Xrecon1 = Z(:,1)*W(:,1)' + repmat(mu, n, 1); figure; plot(X(:,1), X(:,2), '...
551ac731c571f4a265cc395e14981afd0593abf9aacb75a55a217fe95fafc90b
MATLAB
1,208
55
%% var_decay % % Decay VAR coefficients % % <matlab:open('var_decay.m') code> % %% Syntax % % A = var_decay(A,dfac) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % A VAR coefficients matrix % dfac decay factor % % _output_ % % A ...
65e3d0042b0e2f9d11b4a600ae25b8cdc803b4c619040298b1c8060cca2c02d9
MATLAB
1,208
40
% CheckIfCorruptFast.m % Sarah West % 9/2/21 % Checks if a file/stack is corrupt WITHOUT HAVING TO LOAD IT :D % Basis code is from https://stackoverflow.com/questions/38325121/check-if-mat-file-is-corrupt-without-load % matfile doesn't need to load in the whole file, and it issues a warning % if the file is corrupt. ...
95f0062e1f10917b3778a63ef1d179cc2d218afc3ecd2cdb915b956718b6efe3
MATLAB
1,208
47
function [fx] = f_HH(Xt, Theta, ut, inF) % Hodgkin-Hoxley membrane potential evolution function % function [fx] = f_HH(Xt,Theta,ut,inF) % IN: % - Xt: system's states, ie: % Xt(1): membrane depolarization (mV) % Xt(2:4): type I-II-III ion channel opening probabilities, in % inverse-sigmoid space (Gau...
fde15ed3dc720ec58b82c95ab3955c21394414095b6a0b47f90256eee21ad94b
MATLAB
1,208
52
%% Plot Linear Gaussian CPD p(y|x) = N(Y|a + bx, sigma) % Here a is the offset and b is the slope. %% % This file is from pmtk3.googlecode.com [xtrain, ytrain, xtest, ytestNoisefree, ytest] = polyDataMake('sampling','thibaux'); n = size(xtrain,1); Xtrain = [ones(n,1) xtrain]; w = Xtrain\ytrain; ntest = size(xtest,...
93aca8f0a5831b7327c07a9dd3bef7d7c0e503e66cc40e1e6ce488213eae73d7
MATLAB
1,209
30
%% Download Datasets %% download and save the walking chamber dataset websave('WalkingChamber.zip','https://www.dropbox.com/scl/fi/6d94o2k25hb2qup10e9ih/WalkingChamber.zip?rlkey=898sc0dxy1xevj5nv5x0inyf1&st=5k81ukyr&dl=1'); movefile WalkingChamber.zip Data.zip if ~exist('WalkingChamberCodeBase/Data', 'dir') mkdir(y...
9b54326f3c0df12913aad04369d0275c2a3777da8a28253e0cdd5b2d877e19e3
MATLAB
1,209
47
function [h_plot] = plotLogTuning2D(xvals, yvals, tuningcurve) %UNTITLED Summary of this function goes here % Detailed explanation goes here yy = zeros(numel(yvals)+1, 1); alldiffsy = diff(yvals); yy(2:end-1, 1) = yvals(1:end-1) + alldiffsy/2; yy(1) = yvals(1) - alldiffsy(1)/2; yy(end) = yvals(end) + alldif...
b60ec0af4a542def24a061483615cc728f5341856b4d247643fcf35b170c8028
MATLAB
1,209
45
function softev = localEvToSoftEv(model, localev) % Convert local evidence to soft evidence % localev(:,t) is vector of observations for node t % softev(k,t) is p(st=k| ev(:,t)) using model.localCPDs{t} % % Model can be any model with these fields: % localCPDs, localCPDpointers % If model.obsType = 'localev', % we ju...
bbf0cffa135f9c05efe4f20ab30c706d7b36f74c8e0b8aa37bdc0a02347c97dc
MATLAB
1,209
37
function X = matrandnorm(varargin) %MATRANDNORM Normalizes columns of X so that each is unit 2-norm. % % X = MATRANDNORM(M,N) creates a random M x N matrix with randomly using % normally distributed enries and then rescales the columsn so that each % has a unit 2-norm. % % X = MATRANDNORM(X) rescales the column...
d3011404fd7dab576a4ca456fc550800f36e07a373aadef9b89f87c24e3b450e
MATLAB
1,209
53
%% Probit Regression Demo % %% % This file is from pmtk3.googlecode.com setSeed(0); N = 100; D = 2; X = randn(N,D); w = randn(D,1); p = 0; y01 = flipBits(double((X*w>0)), p); % add some label noise ypm1 = sign(y01-0.5); if statsToolboxInstalled wGlm = glmfit(X,y01,'binomial','link','probit','constant','on'); N ...
e0b6b4cbf52740a46bad692862fd05a6822f5215b6164b099009ca904e9c6c17
MATLAB
1,209
52
function h = PhasePlot(x,y,phase,sz,varargin) % Plots arrows indicating the phase on current axis. % % [h,yy,zz] = PhasePlot(x,y,phase,sz[,ArrowParameters]) % % % Requires the Arrow function by Erik A. Johnson. % % Note: Arrows will get skewed if you resize the axis. % % Aslak Grinsted 2003 % ----------------------...
22447801a925641f674727c2a6b676a040be781b4df02b4773658622f9fece86
MATLAB
1,210
43
function [Y_out, Y0] = j_detrend2b(Y_in, L, dim, norm_opt, med_opt) % [Y_out, Y0] = j_detrend2b(Y_in, L, dim, norm_opt, med_opt) % Input % L: Number of frames over which to compute moving baseline Y0 % dim: Dimension across which to compute Y0 % norm_opt: Option to compute output as (Y-Y0)/Y0 (...
eeff0eec1fa554c7abf613824abe11578ed41609c9f3031abc8a960f0c357bc3
MATLAB
1,210
43
function headerinfo = ReadIndexedMJPGHeader(filename,indexfilename) headerinfo = struct('filename',filename,'indexfilename',indexfilename,... 'nr',0,'nc',0,'nframes',0,'frame2file',[],'timestamp',[],'type','mjpg'); fid = fopen(indexfilename,'r'); if fid < 0, error('Could not open file %s for reading',indexfilenam...
2ffd8afffa8b1ca515011b0fe552a78f53be4895a3edc8a7be778acfc9064bc5
MATLAB
1,211
47
function vcout=mk_vcharm(vc,center,coeffs); % returns something [nbasis,ndum]=size(coeffs); order=sqrt(nbasis)-1; vc=vc(:,1:3); [nsurf,ndum]=size(vc); vc=vc-repmat(center,nsurf,1); block=1000; nblock=ceil(nsurf/block); vcoutall=[]; k=1; for i=1:nblock kb=min(k+block-1,nsurf); blockloc=kb-k+1; vcloc=vc(...
994151c4bc1e559d506aefeee073db10c343d60f9addd65ab7b237bae6b2987c
MATLAB
1,211
44
function [Aout, avg_C, img] = h_improfile2(n) %[Aout, avg_C] = h_improfile2(n) %h_improfile2 mimic improfile but with an averaging function across a few lines %n = parallel lines to average 1, 3, 5, 7... default 5 if ~exist('n','var')||isempty(n) n = 5; end Aout = []; avg_C = []; handle = findobj(gca...
b540b0960bf086c0c94e60bd1571dfadac5f53938645cf210de0b71105c4b78c
MATLAB
1,211
43
function filtsign = lan_butter(LAN, min_freq, max_freq, chan, poles) % lan_butter realiza de forma intuitiva un filtro Butterworth sobre todos % los canales especificados 'chan' en un entorno LAN, para uno o multiples % trials, con un rollover constante de 0.5 % % Los parametros min_xfreq y max_freq pueden ser [] o un ...
d3ac5a814c93c06467c4fa67a7abac6c7835c3e492a0e9f4905696d16d8092ff
MATLAB
1,211
47
function vcout=mk_vcharm(vc,center,coeffs); % returns something [nbasis,ndum]=size(coeffs); order=sqrt(nbasis)-1; vc=vc(:,1:3); [nsurf,ndum]=size(vc); vc=vc-repmat(center,nsurf,1); block=5000; nblock=ceil(nsurf/block); vcoutall=[]; k=1; for i=1:nblock kb=min(k+block-1,nsurf); blockloc=kb-k+1; vcloc=vc(...
de0d209807c12c6358418a8e466f788e9e242e42809e46ae6def00bac8b22146
MATLAB
1,211
48
function [err] = CNN(fz,data_x, target_y) % Input paramters (arguments) are: % data_x: 4-D double containing the input data in the following form % [128 1 1 numberOfReadings] % target_y: 1-D Categorial containing the signal labels % [numberOfReadings 1] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
7dd49beb1f3f7289823f8a11a0f0e702b5fee229b1fb1efc2fa65e5ac582f5a3
MATLAB
1,212
41
% Author: Birgit Nierula % nierula@cbs.mpg.de function mrmr_esg_isopotentialplot(subjects, chanvalues, colorbar_axes, chan_labels) %% isopotential maps %% get grid parameters [labels, elec_pos, grid_size, grid_pos] = get_gridparameters(subjects); %% sort channels + reduce to actual channel size allchan_idx = find(...
e7b6666f8aeca05ff91269e8dd0bcac01ed5e379d49661b4c9bda735958cb6ae
MATLAB
1,212
34
function t = fractile(x, f) %FRACTILE finds fractiles of a distribution % T = FRACTILE(X, F) finds a value T for which a fraction F of the % elements of X are less than T. A fractile is like a centile, except % that the argument is a fraction rather then a percentage. % % Linear interpolation is used bet...
51d1736a11c39c8738dbfca112f25cfc2340542587ff3b3aa9a3f964c6c9dc66
MATLAB
1,213
35
function [Gx,Gy] = gradient2( I ) % Compute numerical gradients along x and y directions. % % For 2D arrays identical to Matlab's gradient() with a spacing value of % h=1 but ~10-20x faster (due to mexed implementation). Like gradient(), % computes centered derivatives in interior of image and uncentered % derivatives ...
5726feb61965c68699d648caa612885be2d885ad55795dfc0223159bf7949e69
MATLAB
1,213
39
function V = mttkrp(X,U,n) %MTTKRP Matricized tensor times Khatri-Rao product for ktensor. % % V = MTTKRP(X,U,n) efficiently calculates the matrix product of the % n-mode matricization of X with the Khatri-Rao product of all % entries in U, a cell array of matrices, except the nth. How to % most efficiently do...
71ca59c7e2ee805ae7870e093178fc40424f584cc36dbc07fada324361040202
MATLAB
1,213
41
clear clc %{ delete(gcp('nocreate')) myCluster.NumWorkers = 8; parpool('local',8) %} NineMuscleMorphParaInitial = load('NineMuscleMorphParaInitial.mat'); NineMuscleMorphParaInitial = NineMuscleMorphParaInitial.NineMuscleMorphParaInitial; MaxFunctionEvaluations_Data = 10^300; MaxIterations_Data = 60; OptimalityToler...
bd301858dd83e13f63302f121b27a270fc397db9217c0f5689f54bd107a71a4f
MATLAB
1,213
36
function [impreds, stadog] = predictDogModel(mdlparams, imEnsemble, nrx, nry) %UNTITLED Summary of this function goes here % Detailed explanation goes here [ypix, xpix, Nims] = size(imEnsemble); swt = mdlparams.surrwt / mdlparams.surrsc^2; rfparams = [mdlparams.gaussparams 1 mdlparams.surrsc swt]; % rfparams(1:...
09f378d1a006088c3f5d6b760c31d2475fe9bed1618229fe6990e40e8384eade
MATLAB
1,214
54
function xc = CrossCorr2(refSpk, testSpk, varargin) nSamp = 10000; binSpec = []; binEdges = -100.5:100.5; for i = 1:2:length(varargin) switch varargin{i} case 'nSamp' nSampTarget = varargin{i+1}; case 'binEdges' binEdges = varargin{i+1}; case 'binSpec' b...
3c085d8af6c7cd4728126dc495eb6335617a536093bc78582efc07c5b2acc868
MATLAB
1,214
39
clear clc %{ delete(gcp('nocreate')) myCluster.NumWorkers = 8; parpool('local',8) %} NineMuscleMorphParaInitial = load('NineMuscleMorphParaInitial.mat'); NineMuscleMorphParaInitial = NineMuscleMorphParaInitial.NineMuscleMorphParaInitial; MaxFunctionEvaluations_Data = 10^300; MaxIterations_Data = 60; OptimalityToler...
72d3ae9afbaeabdca9a46333e63efdd93186e6876cb17811b42c3f5e80182bef
MATLAB
1,214
66
function [H,Hnorm,inv_Hnorm] = compute_collineation (a00, a10, a11, a01); % new formalism using homographies a00 = a00 / a00(3); a10 = a10 / a10(3); a11 = a11 / a11(3); a01 = a01 / a01(3); % Prenormalization of point coordinates (very important): % (Affine normalization) ax = [a00(1);a10(1);a11(1);a01(1)]; ay = [a...
c0d5dcdecdd3d067acd49e2e33e27127f33011cd4fd92dd9d76f37cb76b1c426
MATLAB
1,214
29
function [segments, Fs] = CARL_get_voice_segments(filename, chunk_s, distance_s) % filename: filename of the .wav file (incl. extension) % chunk_s: duration of chunk in seconds % distance_s: min. distance between chunks in seconds segments = []; tmp.info = audioinfo([filename]); ...
ddf8e8b78adcb2e5887d43526aecb3227cb5d5f4cf9a4d08de8a219636ac3270
MATLAB
1,214
26
function result = trimTrackersAfterLoad(trackers, isFilePreTrackerHistory, currTrackerThatWas) % Trim the trackers, deleting all untrained models, except for the % current tracker. We do this after loading b/c there are legacy projects % which include a bunch of untrained trackers. For newer project files, ther...
ffc1cafdb9c85dbb276f52a2e172430cf3f0c2ac98e2307e264267dbf8ff1c41
MATLAB
1,214
28
classdef (Sealed) AdjMatrixGridGraph < adjmatrix.AdjMatrixFromNetX methods function this = AdjMatrixGridGraph(params, loadOnInit, delAfterLoad) % creates a complete graph (mean-field network) % % params {AdjMatrixParams}: params of the adjacency matrix % loadO...
3e918fb6585f4ce394c08f3b9eeb7b4959c85acfba6aa46a33ac24cd4ab2fcae
MATLAB
1,215
34
function [kdr,nap,km,cal,kca] = calc_steady_states(v,ca) global gKCa %% ... global nV12 nk ntau ntauV12 ntauk %% Potassium rectifier (Kdr) global nMV12 nMk nMtau nMtauV12 nMtauk %% Potassium M (M) global mpV12 mpk hpV12 hpk hptau h...
5c5e70a67d268be82ee4643ac10591fbbc2a1bc26309b2d674ebc87ab0735c0e
MATLAB
1,215
26
% Plot Figure 4b load(fullfile(saveLoc, 'decoderPerf_crossTP')) load(fullfile(par_sess{1}.datPath, 'Plotting', 'darkRedBlue')); darkRedBlueUpper = darkRedBlue(size(darkRedBlue,1)/2+1:end, :); % useTPTs = find(winStart >= 0.1 & winStart <= 0.5); useTPTs = useTPTs(1) : 2 : useTPTs(end); xyLims = [0.1 0.501]; useTP...
926ed61d2173c5dcd659a5cb18fdac4b9f6dfcd3ab76d7cbd3e60731f3ceecfd
MATLAB
1,215
36
function downloadAllSupport(destnRoot, quiet) %% Download pmtkSupport packages from pmtkSupport.googlecode.com % This file is from pmtk3.googlecode.com SetDefaultValue(1, 'destnRoot', fullfile(pmtk3Root(), 'pmtksupportCopy')); SetDefaultValue(2, 'quiet', false); fprintf('downloading packages to pmtk3/pmtksupportCop...
edac482116374e01130d7adb6750d653617a546972d34f9bb85388aafac0e1b7
MATLAB
1,215
43
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Optimization loop of the MU filter to minimize the coefficient of % varation of the inter spike intervals % Input: % w = initial weigths % X = whitened signal % CoV = coefficient of varation of the inter spike intervals % fsamp = sa...
214da844edc231a584cb405be24c84a9c8bab83ff0e525364e3b97c562445e1c
MATLAB
1,216
33
%% Figure 4.1 % Generate the simplest adjacency matrix figure; g = graph(res.adjacencyMat); plot(g, 'Layout', 'force', 'Usegravity', true, 'WeightEffect', 'inverse'); %% Figure 2 % We can do better by coloring the nodes based on the average value of the node members % averaging over nodeMembers cell array avgNode = c...
9c604901bd233c8db93bb624b6bbe886b2714a5f976ef1411c6472e77b8ae2d4
MATLAB
1,216
51
function A=mkfilt_eloreta(L); [nchan ng ndum]=size(L); LL=zeros(nchan,ndum,ng); for i=1:ndum; LL(:,i,:)=L(:,:,i); end LL=reshape(LL,nchan,ndum*ng); u0=eye(nchan); W=reshape(repmat(eye(ndum),1,ng),ndum,ndum,ng); Winv=zeros(ndum,ndum,ng); winvkt=zeros(ng*ndum,nchan); kont=0; kk=0; while kont==0; kk=kk+1; fo...
aabb09030bf8ffc23238b6373680750a259cc74fde83aabaecee7027bea692ce
MATLAB
1,216
41
% _ _ % ___ _ __ __ _| |__ ___ ___ _ __| |_ % / __| '__/ _` | '_ \/ __|/ _ \| '__| __| % | (__| | | (_| | |_) \__ \ (_) | | | |_ % \___|_| \__,_|_.__/|___/\___/|_| \__| % % callback when cluster is called % this calls other plugins that handle % the actual clustering ...
029c8871d39da2666d6201e3f615a2faa1ca4a2fae8a6b3a4dc4bbb482426e14
MATLAB
1,217
41
function dF = CBIG_MFMem_rfMRI_rfMRI_BW_ode1(y,F,Nnodes) %----------------------------------------------------------------------------- % dF = CBIG_MFMem_rfMRI_rfMRI_BW_ode1(y,F,Nnodes) % % Function for hemodynamic model diffiential equation 1st order % % Input: % - y: current neural activiy % - F: ...
59b2128d54e19e56d679c2892bee2d04fc9bf41deaf96be13af9ffaca4abaa22
MATLAB
1,217
51
% Plot stimulus-locked mean traces during viewing task for all coherences % - considering nans in each trial % meanTracesSLview_bigSbigT filter = ones(size(sigSLv.sig_coh))==1; conditions = sigSLv.sig_coh; allCond = nanunique(sigSL.sig_coh); colores = NS_colorsBY(length(allCond)); clear Son dt = sigSL.t(2)...
82c3358083d27f3b5c14bdc8444cd810d15d35306ad0115e13fecb1ec4e650ae
MATLAB
1,217
46
function Xtensor = tucker2multiarray(X) % Converts a 3d Tucker form tensor to a multiarray. % % function Xtensor = tucker2multiarray(X) % % X has fields U1, U2, U3, and G. % % The matrices U1 (n1-by-r1), U2 (n2-by-r2) and U3 (n3-by-r3) are % orthogonal matrices. % G (r1-by-r2-by-r3) is a multidimensional array...
88b2b323302ec0128e5239b3208ecfb29ba2c4730cceae70d0db2cebecf26195
MATLAB
1,217
48
% MF_SPDIAG_SV_N Dispatch for MF_SPDIAG with DINV = 1 and F.SYMM = 'N'. function D = mf_spdiag_sv_n(F,spinfo) % initialize N = F.N; n = length(spinfo.i); P = zeros(N,1); % for indexing D = zeros(N,1); % for output % loop over all leaf blocks from top to bottom for i = n:-1:1 % find active indic...
bf1da7dfcc21f3eb88f16ab2b8bc017564f8b72745a92c0c79ee483c2e12f617
MATLAB
1,217
48
% MF_SPDIAG_MV_N Dispatch for MF_SPDIAG with DINV = 0 and F.SYMM = 'N'. function D = mf_spdiag_mv_n(F,spinfo) % initialize N = F.N; n = length(spinfo.i); P = zeros(N,1); % for indexing D = zeros(N,1); % for output % loop over all leaf blocks from top to bottom for i = n:-1:1 % find active indic...
045db696d4945499c1e0e789ecc96d830209838b15fd213fe6f859c2e183c9a6
MATLAB
1,218
26
function [centroid] = find_centroid(aal_node,sourcemodel) % aal_node: array comprised of indices of sources in region % example: aal_node=find(source_aal.tissue==1); % sourcemodel: is the source model structure if length(aal_node)==1 % only one source centroid=aal_node; else % find centroid by computing min...
61c66c4b9b8f2b02d321eebf6381449644bd5083f68241bdd7944cf76b15ec37
MATLAB
1,218
40
function vv = crf_smooth_3D(vin,outx,ksz,sigsc) % smooth volume based on crf % inputs: vin - volume (scalar) % outx - volume x 9 (reference frame) usually cortical % ksz - 1/2 size of kernel width (in voxels) % sigsc - standard deviations % output: vout - smoothed vin % % Ale...
91dd844e237e5dcebd7d8055675f2f8ccc42c7db9677c1b97c24d3a284afa590
MATLAB
1,218
42
function [S,bEff,Tmix] = DWSTE(G,tau,b,TE,TR,D,T1,T2) % % calculates DW-STE Signal % % input: % G = strength of diffusion gradient (mT/m) % tau = duration of diffusion gradient (ms) % b = b-value (ms/um2) % TE = Echo time (ms) % TR = repetition time (ms) % D = diffusion coefficient (um2/ms) % T1 = longitudin...
ea563454dea73e9944f36ff6674de4284c026f5609b0d2f5c347cac20b1d09b7
MATLAB
1,218
40
function memberMat = construct_cover_from_graph(g, resolution, gain) %% Create a cover. % The number of landmarks is divided proportional to % the size of each connected component. n = size(g.Nodes, 1); [cc,ccs] = conncomp(g); binAlloc = ceil((ccs/n)*resolution); %grab extra landmarks if needed memberMat = zeros(s...
2eac1f0f6288e0765ed0cae5dd9d11cc4281db11aeea3431c99f0baf54d5f47e
MATLAB
1,219
40
% Returns the inverse coordinate transformation (Rigid is in head % coordinates and transformed to non-head coordinates of Locations). function NewLocations = CorrectRigid(Locations, Rigid) switch ndims(Locations) case 2 % Single trial dataset. NeedReshape = true; nS = size(Locations, 1); nT = 1...
9297d9b93c9229286ddbca89a3fbf28594bb8f20062a0c0ff9cd8d0fa39fcc0a
MATLAB
1,219
50
function write_vtk(fn, pnt, tri) % WRITE_VTK writes a triangulation to a VTK (Visualisation ToolKit) format file. % Supported are triangles, tetraheders and hexaheders. % % Use as % write_vtk(filename, pnt, tri) % % See also READ_VTK, WRITE_PLY % Copyright (C) 2002, Robert Oostenveld % % $Id$ fid = fopen_or_error(...
47251fecfdeb3244a425894c60d4d7aae511ec855cf0df2fb9aa3d698e19e40c
MATLAB
1,220
61
A = load('/nrs/branson/mayank/janOut/151106_03_016_02_C001H001S.mat'); B = load('~/temp/delete_10.mat'); l1 = permute(A.locs(:,:,1,:),[1 4 2 3]); l2 = permute(B.pTrk,[2 3 1]); % rfn = get_readframe_fcn(A.expname); % %% % figure; imshow(rfn(30)); % hold on; % id = 4; % scatter(l1(30,1,id),l1(30,2,id),'.'); % gg = sqr...
4950991ba7c814975bf7b889aeec9355a3262d03b1060726199de8a4232f3d51
MATLAB
1,220
45
function [] = transformQuiver(processedImagePair) %% Figure out axis convention % x = [10:10:50]; % y = [10:10:30]; % [x,y] = meshgrid(x,y); % figure; % quiver(x,y,2*ones(size(x)),ones(size(x)),0) % set(gca,'YDir','reverse'); %% real stuff %decimate transform field spacing = 10; mytform = processedImagePair.ImgMovin...
ef417dad98ec7d66bb4066faa28cda878082d46323e695ae7060308eb581cd9b
MATLAB
1,220
49
% AUTHORSHIP % Primary Developer: Stephen Meehan <swmeehan@stanford.edu> % Provided by the Herzenberg Lab at Stanford University % License: BSD 3 clause % classdef SuhAbstractClass< handle methods(Static) function AssertIsA(this, className) assert(isa(this, className),... ...
39325c78523a857b6befef5af3a5ac0c250b021ac4fb535fe1a7bbd5d8f5b408
MATLAB
1,221
40
function [ u, dim, options ] = setInput(options,dim,varargin ) % allow to specify labels to inputs (u) % IN % options: a structure % varargin: should be organized as: my_n1_times_nTrial_maxtrix1, name1, my_nk_times_nTrial_maxtrixk, namek... % OUT % u : a concatenate (n1+...+nk) * nTrial matrix % options...
3e583827d4b4d7db1a9ff7ee9fe18abf9a5bea13958f141a45ff860afa31c6dd
MATLAB
1,221
45
function f = meg_checkTriggers(fileName, trigChans, verbose) % function rd_checkTriggers(fileName, [trigChans], [verbose]) % INPUTS: % fileName is the path to the sqd file % trigChans (optional) is the trigger channels to plot. Default is 160:167. % verbose (optional) [1 or 0] specify whether to print the trigger coun...
6d12f0a19fa67a94371c0ec8f2b9a28c216a7aa87e857ab85b30c3c86a7a2cf7
MATLAB
1,221
50
function [EVec, Eload, EVal, pca_info] = mypca_calc(vecs) % % PCA_CALC Principal Component Analysis % % [EVEC, ELOAD, EVAL] = PCA_CALC(X) takes a column-wise de-meaned % data matrix X of size n-by-m and calculates the n % Eigenvectors (EVEC of size n-by-n) of the data covariance % matrix, the fac...
701f45d59b453e328260f6d92038989b2102d7ec05c142095ffc5c3a34910190
MATLAB
1,221
55
%% PCA digit visualization demo % Based on code by Nando de Freitas. %% % This file is from pmtk3.googlecode.com loadData('uspsAll'); % data(1:256, 1:1100, 1:10) figure; i = 1; for c=1:10 for j=1:2 subplot(4,5,i) imagesc(reshape(data(:,j,c),[16 16])); axis off colormap(gray) i=i+1; end end ...
a279ae40dabe2551d955ad20bcbf53774314fde20000674f73ac193f8ad40b97
MATLAB
1,221
28
psthPara.binsize = 10; psthPara.binstep = 10; % ms if contains(protStr, "Passive noise") devStr = "durSeq"; end tIndex = [trialAll.(devStr)] == devType(dIndex); trials = trialAll(tIndex); trialsSPK = trialsSpike(tIndex); % spike spkNoise(dIndex).devType = devType(dIndex); spkNoise(dIndex).trials = find...
0b24efcb8b2f4e7968ad064a51ca7e12fb23eadff53f6548807a878f0ebeb5a2
MATLAB
1,222
47
% This demonstrates the smoothing properties of the Kalman lagged filter. % Hidden states follow a triangular wave, whose observation is perturbed % with white noise. Critically, we render the inversion scheme blind during % half a period of the oscillation. We then invert the model (under AR % priors on hidden states)...
2c0b0449a253e992c87ff99682bf86220c89f726b4c57a2aeb41114e06f3fd1a
MATLAB
1,222
52
function [pnt, tri] = mesh_cube() % MESH_CUBE creates a triangulated cube % % Use as % [pos, tri] = mesh_cube() % % See also MESH_TETRAHEDRON, MESH_OCTAHEDRON, MESH_ICOSAHEDRON, MESH_SPHERE, MESH_CONE % Copyright (C) 2019, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % f...
9bfa8ad7e2ae3abe9ecd12ab5cbe567dc6f6ff96071445460743a73ac38162c5
MATLAB
1,222
45
function [slocgrp] = genLocsGroupedI(s,imov,varargin) % s: scalar element of 'sagg', ie labels data structure for one movie. % imov: movie index, only used for metadata imgpat = myparse(varargin,... 'imgpat','im/%s.png' ... ); % s = Labels.addsplitsifnec(s); slocgrp = []; frmsun = unique([s.f...
b41bf29fa451c1bf4759e948d863e207a5557f6941e125db3fe4b34cb54cc780
MATLAB
1,222
39
function riptimes = getRipTimes(animalprefix, loadDir, day, epoch, modelParam) % riptimes = decode.getRipTimes(animalprefix, loadDir, day, epoch, modelParam); % % %% Set up minEventDur = modelParam.minEventDur; sToMsConversion = 1000; %% get ripple time % load(sprintf('%s%srippletime0%d.mat',dir,animalprefix,day))...
d4677aaec6f2f1e843614a5f40e0195b7c86c73bc89645ce2bfd104b6e9bf0cc
MATLAB
1,223
34
function signal = noise (frames, epochs, srate, outvar) % function signal = noise (frames, epochs, srate, outvar) % % Function generates noise with the power spectrum of human EEG % Inputs: % frames - number of signal frames per each trial % epochs - number of simulated trials % srate - sampling rate of simulated s...
fede6ab5e3baba7f9022ca4a4173d855f4d620550e6dc29a598173013efbaeba
MATLAB
1,223
31
function [rt] = isGraph(in) % % % %<PRE> % This file is part of dspace-core. % % Copyright (C) 2020 University Zurich, Sepp Kollmorgen % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU Affero General Public License as publ...
6b39aefead75a12685628984dfae609f5c7ca1cef50750a87e667db9ee0f69e9
MATLAB
1,224
34
function plot_TWO_place_fields(place_fields1,place_fields2,track_id) place_fields{1}=place_fields1.track(track_id); place_fields{2}=place_fields2.track(track_id); %%% PLOT WITH IMAGESC c=1; figure y_vector=[]; for i=1:2 for j=1:2 matrix=[]; normalized_matrix=[]; subplot(2,2,c) for k=...
2303c6db0ccdceca50baa61dc0a42d63ea1e1519f0b34179e6b993f66b1f600e
MATLAB
1,225
50
function [dupcats,idupcats] = finddups(x,varargin) % Look for duplicates in rows of x % % x: [Nxncol] numerical or cellstr % % dupcats: [Ndupsetsx1] cell. dupcats{i} contains identified/matching % rows of x for duplicate category i % idupcats: [Nx1] indices into dupcats. idupcats(i) is: % * nan if x(i,:) is not a ...
42a58b298af0e7a8411402b17ac8e70bd53a7a3d2fa6c635fbc677965cbcd4e2
MATLAB
1,225
23
% FILTERS % See also % % Filters: % filterBinomial1d - 1D binomial filter (approximation to Gaussian filter) % filterDog2d - Difference of Gaussian (Dog) Filter. % filterDoog - n-dim difference of offset Gaussian DooG filter (Gaussian derivative). % filterGabor1d - Creates an even/odd pair of 1D G...
2b28a614a2d2ee29f56692bf48d58bb49e1213421a2a789a5be0c46e08598d54
MATLAB
1,226
51
% data is from % http://archive.ics.uci.edu/ml/datasets/Congressional+Voting+Records fid = fopen('house-votes-84.csv', 'r'); D = 17; linenum = 1; while 1 tline = fgetl(fid); if ~ischar(tline), break, end disp(tline) s=regexp(tline, ',', 'split'); switch s{1} case 'republican', data.X(linenum, 1) = 1...
666eca18cad910f92f7aa420adaef58f1027b8de70b6e8b867cbcc1502dbd195
MATLAB
1,227
56
%% Demo of the pagerank algorithm, based on code by Cleve Moler % See also pagerankDemoMoler, pagerankDemoGui, surfer, pagerankpow %% %% 6 node web example % This file is from pmtk3.googlecode.com i = [ 2 6 3 4 4 5 6 1 1]; j = [ 1 1 2 2 3 3 3 4 6]; n = 6; G = sparse(i,j,1,n,n); % sparse n x n matrix with 1's in spec...
66d58a4caefce87bbd6eaa1b99610596ecbc500fe1abf08a2d7f0d475cb080d7
MATLAB
1,227
49
function image_rgb(M) % Show a matrix of integers as a color image. % This is like imagesc, except we know what the mapping is from integer to color. % If entries of M contain integers in {1,2,3,4,5}, we map % this to red/green/blue/aquamarine/black. % So if we call image_rgb on 2 different matrices, % we always know b...
af934d78da167ce3efbb379ad60e575d0ebed49ee501e329f22241247c522356
MATLAB
1,227
39
function ok = tt_subscheck(subs) %TT_SUBSCHECK Checks for valid subscripts. % % TT_SUBSCHECK(S) throws an error if S is not a valid subscript % array, which means that S is a matrix of real-valued, finite, % positive, integer subscripts. % % X = TT_SUBSCHECK(S) returns true if S is a valid and false % otherwise. %...
0f40e86621fb666d6a8ba12ec2ab6c4c7e95064891c58b17d8f725e32a242d24
MATLAB
1,228
35
function stage_base_calling() loadParameters; %Save the loadParameters into the output director in case we need to do %later debugging copyfile('loadParameters.m',fullfile(params.basecallingResultsDir,... sprintf('loadParameters.m.log-%s',date))) [ret,messages] = check_files_in_base_calling...
7137ef6a13eeeff0c31fa900aaa095204941d616b2d236f94a29a49e58f0269b
MATLAB
1,228
45
function [dat,nvox] = iimg_cluster_extent(dat,volInfo,k) % Apply a cluster size threshold to a series of index image data vectors % (each img is one column) % given volInfo (must be created with iimg_read_img, with extended output) % % :Usage: % :: % % [dat,nvox] = iimg_cluster_extent(dat,volInfo,k) % % :Inputs: % ...
6b880d1db8420e3a21f8cdf4e812a60162b4c439ed032d5b030ae6f3ceb29730
MATLAB
1,229
30
function qh = quivercolor(ax,x,y,u,v,colorVar,colorMap,varargin) if isempty(ax) ax = gca; end if (nargin < 5) || isempty(colorVar) colorVar = hypot(u(:),v(:)); % magnitude of vectors is the default color end varargin = func.get_args_set_default(varargin,'LineWidth',1....
a47a36f7577f4a27a3288160fa7d59607ab24db0ca4cf36b3aea95af9f2bc27a
MATLAB
1,229
40
function [Xc] = mixGaussImpute(model, X, varargin) % Fill in NaN entries of X using posterior mode on each row % Xc(i,j) = E[X(i,j) | D] %PMTKauthor Hannes Bretschneider % This file is from pmtk3.googlecode.com if ~isfield(model, 'cpd') || isempty(model.cpd.mu) if ~isfield(model, 'K') || isempty(model.K) ...
25a5d8c2d1c8bbc244ea31f24418a7c0caeebe0bd080ce69912923f7a033fc92
MATLAB
1,230
50
%% fnc_FAST_getFreqs: Selection of a frequency set. Done recursively as described in: %% ‘A computational implementation of FAST’ [McRae et al.] % % Usage: % W = fnc_FAST_getFreqs(k) % % Inputs: % k scalar number of inputs % % Output: % W frequencies of parameters % % -------------...
770e65cbbec899bf49d167ca9d66b821296ce84d24b67f9211fccbef944bd5ba
MATLAB
1,230
46
function tests = mex_meanfilesTest tests = functiontests(localfunctions); end function setup(testCase) testCase.TestData.tempDir = '/mp/nvme0/tmp/testworks'; if ~exist(testCase.TestData.tempDir) mkdir(testCase.TestData.tempDir) end n = 4000; data = {}; for i = 1:4 data{i}=[...
a3e742a3b86939314d74b8a13354e346c4a303ba921d957718bf87baaadfa4fb
MATLAB
1,230
52
classdef CalRigDummy < CalRig % Generic "No calibration" Calrig properties nviews viewNames % [nviews]. cellstr viewnames viewSizes % [nviews x 2]. viewSizes(iView,:) gives [nc nr] or [width height] end methods function obj = CalRigDummy(numVw,vwNames,vwSizes) if isstruct(numVw), % handl...