sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
aae58c8ab336dfa33a7bee537e622d6b2f8ec240b4f614d89b57c0798c72fd51
MATLAB
1,576
36
function varargout = VBA_spm_sample_vol(varargin) % returns voxel values from a memory mapped image - a compiled routine % FORMAT X = spm_sample_vol(V,x,y,z,hold); % V - is a memory mapped image volume % x - matrix of x coordinates {pixels} % y - matrix of y coordinates {pixels} % z - matrix of ...
06113565faee84c40084cdeba273d684e6e4f355ca8551aed117234f27db74cd
MATLAB
1,577
44
function Compute_Mask_OrigSpace(varargin) invDeformMapFiles = ParseParams(varargin); batchName = 'data/batch_Mask.mat'; Thresh = 0.1; batchFile = batchName; BATCH = load(batchFile); spm_jobman('initcfg'); fprintf('Starting Time: %s\n',datestr(now)); for i=1:length(invDeformMapFiles) [outpath outName] = fil...
3fe94592b6f0d97cadbe5cb60bce3f8c6f63526e39afaa97af813a51d570b88d
MATLAB
1,577
41
function [maxBias] = maxBiasCalculation(totalNumFramesRemaining,totalNumFrames,targetedRs,randomRs) %Calculation of maximum bias per Section 2.3.2.4 keepSubj = totalNumFramesRemaining(1,:) > 0; subjTotalNumFrames = sum(totalNumFrames(:,keepSubj),2); framesRemaining = sum(totalNumFramesRemainin...
c45ed18f60091d88049dd593b785a5432fb6bf4fbeb73c6d34e8f70e266c22c5
MATLAB
1,577
47
function resultindex = evaluatefilter(cellvar, filterString) % % resultindex = evaluatefilter(cellvar, filterString) % % Return the indices of the cell structure that have fields that satisfy % the given constraints. Each row of the output is the index into one cell. % % CELLVAR - any cell structure, for example spikes...
ca8266f769a5dc3b6e3d3b0dc16568ea451b2406c7a68fa6d68bc60d94fe4a58
MATLAB
1,577
61
%% var_to_cpsd % % Calculate cross-power spectral density and transfer function from VAR % parameters % % <matlab:open('var_to_cpsd.m') code> % %% Syntax % % [S,H] = var_to_cpsd(A,SIG,fres) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % A VAR co...
0dc4eca2690f03978dc914f9361cded26639975aa64320fd04d6b5c1506fbe3a
MATLAB
1,578
57
function [epipole] = compute_epipole(xLp,R,T,fc_right,cc_right,kc_right,alpha_c_right,fc_left,cc_left,kc_left,alpha_c_left,D); if ~exist('D'), D = 400; end; uo = [ normalize_pixel(xLp,fc_left,cc_left,kc_left,alpha_c_left); 1 ]; S = [ 0 -T(3) T(2) T(3) 0 -T(1) -T(2) T(1) 0 ]; l_epipole = (S*R)...
7f1215eeba7bd535ed50f385df801f77dff8c95c83f4520605a4a01fb9970b7f
MATLAB
1,578
49
function [data1,data2] = extract_variables (variable, subVariable , path, group1, group2, conditionType, conditionValue) % if nargin < 6 % conditionType = []; % conditionValue = []; % end %sizeThresh = 1; files = dir(path); fileNames = {files.name}; fileIsDir = {files.isdir}; fileNames = fileNames(cell2mat(f...
91d6da7a3e8c2182c4e491807e2d3e55c547ba3afd3ffdba3fbebc9b4c861ab4
MATLAB
1,578
60
function [DKL,DJS] = VBA_KL(m1,v1,m2,v2,distrib) % computes the KL and JS divergences between two distributions % [DKL] = VBA_KL(m1,v1,m2,v2,disp) % Note that the KL-divergence is not symmetric w.r.t. to the two % probability densities, i.e. KL(p1,p2) ~=KL(p2,p1). By convention, the % KL-divergence is defined as follow...
a9ea1927ad42b84fbbc436a7b3e03be1e87a9353f678d4077ad26efe5d1f0be4
MATLAB
1,578
97
function [xd,dxddk] = apply_distortion(x,k) % Complete the distortion vector if you are using the simple distortion model: length_k = length(k); if length_k <5 , k = [k ; zeros(5-length_k,1)]; end; [m,n] = size(x); % Add distortion: r2 = x(1,:).^2 + x(2,:).^2; r4 = r2.^2; r6 = r2.^3; % Radial distortion: ...
fcb7f027fb23ce081840a375793e2a8732b8a4f54d9b7ae84c5fc2bc08571083
MATLAB
1,578
53
% _ _ % ___ _ __ __ _| |__ ___ ___ _ __| |_ % / __| '__/ _` | '_ \/ __|/ _ \| '__| __| % | (__| | | (_| | |_) \__ \ (_) | | | |_ % \___|_| \__,_|_.__/|___/\___/|_| \__| % % master dispatched when we want to reduce dimensions function reduceDimensionsCallback(self,~,~)...
206d1d760db606658db5877e18e13d7a8d581e9fc995fcf69641d6f1685f9388
MATLAB
1,579
52
clear all; load('/home/amax/YZY/code/retinotopysmall6.mat'); %视网膜刺激时间-模式文件 % stimulus is 200*200*300 200*200pix 300 means 300 seconds with TR=1 COpRF_options = []; %run = 1 TR = 1; % tseries ={}; data={}; %% Load in preprocessed data data_dir= '/home/amax/YZY/20220523data/sub01/session01/preprocess/result_for_pr...
a230c815b01c176b85f4fcbe3d8b51f1ee0ce78e96313a872f2e26f74b9400a2
MATLAB
1,579
46
%% Computing When-decoders choice prediction disp('Computing When decoder performance...') load(fullfile(saveLoc, 'decoder_excl_SL')) d = 6; % WhenD clear pc_whenC_sign_dec se_whenC_sign_dec for sess = 1 : 8 disp(['Session ' num2str(sess) ': Computing When decoder performance...']) load(fullf...
6d6d14e00babcb3eb4924a06a07bf55d527fae51528bf7abec6823552e3ddabe
MATLAB
1,580
63
%% Test PMTK mrf code against mrf2 % %% % This file is from pmtk3.googlecode.com nNodes = 60; adj = chainAdjMatrix(nNodes); nStates = 7*ones(1,nNodes); initial = [.3 .6 .1 0 0 0 0]; nodePot = zeros(nNodes, max(nStates)); nodePot(1,:) = initial; nodePot(2: end,:) = 1; edgePot = [.08 .9 .01 0 0 0 .01 .03 ....
bfd30732dd4d2eb082ba73495c7c865e26b433c1a84b613de3a95c22a7e61eea
MATLAB
1,580
74
% [y,npadl,npadu] = padgrab(x,padv,l1,u1,l2,u2,...) function [y,npadl,npadu] = padgrab(x,padv,varargin) % parse arguments usagestring = 'Usage: padgrab(x,padv,l1,u1,l2,u2,...)'; nd1 = ndims(x); if mod(numel(varargin),2) ~= 0 || isempty(varargin), error(usagestring); end isones = cellfun(@(x) x == 1, varargin(1:2:end...
c5c5943773c2e27b3a1ea1919b1f7f2ddbe3f7cbed18cb80a5651ec7506d6724
MATLAB
1,580
79
% conic_standard_form(A,B,C,D,E,F) % A * x^2 + B * x * y + C * y^2 + D * x + E * y + F = 0 % returns the rotation theta and translation (x0,y0) required to put the % equation in the form % A * x^2 + B*x*y + C * y^2 + D*x + E*y + F = 0 % if not a parabola, then B = D = E = 0 and F = -1 % if a parabola then B = F = 0 and...
df3777c24b9b70268aa5812e34683c601702d7e4a8292ccfbaa6a7a2e4b5543a
MATLAB
1,580
57
%% Infer the mean of a 1D Gaussian % %% % This file is from pmtk3.googlecode.com priorVar = [1 5]; Sigma = 1; % Assumed to be known figstr = {'gaussStrongPrior', 'gaussWeakPrior'}; X = 3; % data [styles, colors, symbols, plotstyle] = plotColors(); figure; for i=1:numel(priorVar) %% prior.Sigma = priorVar(i)...
9e335e90c8edee57a72fc3269ba8390a725797d495300b59167bacfa80c62c13
MATLAB
1,581
54
% showSpikeInContext % % _ _ % ___ _ __ __ _| |__ ___ ___ _ __| |_ % / __| '__/ _` | '_ \/ __|/ _ \| '__| __| % | (__| | | (_| | |_) \__ \ (_) | | | |_ % \___|_| \__,_|_.__/|___/\___/|_| \__| % % created by Srinivas Gorur-Shandilya % https://srinivas.gs/ function sho...
a95e7327b8d2ee76bafd3ca6a2c802444de284fe51f0f7d59e05ce4a474bd5b4
MATLAB
1,581
55
% Spike detection load('path to EEG mat file') EEG2 = EEG.values; %% set time_range = [13000,10*3600]; Fs = 100; % run data=EEG2(time_range(1)*Fs:time_range(2)*Fs); data = data(1:floor(length(data)/Fs)*Fs); tvec = 1:length(data); DC = 4; [C,L] = wavedec(data,DC,'db4'); approx =...
51961146066f8ad79f58659f1c856ae0e64dca27c6db3e02076bc77b13667349
MATLAB
1,582
38
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This script cuts the BIOPAC post-processed data according to the cuts % % defined for the NII files. % % The cut files are in the % ...
6c046bf6cf53508e93d007e933e71c855396847e594df72d123b38463db2ed58
MATLAB
1,582
51
function [observed, hidden] = hmmSample(model, len, nsamples) % hidden{i}(1:len(i)) ~ markov(model.pi, model.A) % observed{i}(t) ~ discrete(model.emission(hidden{i}(t), :)) % or % observed{i}(1:d, t) ~ gauss(model.emission{hidden{i}(t)})) % This file is from pmtk3.googlecode.com SetDefaultValue(3, 'ns...
9f7aa8ac5af99fee5eaae7c6856846a344c6b3c04915853c672203edc1c04660
MATLAB
1,582
58
function t = limo_ttest_light(type,data1,data2) % t = limo_ttest(type,data1,data2) % implement the one-sample t-test, paired t-test (type = 1) % and the two samples t-test (type = 2). The ttest is performed on the last % non-singleton dimension, which can be subjects or trials. If vectors are % compared they sh...
ba75c6353aea6bf56487bb3e55aa8b3d6587214487dca68736b4bb2959a29cb1
MATLAB
1,582
50
%% Calculate Double Gaussian Curve % Save cross-section intensity from Fiji. Normalize and center the curve. % Save as CSV without column names. C1: Distance in nm. C2: Normalized intensity. % Specify the file path and name clear file = 'P2P-2-b-norm.csv'; % Import the CSV file data = readmatrix(file); % Display the ...
e4a1039fa3207e6a7d541baf20247b157f65f4efe2c37f30c8ca65155d606216
MATLAB
1,583
45
function [True] = inside_tetrahedron(P,P1,P2,P3,P4) % INSIDE_TETRAHEDRON checks if a 3D point belongs to a tetrahedron usign % the 'volume' criterion. % % TRUE = INSIDE_TETRAHEDRON(P,P1,P2,P3,P4) Tests if point P belongs to the % tetrahedron spanned on P1, P2, P3 and P4. All points are cartesian % coordinates. %...
09d8d15d723ee4c7d91e3f6fc77c4ba87aa9619447be593437f0212d8659ba80
MATLAB
1,586
59
%% Low level test of the TabularFactor code using the water sprinkeler BN % C % / \ % v v % S R % \/ % v % W %% %testSprinklerDemo() % Specify the conditional probability tables as cell arrays % The left-most index toggles fastest, so entries are stored in this order: % (1,1,1), (2,1,1), (1,2,1), (2,2,1), etc. ...
55ac302091146f578abecabf77ec0cc77e14c2252ad0882ee9a96f274e355028
MATLAB
1,587
46
function segments = CARL_auto_detect_on_offset(speechSignal, Fs, ind, segments, threshold) % This function determines the on-and offset of a single speech sample as % created by the main function. To determine the on- and offset, the % short-time energy is used, downsampled and low-pass-filtered. if nar...
9de77e9bf1767787ebb6f6f9f1ce15b31f364ef2fd266ce8e1669b98414e35f5
MATLAB
1,587
31
%%Plots and calculates the mean bin value of all laps for data in each given task %Chad Heer; Sheffield Lab function [mean_lap_pupil, h, j] = plot_binned_data(lap_pupil, tasks, x_units) %lap_pupil = pupil or fluorescence data organized in this format {task}(laps, mean pupil area in each bin) %tasks = string array lis...
bd09f9f1b01aae5afcea531792f7771bab394ad00ee4bff364a73dc4857dcef8
MATLAB
1,587
60
function logp = gaussLogprob(arg1, arg2, arg3) % Log pdf of multivariate Gaussian % L = gaussLogprob(model, X) % L = gaussLogprob(mu, Sigma, X) % L(i) = log prob X(i,:) is i'th case, can contain NaNs for missing values. % Sigma can be a vector; this is interpreted as a diagonal matrix. % *** In the univariate case, Si...
11ccce75c4e83a2d9086af4e4ec1b3192badf29230c9d3fc4949822f2a90db82
MATLAB
1,588
61
% Copyright Christopher Fricke, University Leipzig Medical Center, % Neurology 2024 srcf1 = 'data\prep'; srcf2 = 'data\prep\coreg_indiv\datscan_normalized'; % klinische Daten laden [~,~,r] = xlsread(fullfile(srcf1,'clinicaldata.xlsm')); % Indices of interest binds = [6 8 14:17 23:24 27:29]; % Datensatzl...
d45a738a395570c75ce765fc693b478667161b59ce44a29b9639cbd37a0b2c30
MATLAB
1,589
38
function varargout = avg_angle_from_cos(cos_theta,in_deg,return_only_value) if (nargin < 2) || isempty(in_deg) in_deg = false; end if (nargin < 3) || isempty(return_only_value) return_only_value = 'all'; end valid_return_values = {'avg','std','err','all','minmax'}; assert(any(str...
3ce94a2e70607a6038b35f3430694550adad702f434d2d4d3972ad370a91f5b9
MATLAB
1,590
62
function Patlak_wrapper(PET_dyn_path, t_PET_emi, t_PET_delta, BRAIN_path, Cp_in, Cp_time, anatomy,out_path, options) if nargin<9 options = get_default_options(); end [~, PET2D, ~]=load_PET(PET_dyn_path); [PET_brain, PET2D_brain, ~]=load_PET(BRAIN_path); voxs=find(PET2D_brain>0.1); % 0.5 if not normalized nr_p...
4d0db144067ef95b95604c7836e8a6406c995ac825649ddc474b5b696d0ca5cb
MATLAB
1,590
63
function LAN = lan_from_int(channels, srate_new, File, Path) % IMPORTANT: number of channels required % % *************DEPENDENCIES************* % - read_intan_data.m (Intan Technologies) % (c) 2010, Intan Technologies, LLC % For more information, see http://www.intantech.com % For updates and latest version, see http:...
75d38075a381f19123e937acc89994d388301808883a4e6bb8eae7d4cdb5dfe3
MATLAB
1,590
80
function LAN = lan_rm_chan(LAN, ind,ica) % v.0.3 % % Pablo Billeke % 18.04.2022 % 27 08 2021 % add save deleted comp if nargin < 3 ica = 0; end if ischar(ica) ica = strcmp(ica,'ica'); end if abs(ica) ind = sort(ind); if iscell(LAN) for lan=1:length(LAN) LAN{lan} = lan_rm_c...
235c7cbfe532e731bee281917df8488a2b41275b0030f25c1fef0212c476f797
MATLAB
1,591
66
function writeSTL(filename,bel,nod) % convert2STL(filename,bel,nod) % % Dartmouth College % Written by Andrea Borsic using chunks of code from surf2stl of Bill McDonald % Hanover, 06/10/06 % Modified by Hamid Ghadyani 03/14/2009 Worcester, WPI % Added I/O checks % This function converts a *.bel and a *.nod file to an...
62ce8d5b3543af900159f2925f41359ae4d1897f6a3d99b8251adf4b07526158
MATLAB
1,591
51
function s = calcMacroQuantities(a,N,tCorr) % a -> activity struct vector (each element corresponding to an element in the vector of sizes N) % fields: % 'A' : activity raw timeseries (number of spikes for each time step) % 'A2': number of spikes squared for each time step % 'A4': ...
2e471386f78b065d42a1843a5390f19e8d386606da7cb4098fda8c8b51d5809b
MATLAB
1,592
51
function [Zpca, U, mu, eigVecs] = PCA(Z,r) % % Syntax: Zpca = PCA(Z,r); % [Zpca, U, mu] = PCA(Z,r); % [Zpca, U, mu, eigVecs] = PCA(Z,r); % % Inputs: Z is an d x n matrix containing n samples of d-dimensional % data % % r i...
8c8c905ff595d70fa3133ad22aeea7f90ed3e629193b37979ac12c3910786a63
MATLAB
1,592
59
function ns = count_squares_distorted(I,x1,y1,x2,y2,win, fg, cg, kg); [ny,nx] = size(I); if ((x1-win <= 0) || (x1+win >= nx) || (y1-win <= 0) || (y1+win >= ny) || ... (x2-win <= 0) || (x2+win >= nx) || (y2-win <= 0) || (y2+win >= ny)) ns = -1; return; end; if ((x1 - x2)^2+(y1-y2)^2) < win, ns =...
bb4aa3a79330aec02d592b11ee791f580f8a0576d1b74820f47d09492244c900
MATLAB
1,592
51
function [elem,node] = abaqus2nodele_surface(files, outputdir) % abaqus2nodele_surface(files) % Reads list of files from cell array 'files' or from GUI and converts them % to .node/.ele format (tetgen) format % Get multiple abaqus inp files as input if nargin==0 [files, pname, filterindex] = uigetfile({'*.inp','Se...
d303412c452246a17a7ad3a533c92b65bc0d1e06ce2e604e7b31c33523bed394
MATLAB
1,592
54
function [ci, sizes, label_id] = CBIG_ComputeConnectedComponentsFromSurface(avg_mesh, labels) % Given average mesh and labels, compute connected components. % % [ci, sizes, label_id] = CBIG_ComputeConnectedComponentsFromSurface(avg_mesh, labels) % Input: % avg_mesh : average mesh read from CBIG_ReadNCAvg...
0fa85621a2d57f94f98b455bbf1419129a2004b4e815face0a588690a6a6e2e7
MATLAB
1,593
38
function DataStructure=LinearFitSimple_ZN(Xdata,Ydata) if size(Xdata,1)<=1&&size(Xdata,2)<=1&&size(Ydata,1)<=1&&size(Ydata,2)<=1 warning('Need to provide more than one data point to fit!') DataStructure=[]; elseif size(Xdata,1)~=size(Ydata,1)||size(Xdata,2)~=size(Ydata,2) warning('Need ...
392dc317adc94a1cf1defd9160a818ac1a73e2305cbac37c0c1fb0e56c63167c
MATLAB
1,593
63
function [IX0,SigmaX0,deltaMuX0,suffStat] = VBA_IX0(X0,y,posterior,suffStat,dim,u,options) % Gauss-Newton update of initial conditions if options.DisplayWin % Display progress set(options.display.hm(1),'string','VB Gauss-Newton on initial conditions... '); set(options.display.hm(2),'string',' '); drawno...
cd58b549c9e7e3eddcde9621ed93270b99f7c0aeb67938f03328c1e6b6d4c465
MATLAB
1,593
47
%% Bound optimization illustration % %% % This file is from pmtk3.googlecode.com f1 = @(x) log(gaussProb(x, 0, 0.25^2))' + 1; f2 = @(x) log(gaussProb(x, 1, 0.2^2))' + 20; f3 = @(x) 5*sin(2*(x-0.5)) + ... f1(0.5*x) + ... f2(0.5*x) + ... ...
1cc9854bb1de0bacf83862f3ae7fd5b5ab31dcad31ff34241b7cc08a9839cbbf
MATLAB
1,594
55
function [celldata, eventindex] = getCellEventData(day, epoch, modelParam, riptimes, cellidxm, spikes) % [celldata, eventindex] = decode.getCellEventData(day, epoch, modelParam, riptimes, cellidxm, spikes) % % %% Set up cellcountthresh = modelParam.cellcountthresh; nCells = size(cellidxm, 1); %% Return empty if no ...
5c394ab4bc16c47e6509c4a8dfc5073d933e8131b1d9c6528b303623de0dca1c
MATLAB
1,594
46
% create a channel map file Nchannels = 64; connected = true(Nchannels, 1); chanMap = 1:Nchannels; chanMap0ind = chanMap - 1; xcoords = ones(Nchannels,1); ycoords = [1:Nchannels]'; kcoords = ones(Nchannels,1); % grouping of channels (i.e. tetrode groups) fs = 25000; % sampling frequency save('C:\DATA\Spikes\...
814c828ca7f12c855e64b0d314867f3bf55807d2b47bfcf779107c424a24e02f
MATLAB
1,594
46
%% SDO Bootstrap % Simple utility to iterate through the post-spike distributions using a % bootstrapped combination of the existing distributions. % Could be used to evaluate the sensitivity of particular spikes on the SDO % matrix. % % INPUTS: % - px0 -[N_STATES, N_SPIKES] column vectors of pre-spike probability...
956163292e5efa0259ca9924deab2f187ab1cb2f5a96632269698deb996eac51
MATLAB
1,594
51
function X = arrange(X,foo) %ARRANGE Arranges the rank-1 components of a ktensor. % % ARRANGE(X) normalizes the columns of the factor matrices and then sorts % the ktensor components by magnitude, greatest to least. % % ARRANGE(X,N) absorbs the weights into the Nth factor matrix instead of % lambda. % % ARRA...
d27dc45199cd5cabc7e9254a5e1b14f5de8520af5c2f9107411f9aa115cca642
MATLAB
1,595
65
function [img,nr,nc] = getframe_invisible_nocheck(gfdata,sz,removeborder,doresize) if nargin < 3, removeborder = true; end if nargin < 4, doresize = true; end if isfield(gfdata,'grayborder'), GRAYBORDER = gfdata.grayborder; else GRAYBORDER = 204; end hfig = gfdata.hfig; img = hardcopy(gfdata.hardcopy_args{:...
15ad6a3a8755689db9b3d2ebf63e2797d333217defaad7851bf7593b95fe0171
MATLAB
1,596
57
function [f, cxy] = lan_coherence(LAN, cfg, nomean) %***************DEPENDENCIES*************** % - hann (Signal Processing Toolbox) % - hamming (Signal Processing Toolbox) % - lan_cspd (LAN toolbox) % - lan_cspd_mt (LAN toolbox) # See Dependencies (Chronux) if nargin < 3 nomean = false; end if ~isfield(cfg, 'twi...
632e6276cc60812a7832d44577aa079bace411d7eeeb1f02ecfbcd4c1a6d94a7
MATLAB
1,596
54
function som = integ(y,x) %INTEG Approximate integral. % SOM=INTEG(Y,X) approximates the integral of vector Y % according to X. % % Y : N-row-vector (or MxN-matrix) to be integrated % (along each row). % X : N-row-vector containing the integration path of Y % (default : 1:N) % SOM : value (or Mx1 vecto...
8d8219853c2ab79d413d157757d53d345f1495e2e165175a58eb86e64156dc94
MATLAB
1,596
54
%% Parameters dir_input = './';%'/om/user/dgoodwin/ExSeq/'; dir_rootoutput = './input/'; experiment_string = 'sa0916dncv'; if ~exist(dir_rootoutput, 'dir') mkdir(dir_rootoutput); end files = dir([dir_input '*.ics']); num_channels = 4; for file_idx = 1:length(files) datastack = bfopen([dir_input fi...
4e3271832a59ef5d4173ca4384d89a171f37dcf1d46ed79b1fe2f5e3c7f4ad8f
MATLAB
1,597
52
function [nvar, names, types] = nex_info(filename) % nex_info(filename) -- read and display .nex file info % % [nvar, names, types] = nex_info(filename) % % INPUT: % filename - if empty string, will use File Open dialog % OUTPUT: % nvar - number of variables in the file % names - [nvar 64] array of varia...
555eda415939fd9aaf3cce1204626b3881c5de67a83bbd615f7e347b6db46b49
MATLAB
1,597
56
function [s] = removefields(s, fields, varargin) % REMOVEFIELDS makes a selection of the fields in a structure % % Use as % s = removefields(s, fields); % % See also KEEPFIELDS, COPYFIELDS % Copyright (C) 2014, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the docum...
816fb6545b6a86955387f971249cec4252b761eaa5d4003cc3b92e2ecb80f78f
MATLAB
1,597
60
function [p, cc, np] = pcorr(x, y, Nit, Nstop) %PCORR Significance of correlation coefficient using permutations % % [p, cc, np] = pcorr(x, y, Nit, [Nstop]) % % Are data vectors x and y significantly correlated? The linear % correlation coefficient cc is first computed. This function returns % the probability that cc...
22f8e22fe281c150c9a99eda7b8cff4b62a053e5594c38a6f273fa5c28996a33
MATLAB
1,599
48
%% 非线性(动力学)特征:基于时域的熵 | nonlinear features: time-domain-based entropy %% 排列熵 | Permutation Entropy % 表征时间序列数据的复杂性(complexity)和规律性(regularity),通过计算序列中不同排列模式的概率分布来衡量序列的不确定性,值越大,时间序列越复杂、越不规律 % X: single channel EEG signal (either a row vector or a column vector) % opts.tau: 延迟时间 delay time % See also: % feat_Shanno...
63ea6daebdc095038cc50b25ad193830465bce68c5e8adeca635601aff09a1d1
MATLAB
1,599
52
function AutoPlayback(ImageArray,PauseInterval,IntensityLimits) figure(); set(gcf, 'color', 'white');set(gca,'XTick', []); set(gca,'YTick', []); BringAllToFront(); Beeper(5,0.15) message = sprintf('Ready to start playback of array, press OK to continue'); uiwait(msgbox(message)); pause(1); pause on; set(gcf,'Select...
9cf4b7c1d8c161e0b7e2470a0361f920f5e16353c724d08079115d8849c1b532
MATLAB
1,599
62
function Chen_correction_wrapper(venous, venous_time, IDIF_path, BG_path, qc_path, anatomy) load(fullfile(IDIF_path,['IDIF_' anatomy '.mat'])); load(fullfile(BG_path,['BG_' anatomy '.mat'])); IDIF_uncorrected = IDIF.IDIF; IDIF_uncorrected_time = IDIF.t_IDIF; if IDIF.flag_Chen == 1 if IDIF.flag_Feng =...
d61f6672fc6f586388b2af038fd24f5dfee8e8756b438d475933b5fbd2017e04
MATLAB
1,599
30
% Create coordinates of intersection contours and intersection edges tissues = length(tissue); PofXY = cell(tissues, 1); % intersection nodes for a tissue EofXY = cell(tissues, 1); % edges formed by intersection nodes for a tissue TofXY = cell(tissues, 1); % intersected triangles NofXY = cell(tissues, 1);...
ee48b5b09023a1ab6976582b891d4bf7764b3efc08c29c91eef5d26c43c7ffd5
MATLAB
1,599
63
clear % close all Monkey = ['Monkey2']; % ['Monkey1' or 'Monkey2'] Base = ['PER_ON']; Align = [ {'PER_ON_long'} ]; for al = 1:length(Align) switch Monkey case 'Monkey1' load(['TEST_SpettroXCHANNELS_SD_base_' Base '_' Align{al} '_B2b.mat']) start= 1; case 'Monkey2' load(['TEST_Sp...
a8ae6abdd795db088c297673d173818cab29a520c5b6eeae0c79a16e08ce3242
MATLAB
1,600
33
% Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences; % Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "License") % You may not use this work except in compliance with the License. % You may obtai...
ae56f68e352b9864c090840c0ea693d8d37b409d8b527baca8ce2ad7d5a29538
MATLAB
1,600
60
%% demean % % Temporal demean of time series data % % <matlab:open('demean.m') code> % %% Syntax % % Y = demean(X,normalise) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % X multi-trial time series data % normalise normalise (temporal) vari...
b6905b08f0f21dadd5fb10307b4b9be45bafca20da45ff18e49411d1fbca13f1
MATLAB
1,601
50
function [datfield, dimord] = getdatfield(data) % GETDATFIELD % % Use as % [datfield, dimord] = getdatfield(data) % where the output arguments are cell-arrays. % % See also GETDIMORD, GETDIMSIZ datfield = fieldnames(data); datfield = datfield(:)'; % it should be a row-vector throughout the subsequent code % thes...
c85b77668a6c7428f49cd57336799e67b6ad3a419f5b52e45430891ce50d65e4
MATLAB
1,601
47
function s = getDefaultFigureProperties() s.pLines = {'--'}; s.pSymbols = [ 'o', '^', 'v', 's', '>', '<', 'p', 'h', 'x', '+', '*' ]; s.pColors = [[ 99,199,113;... % verde 210,45,45;... % vermelho 194,129,201;... % roxo 112,179,250;... % azul ...
ee1c88b828bb26db0ba23cf9f65ce2a9135577b3e6998dcc1f51f5f5eb90dba2
MATLAB
1,601
49
function y = amrect(N,t0,T); %AMRECT Generate rectangular amplitude modulation. % Y = AMRECT(N,T0,T) generates a rectangular amplitude modulation % centered on a time T0, and with a spread proportional to T. % This modulation is scaled such that Y(T0)=1. % % N : number of points. % T0 : time center (default : N/2)....
364ce0852426517054ce2bcea383e9a6145651bda3b6a6b115dc5e77bf41c23b
MATLAB
1,603
53
function [y, out] = VBA_removeOutliers (y, t) % // VBA toolbox ////////////////////////////////////////////////////////// % % [y, out] = VBA_removeOutliers (y, t) % remove outliers based on robust z-scoring % % IN: % - y: data to diagnostic % - t: threshold for the outlier detection (default = 3.5) % % OUT: % -...
86ac56d10786ef53b1ff261640a57c8eb40ce82bddff576ffaf5fc681676c432
MATLAB
1,603
53
% WARNING: this source is DEPRECATED, see SWITCH[...]InParallel.m instead % % Step 4: Keypoints and Descriptors % This is the code that calculates the keypoints and descriptors at % varying scale levels % % INPUTS: % img is the image volume % OUTPUTS: % keys: a vector of structs that contain the keypoint and descript...
f9c833f066681fd4db0ec8863603888452cd34aff958925204c2ed5386c63b60
MATLAB
1,603
37
% SOFA API - demo script % Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences % Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "License") % You may not use this work except in compliance with the ...
4f7b95be87f857fa99f6efce211dff44f09715391a02727ed06807f3dea2c85c
MATLAB
1,604
52
%% SDO Jack-knife % Simple utility to iterate through the post-spike distributions using a % 'leave-1-out' (Jackknife) operation to produce subsets of SDOs. % % Could be used to evaluate the sensitivity of particular spikes on the SDO % matrix. % % INPUTS: % - px0 -[N_STATES, N_SPIKES] column vectors of pre-spike ...
5dcae2998b551c87330800847eb6ed41ce534a36a453eb7eca3ee1637ea3c011
MATLAB
1,604
49
clear all nInst = 500; nVars = 100; X = [ones(nInst,1) randn(nInst,nVars-1)]; w = randn(nVars,1); y = sign(X*w); flipInd = rand(nInst,1) > .9; y(flipInd) = -y(flipInd); w_init = zeros(nVars,1); funObj = @(w)LogisticLoss(w,X,y); fprintf('Running Hessian-Free Newton w/ numerical Hessian-Vector products\n'...
64dc0de01681b7b754d0db539181f2d848e59710304193103de07f6db5ac19c1
MATLAB
1,604
76
function showvc_prog_plain(loc,tri,view_dir,para); cmap=1; voxelkont=0; if nargin>3 if isfield(para,'cmap') cmap=para.cmap; end if isfield(para,'voxelfield') voxelfield=para.voxelfield; voxelkont=1; end end colp=loc(:,3); [np,ndum]=size(colp); colp=loc*view_dir'; [cs,is]=sort(colp); d=max(col...
5f4676fde36f650243c4f1f0ec34b25a50b6b842c5fdab044e3645d1c770be6e
MATLAB
1,605
36
function [TTest2Cov_T,TTest2Cov_P]=y_TTest2Cov(Variable1,Variable2,CovariateVariable1,CovariateVariable2) % [TTest2Cov_T,TTest2Cov_P]=y_TTest2Cov(DependentVariable,CovariateVariable) % Perform two sample t test with or without covariates. % Input: % Variable1 - The Variable 1. Test if Variable 1 is greater than V...
da243fcf4db906ac284840df4c4ea32f70e8587db1a8a36230942d3ec62fcb73
MATLAB
1,605
62
function a = myatan(x,y,varargin) %myatan Choose from various representations of getting the inverse tangent % % This function takes in two vectors of dx and dy and returns the vector of % angles between dx and dy % Inputs: % Type: 'degrees' or 'radians' % Options: 1 = -180:180 or 2 = 0:360 % Test Ca...
2b5e79c775081c3f1801be9b0f8b4326d1d6566eec07f85d60c71374f184cc6e
MATLAB
1,606
35
%%% All subject PFs load(fullfile(DataPath, 'SurveyMainData_Processed.mat')) [palmar_mask, palmar_template, dorsal_mask, dorsal_template] = GetHandMasks(); [pbt_regions, dbt_regions] = GetHandSegments(); %% Generate temporary high-resolution frames u_subjects = unique({SurveyMainData.Subject}); sub_labels = {'C1', 'P2...
4ef0b03448cb741c3fc3c3b14ff14865aa8ea1a2c46d7de77225d018cf31b3af
MATLAB
1,606
56
%% ROC curves for two hypothetical classification systems % A is better than B. Plots true positive rate, (tpr) vs false positive % rate, (fpr). %% % This file is from pmtk3.googlecode.com domain = 0:0.01:1; fA = @(x)x.^(1/3); fB = @(x)x.^(2/3); linewidth = {'LineWidth', 3}; hold all; plot(domain, fA(domain), '-r', ...
6928211057a458b107c1bf8f771840fceee62d4291755ef22d948144cbb9cdb7
MATLAB
1,606
51
% In the case of debugging a failed registration, it can be helpful to % visually inspect the spatial distribution of the matching keypoints % between two rounds loadParameters; %Choose a round that you want to visualize, make sure it's not the %reference round! ROUND_TO_EXAMINE = 3; if params.REFERENCE_ROUND_WARP =...
b70990d136b86b860d71c4a3086ad640b1fb91115575a306969590cd9e31b104
MATLAB
1,606
60
function paramstr = wlAux_getStringFromParams(thisev) % function paramstr = wlAux_getStringFromParams(thisev) % % This function builds a human-readable text string describing the fit % parameters in the specified event record. % % "thisev" is the event structure to describe, per EVENTFORMAT.txt. % % "paramstr" is the ...
b8724346a3ac0607c16dfbafb99ba59a56627aaae5826b1f09790778c54a3d11
MATLAB
1,606
54
% HemoCorrection.m % Sarah West % 8/26/21 % Corrects the hemodynamics of a stack. Requires input of two matrices-- % the blue and violet data from a single stack. % Inputs: % bData -- the blue-channel only stack, in a 3D matrix (pixels, pixels, % frames) % vData -- the violet-channel only stack, in a 3D matrix (...
c0a94c95d4547aa2dfb6e2ba976cd3e2c5f6c9bf8bb374fdd2be001b4c8fe06a
MATLAB
1,606
53
function y = afxSmoooth(y,FWHM,dim,mat) % y = afxSmoooth(y,FWHM,dim,mat) % convolve data in y (linearly packed in the spatial dimension with % original dimensions dim and q-form matrix mat) with gausian smoothing % kernel with full width at half maximum of FWHM fprintf(' Smoothing ...') ...
cdfaf78940c4a0d50760cc1dd6ef98066438cb8849e570ba3c6c316c9e3bd090
MATLAB
1,606
52
function [newsubs, newsz] = renumber(subs, sz, range) %RENUMBER indices for sptensor subsref % % [NEWSUBS,NEWSZ] = RENUMBER(SUBS,SZ,RANGE) takes a set of % original subscripts SUBS with entries from a tensor of size % SZ. All the entries in SUBS are assumed to be within the % specified RANGE. These subscripts are t...
f317c2cbedfc556bab95fec157110b69181d392a636a78a69202490f259df7e4
MATLAB
1,606
60
function mrf2 = factorGraphToMrf2(fg, varargin) %% Convert a factor graph to a pairwise Markov random field % for use by Mark Schmidt's UGM library % See mrf2Create for additional optional args %% % This file is from pmtk3.googlecode.com fg = factorGraphMakePairwise(fg); % does nothing if fg is already pairwise G = ...
6d98326c7119c5fa2bb9f045ae2650d55a6eb7e6de53c28ee427ceeeecbd31dc
MATLAB
1,607
45
function CBIG_selectBETResults(BETOutFolderPattern) % CBIG_selectBETResults(BETOutFolderPattern) % % This function selects the best (equivalently, the latest) BET result for % each image. For example, if Image 6 is present in BET rounds 1, 2 and 3, % then we should take the round 3 result as its final BET result. % % ...
7a0463b6df205d7dead166508b75f2f22afc1d34ba791f683ad3163248ba284b
MATLAB
1,607
61
% AUTHORSHIP % Primary Developer: Stephen Meehan <swmeehan@stanford.edu> % Math Lead & Secondary Developer: Connor Meehan <connor.gw.meehan@gmail.com> % Bioinformatics Lead: Wayne Moore <wmoore@stanford.edu> % Provided by the Herzenberg Lab at Stanford University % License: BSD 3 clause % function [fold...
9bd54802803f10efaa75cdb7cda2aeceb3b9231a42853ab74e653eec9a5047c3
MATLAB
1,607
36
l1 = load('/home/mayank/work/poseEstimation/RomainLeg/Apr28AndJun22_onlyBottom.lbl','-mat'); lfiles1 = {'/home/mayank/Dropbox/MultiViewFlyLegTracking/sep1616/sep1616-1531Romain.lbl' '/home/mayank/Dropbox/MultiViewFlyLegTracking/sep1516/sep1516-1537Romain.lbl' '/home/mayank/Dropbox/MultiViewFlyLegTracking/sep1316/se...
c4938752d4462ff3e76f1d9b3a0df248be38a5827a34c8c7a0d93e8c39c30000
MATLAB
1,608
42
clear all clc tmp=pwd; cd .. addpath(genpath(fullfile(pwd, 'utils/'))); addpath(genpath(fullfile(pwd, 'spmutils/'))); cd(tmp); % set the value to the Pred_folder set in step 2 coreg_of_predMRA_dir=''; % set the value to the Pred_folder2 set in step 3 pred_of_coregMRA_dir=''; % coregister individual MRA v...
5401d2054e934afe67385875a43e4683c5fbd02dcea19857aab4111a7bbf29bf
MATLAB
1,609
58
function [p,U2_obs,U2_H0]=watsons_U2_perm_test(A1,A2,N) % % [p,U2_obs,U2_H0]=watsons_U2_perm_test(A1,A2,N) % % Computes the probability that two samples of circular data (angles) come % from the same distribution, or from distributions with the same direction % (null hypothesis), using a permutation test and Watson's U...
9e0ed54f8c8114369c4eb40c67b03659a5953c03d18b63bc2a5114f611b51b3d
MATLAB
1,609
40
% Load libraries addpath C:\code\wjn_toolbox; addpath C:\code\spm12; addpath(genpath('C:\code\leaddbs')); spm('defaults','eeg'); addpath C:\Code\wjn_toolbox-master; addpath C:\Code\wjn_toolbox % Parcellate ECoG master table output_filename = 'ECoG_Atlas_MasterParc'; load ECoG_Atlas_Master_Table.mat; % Load the table ...
33f58f685b52e928657fd931725ea02a6c69147fddf44d4eb701e6d044c1cce6
MATLAB
1,610
34
function createPhysio_fromHCP_aging(HCP_physio_dir) prate = 400; %% sampling rate of physio is 400 (every 0.025s); cd(HCP_physio_dir) %%% readin physio tmp = dir('Physio_combined_*.csv'); tmp = importdata([tmp.folder,'/',tmp.name]); physio.RESP = tmp.data(:,4); physio.PULS = tmp.data(:,...
68bf4e4b32d4ab8e604b2577dfc6bb1f9469ec8e95c937db1c86fc41b7e3e602
MATLAB
1,610
46
function new_network = threshold_network(a,rho) %The function thresholds the network using the approach of Kujala et al. %(2016) https://doi.org/10.1111/ejn.13392 % a : undirected, weighted adjacency matrix % rho : density of the network % new_network : thresholded, binary network no_links_percent = round(nnz(a(:))...
bfa0d4ce6a1d7d5329c391eb61b4e3383897106a16cd0b88f4beafe76b349e53
MATLAB
1,610
73
function w = iimg_smooth_3d(w, volInfo, sfwhm, varargin) % Smooth 3-D images stored in columns with FWHM in mm of sfwhm % % :Usage: % :: % % function w = smooth_3d(w, volInfo, sfwhm, [badvox]) % % NOTE: Enter smoothing kernel in mm, as a scalar or [sx sy sz] triple % % :Inputs: % % **w:** % Take v x n matr...
89ec50bbb8d3e34f34e63853defc4a6e2c9334b8d280c4cfdbb8d47a63f3a965
MATLAB
1,611
44
function y=lambdak(u,k); %LAMBDAK Evaluate lambda function for Affine Wigner distribution. % Y=LAMBDAK(U,K) evaluates the parametrization lambda function % involved in the affine smoothed pseudo Bertrand distribution. % % LAMBDAK(U,0) = -U/(exp(-U)-1) for K = 0 % LAMBDAK(U,1) = exp(1+U exp(-U)/(exp(-U)-1)) for K = 1...
afaeb5abc6079f6ec6f1def62b070209470d7b7fb4ba068edc9189a873f7658e
MATLAB
1,612
59
function [C] = VBA_spm_Ce(v,a) % return error covariance constraints (for serially correlated data) % FORMAT [C] = spm_Ce(v,a) % v - (1 x n) v(i) = number of observations for i-th block % a - AR coefficient expansion point (default a = []) % % a = [] (default) - block diagonal identity matrices specified by v: % %...
bf84f74c9b85e3f2872ec11f392e4df2e7af8bc49cc9ed2f37f16af42e55146c
MATLAB
1,613
73
% Demo for Lotka-Volterra competitive system % NB: this is a highly nonlinear system, which means that one may have to % run the simulation many times before its returns non-NaN data... clear variables close all % Choose basic settings for simulations f_fname = @f_LV2D; g_fname = @g_Id; u = []; n_t = 2e2; delta...
dc39c8d2815cb9a7008516c1416c6b0c4e61cd553fbefe12e26ea1db10516428
MATLAB
1,614
63
function varargout = plot_avRainbow4(vcf, avsd, summaryInfoTable, avColors, selSmltIds, varargin) %% handle optional inputs (varargin): nOpVar=0; % counter for optional variable nOpVar=nOpVar+1; opVars.avIndInterval = []; defaultValues{nOpVar} = 1; opVars = handleVarargin(varargin, opVars, defaultValues); %% nsmlt =...
ee1c67a0faeb89de923392a73fa7ad4ec840b928ff933e459dd4699503b08ed0
MATLAB
1,614
86
function rankout = rankdata(m, varargin) % ranks = rankdata(m) % default: midrank method % ranks = rankdata(m, 'nomidrank') % do not use midrank % % ranks a vector, returns ranks in place of values % % Tor Wager % % Modified April 2007 to use the midrank method to handle...
3a061b122e6c8da54220486bbcd64635c0228b7d2235d92c55eab06d62e19901
MATLAB
1,616
69
function [sF,sDCM] = VBA_spm_split_dcm(DCM,nsplits) % split DCM inversion using time series partition % function [sF,sDCM] = spm_split_dcm(DCM,nsplits) % IN: % - DCM: the original DCM structure % - nsplits: the number of splits in the partition % OUT: % - sF: log-evidences for each split in the partition % - sD...
e52b50699b2985805ee98d5156556e7dab856b3c3b01a90c730c67681c0640fe
MATLAB
1,617
47
% Writes/reads a large set of images into/from multiple directories. % % This is useful since certain OS handle very large directories (of say % >20K images) rather poorly (I'm talking to you Bill). Thus, can take % 100K images, and write into 5 separate directories, then read them back % in. % % USAGE % I = imwrite2...
3f1a21197bb5aac598d381776c275881326b3d7c11e0d40c42b6e2ab0ccd8503
MATLAB
1,619
39
datRoot = '/Volumes/LaCie/Farries recordings/'; rat = 'IM1153'; % list sessions sesList = dir([datRoot rat '/*ic']); sesList = arrayfun(@(x) x.name, sesList, 'UniformOutput', false); for i = 1:length(sesList) fprintf('%d) %s\n', i, sesList{i}) end iSes = 1; preprocessRange = [0 600]; timeRange = [0 Inf]; for iSes...
11f65d788c477ba67395ceb052796727e144723735375cb55ac0b6159dfcc67c
MATLAB
1,620
56
%% Binary Logistic Regression on SAT data % Example from Johnson and Albert p87 %% Load data % This file is from pmtk3.googlecode.com stat = loadData('sat'); y = stat(:,1); X = stat(:,4); %% Fit model pp = preprocessorCreate('addOnes', true, 'standardizeX', false); model = logregFit(X, y, 'preproc', pp); %[X, ndx]...
409628f550cdcf847415268157173ad42c2b26574e15781526f0002af4c98f9d
MATLAB
1,620
53
function Igrid=make_grid_image(Spacing,sizeI) % This function creates a uniform 2d or 3D image of grid % Igrid=make_grid_image(Spacing,sizeI) % % inputs, % Spacing: Spacing of the b-spline grid knot vector % sizeI: vector with the sizes of the image which will be transformed % % outputs, % Igrid: Image of uni...
8a02219f675163f55011ce5515b6273bf8011bd9d90b1780599d5085fafa81fe
MATLAB
1,620
60
function xc = CrossCorr(spkDat, refUnit, testUnit, varargin) nSamp = 10000; binSpec = []; binEdges = -100.5:100.5; noLaser = true; for i = 1:2:length(varargin) switch varargin{i} case 'nSamp' nSampTarget = varargin{i+1}; case 'binEdges' binEdges = varargin{i+1}; cas...
9aa2be9418a06a3e99a977b59626c0e9f2332b10755ba91d6a0f64f5018a340e
MATLAB
1,620
51
function [rho,pval]=MySpearman(x,y) % This function is to be a dedicated super-fast Spearman correlation % calculation for the input data X(col vector) and Y(matrix). Inputs are % assumed to have the same number of rows and have no NaNs or Infs. Y is % also assumed to have no duplicates within a column. % Steps: %...
9b6c9c0601bb6bee96f34935c83d35407a45e7af1c702baba67132150ae38212
MATLAB
1,620
56
function ns = count_squares_fisheye_distorted(I,x1,y1,x2,y2,win, fg, cg, kg); [ny,nx] = size(I); if ((x1-win <= 0) || (x1+win >= nx) || (y1-win <= 0) || (y1+win >= ny) || ... (x2-win <= 0) || (x2+win >= nx) || (y2-win <= 0) || (y2+win >= ny)) ns = -1; return; end; if ((x1 - x2)^2+(y1-y2)^2) < win, ...