sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
85e4510cd0888e04317b7c4ecfd6b05e5408a22dcd18bf88fcf3205b4206d2d6
MATLAB
1,306
42
function [data_sound_filt, W]=FilterOutGivenPatternsSound_BF(A, data_sound, Msound) % This function uses beamforming to create a spatial cleaning filter which takes % into account the smoothing step by SOUND to remove an artifact topography % (or multiple) estimated prior to SOUND % % Input: % A - artifact topo...
92b4efa6c0f2ebd71f78465d6aab74480fec1eee0473d15ece4f9af19543bc4f
MATLAB
1,307
42
function [subj] = set_object(subj,objtype,objname,obj) % Replaces an entire object, i.e. a cell from one of the main 4 cell arrays % % [SUBJ] = SET_OBJECT(SUBJ,OBJTYPE,OBJNAME,OBJ) % % For internal use. Use set_mat, set_objfield and set_objsubfield % License: %=========================================================...
dbe736d3b177b66c3382db32308da5b9f7d5f5fe0b51d1df961cc64b0f1b1c23
MATLAB
1,307
50
%% Add path addpath(genpath('../Ionnic Channel'),genpath('../Tools'), genpath('../Synapses'), genpath('../Datas')); %% Import data from neuron (FS) dt = 0.01e-3; Vmem = -90e-3:dt:60e-3; l_V = length(Vmem); %% Anonymous function Minf_simp = @(v) 0.4499*tanh(20.01 + 50...
cf10a8796f2258d2e9700fc0d5fea958889c52cef26a3dc345541747a009823e
MATLAB
1,308
39
% This is single-channel classification using kfolds % timePt needs to be in sample points % folds are partitioned outside of this function. % Classify all channels including pruned channels. % for preprocessFNIRS06_CV_GLM_ssBeta_SingleChn_MultiOnly function [validationScore] = trainLDA_SingleChannelHbX_TrTst(... ...
fa95fbb45038e7d72a94ccf57f1fe6456483520db3a2ee7c65e96242dc333b00
MATLAB
1,308
33
% Uses an eigenmode-based analysis to study how neuronal tracing connectome eigenmodes constrain cortical activity. clc clear all % set code folder path mypath='E:\Marmoset_CFD-main\'; addpath(genpath(strcat(mypath,'functions_matlab'))) % set the number of null model n_null = 1000; %% Step1: compute and ...
3230d4d089d7f08a3e4f112195615715cc8ef7f9b51f5960b570d25fb54d79a2
MATLAB
1,309
44
clear all [task_info,supPath] = loadDBAndSpecifyDataPaths('Vermis'); req_params.grade = 7; req_params.cell_type = 'SNR|BG|PC|CRB'; req_params.task = 'speed_2_dir_0,50,100'; req_params.ID = 4000:5000; req_params.num_trials = 50; req_params.remove_question_marks = 1; raster_params.align_to = 'cue'; raster_params.time_...
2379922a05c1d53a93634fd5b0033254fef35483470613c8a3f360bb0a80320d
MATLAB
1,310
30
function f = crossCorrModel_Intensity(preTrain,postTrain,params) % Computes the cross-validated intensity of a spike train given a (predictor) spike train in a % gaussian temporal window. % % USAGE % % f = crossCorrModel_Likelihood(preTrain,postTrain,preTest,postTest,binT,params) % % preTrain pre-synapti...
6c84e9cf1433abce550a70cb6047b7ca14eb05bb8800267807bf24884b0b56fb
MATLAB
1,310
55
function [starttime timeleft] = eta(cur,total,starttime, interval) % Display an estimate of time remaining in a calculation. % % function [starttime timeleft] = eta(cur,total,starttime, interval) % % Usage: % % t0 = clock; % t0 = eta(cur,total,t0,0.05); % License: %=====================================================...
aece6ebc9cd3dfd305b2b8c4a54e14571e211c995601227f04b41e62daaba8a3
MATLAB
1,311
31
% Matlab Toolbox for Dimensionality Reduction % Version 0.8 18-APR-2012 % % %Main functions %---------------------- % compute_mapping Performs dimension reduction using the specified technique % out_of_sample Performs out-of-sample extension using trained DR technique % out_of_sample_est Performs out-o...
fb2281ed5ea9dbe1045361ad128172c096a74e452a87d8569013b3d02f60977e
MATLAB
1,311
35
function [ExpansionorShrinkagePercent,rotation_deg,xTranslation_um,zTranslation_um] = transform2Knobes (histologyToOCTT,histologyScale_umperpix,octScale_umperpix) % histologyScale_umperpix - size of histology image pixels, % octScale_umperpix - size of oct image pixels % ExpansionorShrinkagePercent - expansion, - sh...
93b87a2e55c993eaa59c6246422d79ff9d6d289a3b61b74ee00142bb21c38443
MATLAB
1,314
31
clear clc close all %% Folder = '\\storage1.ris.wustl.edu\kerschensteinerd\Active\Emily\NaturalSceneVideo\Analysis\Results\SpatialCorrection_110123'; LM = load([Folder '\SpatialCorrelation_luminance_Intercept.mat']); SR = load([Folder '\SpatialCorrelation_Surround_Intercept.mat']); TS = load([Folder '\SpatialCorre...
cd87725549b7ec6a8bcdbdc9fe52de076312d0c0bd112801e10cf75ba3d2af2c
MATLAB
1,314
49
ndip = 20; snr = [0.6 0.5]; snr2 = [0.5 0.8]; amp = [0 0.2 0.3 0.4 0.5 0.6 0.7 0.8];%[0.2 0.4 0.6]; phs = 2.*pi.*[0 1/17 2/17 4/17 8/17]; patchsigma = 0; N = [50 150];%100; state = rng(1,'twister'); %state = output.state; list = reshape(1:100,[10 10])'; for i0 = 1:size(list,1) for i1 = 1:numel(ndip) for i2...
fe123b1da1f1b73a6e6659c217f618594ab8fedc8e4c73fe31aba5e880c82c00
MATLAB
1,315
49
function [objcell] = get_type(subj,objtype) % For internal use. Returns the entire cell array of a given type % % [OBJCELL] = GET_TYPE(SUBJ,OBJTYPE) % License: %===================================================================== % % This is part of the Princeton MVPA toolbox, released under % the GPL. See http://ww...
5f441ad88bf962bbbb3ee4f5050f4d0dbd49dd470a5f5ab1324c7117e1c56b9a
MATLAB
1,319
57
%% 12-6-17: SSFP steady state, BM equations function [Mss] = ssSSFP_BM(alpha, TR, dw, T1x, T2x, f,ka,delta) if nargin==7 delta=0; end M0b = f; M0a = (1-f); kb = ka * M0a/M0b; R1a = 1/T1x(1); R1b = 1/T1x(2); R2a = 1/T2x(1); R2b = 1/T2x(2); %%% Full system matrix including off resonance in "+" basis Ea = diag([-R...
39d3560a9083c5ec1a9155856ec2b3315d33e827ca050729fe7fc84309744881
MATLAB
1,320
41
function [unit_match_mat] = match_units_to_find_axons_211019(nmi_mat,nmi_thresh) %This function finds unit pairs which optimizing based maximum NMI % The algorithm finds the max NMI value in the matrix, stores the row and % col unit numbers, and then looks for the same in the remaining % rows,col. % Note: the ...
407972705833e3ba373040c8371fe2f7a99de81c1e60ce3ba42557b5a9e10ccf
MATLAB
1,320
55
function [burstBool burstIsiPk] = BurstIndex(S,varargin) % [burstBool burstIsiPk] = BurstIndex(S,ep) % % Computes burst index % Input: % S: a ts object of spike timing. % ep (optionnal): intervalSet object of the epoch of interest % % Output: % burstIdx: burstiness index of the cell (1 for a Poisson...
f451aa5711a9faade7a0f5a86de71e6dbea2e999a93ad9e799bac6e7e48d0e93
MATLAB
1,320
70
function transients = get_transients(t, dff, debug) lowPassTh_Hz= 0.5; highPassTh_Hz= 2; % filterType = 'bandpass'; fc = [lowPassTh_Hz highPassTh_Hz]; filterType = 'high'; fc = lowPassTh_Hz; fs = 1/median(diff(t)); [b,c] = butter(4,fc/(fs/2),filterType); nan_idx = isnan(dff) dff(nan_idx)=0; filtered_sig = filtf...
847f02e82d10e1cc881c89f2362d1ddcb2552f920a27134fb2c21b114415eb61
MATLAB
1,321
34
% function output = transres_accuracy_matrix_minus_chance(decoding_out, chancelevel, varargin) % % Get a matrix of the accuracies of all pairwise comparisons (i.e. chance = % 50 %) from a multiclass classification. Libsvm doesn't provide this % directly. The diagonal is not defined and set to NaN. % IMPORTANT: % This f...
e51f38841f82609383819458f9bfeac927f779736b55656079f2ac14bc15e1cf
MATLAB
1,321
45
s = size(Lm,2); p = size(Y,1); Ps = sum(Qns,1)/n; Fmatrix = zeros(6,s); tempdig_a = digamma(a); for t = 1:s kt = size(Lm{t},2); temp_alt = Xm{t}.*repmat(Qns(:,t)',kt,1); Xcor_t_Qns_weighted = Xcov{t}*sum(Qns(:,t),1) + Xm{t}*temp_alt'; Fmatrix(2,t) = eps; Fmatrix(3,t) = +.5*n*(kt-1)*Ps(t) ... ...
464a1dfbfdd6198aa3978e42298abe7886996a308f1708c220dba06b3c44ea34
MATLAB
1,322
49
function [val] = get_objfield(subj,objtype,objname,fieldname) % Retrieves a field from an object % % [VAL] = GET_FIELD(SUBJ,OBJTYPE,OBJNAME,FIELDNAME) % % e.g. nvox = get_objfield(subj,'mask','wholebrain','nvox'); % % Use OBJTYPE = 'subj' and OBJNAME = '' if you want to get a field % in the root of the subj structur...
8b7990363f42ea876bf446fbaa9cbecf33ea63b47f340b1b6fadc0696e6e0b89
MATLAB
1,322
47
function vviq_distribution_plot = vviq_plot_distribution(p) % Load VVIQ data vviq_file = dir(fullfile(p.dirs.data, 'questionnaire', 'vviq.mat')); if isempty(vviq_file) warning('vviq.mat not found.'); return; end load(fullfile(vviq_file.folder, vviq_file.name), 'vviq') % Get histogram counts x = 16:2:80; hc = ...
9498e90441c71b0089c7e6e01489e224153d99d1db6d7bdb074ca5834b616c4c
MATLAB
1,322
38
function find_spiking_distro_sim() fdr_prefix="gc_can_"; % folder name prefix use_hopper_data=1; % access hopper data locally local_run=5; % local run number hopper_run=5; % hopper run number save_gridscore_file=1; % save gridscore to file run_on_hopper=0; % run from hopper's system p1=0; ...
9db44a1c0a7c365aad14cb4888d4980dd7af29e5adabc4f0986754db0fad8df8
MATLAB
1,325
78
function [meanwav, stdwav] = MeanStdWaveforms(TTfilename, T) chunk_length = 5000; offset = 1; meanwav = zeros(4,32); stdwav = zeros(4,32); nSpikes = 0; while 1 TT = LoadTT(TTfilename, offset, chunk_length); EndingTime = EndTime(TT); StartingTime = StartTime(TT); T1 = Restrict(T, StartingTime, EndingTime); T...
080a427d14253b319db67c8b8f583deeb8a7f0a6a8bb94905f89b565a99e7bd7
MATLAB
1,326
76
function PhaseMap = PhaseMap(X,Y,ph) %peyrache 2007, beta times = Range(ph); phase = Data(ph); gw2D = gausswin(20)*gausswin(20)'; gw2D = gw2D/sum(sum(gw2D)); [occH, xbin, ybin] = hist2d(Data(X), Data(Y), 200, 200); figure(1) imagesc(convn(occH,gw2D,'same')) PhaseMap = zeros(length(xbin),length(ybin)); phH = zeros...
b61263fe4e96641669440847be9ac7ac8a43dc27c3f27061ecddba1b0fb80ce2
MATLAB
1,327
52
function [errCode, txt] = awsCmd(cmd, knownErrorText, v) % This function executes system command: system(cmd). It will parse the % error codes and decide if to throw an error, or retry command. % INPUTS: % cmd - command to be executed % knownErrorText - cell array containin known error texts to ignore, they %...
129c95011b2a51347e62779fddb2f3717cd693f4e09fc01e8f3df1d7aae502b6
MATLAB
1,330
48
%% Plot V4 MI noise correlations d' and bias split at cued location %% Code load('V4_rsc_MI_pre_bl.mat') bl_onset_win = [400 0]; epoch = num2str(bl_onset_win(1))+"_to_"+num2str(bl_onset_win(2)); load('MI_split_RFTrials.mat') plot_flag = 1; % to plot or not to plot fig_id = ["c","d"]; for bin_flag = 12 % > 5 spikes/...
dc95c6874ffe909ee8b4c782cb5ac32cfd89a2ca1dc6ecd23903e2e3978dc46d
MATLAB
1,330
35
%function [EegSegAv EegSegStd EegSTrange] = TriggeredAvM(data,T,chanIx,win,sr,nChannels,SignalType) % trigered averages subset of channels from file or matrix % within a window of win (in msec) % method : 1, to load all channels for each segment around trigger (if nChannels/nTriggers is large) % 2, to loa...
795cd4cd635a1d9af04082a152f5e954e083ada3555eb6481782fb50b7f4d380
MATLAB
1,332
37
function [vol] = get_ref_vol(subj,patname) % Returns the mat of the pattern's masked_by mask % % [VOL] = GET_REF_VOL(SUBJ,PATNAME) % % Think of this as getting the pattern's 'reference volume'. % % Every pattern needs to know which mask it's masked by, because the % pattern throws away information about where its voxe...
ecbe79ac02457fed7ef8fce76b81a1ba5d63f175dd785b806620e21ec2438621
MATLAB
1,332
25
function decoding_out = newton_test(labels_test,data_test,cfg,model) if isstruct(data_test), error('This method requires training vectors in data_train directly. Probably a kernel was passed method is use. This method does not support kernel methods'), end switch lower(cfg.decoding.method) case 'classifica...
42a07544f4c8490c486ebbd52da212f670372a0f5aaf8b6e3a14f43224541db4
MATLAB
1,333
44
% This script computs stats for the following libraries libraryNames = {'LH','LG','LF','LE','LD','LC'}; isGoogleSheetUpdate = true; % Set to just update json and skip google sheet updates %% Time dependence if isGoogleSheetUpdate % No need to run once every 7 days logic when no google sheet update. ...
3dbb869438fb31909cc9a5dfeead73f5c8900e051a7b75797e8a2dc861d576cc
MATLAB
1,334
36
function [data_X,data_y_player,pair_num, dataCh] = data_epo2DeepNet(epos_player,epos_observer,session_role) % BBCI data format: % epo.x - timesteps x channels x trials % epo.y - classes x trials % % convert to data format: % dataX - EEG data % [pariticipant x tria...
5d6749e8b813f308b8193de1e094f552c7c71504309cd0f2be7910f18dfcd430
MATLAB
1,334
41
function gmmmixes = mdn2gmm(mdnmixes) %MDN2GMM Converts an MDN mixture data structure to array of GMMs. % % Description % GMMMIXES = MDN2GMM(MDNMIXES) takes an MDN mixture data structure % MDNMIXES containing three matrices (for priors, centres and % variances) where each row represents the corresponding parameter % va...
fc8206be66bb28bd883e3cc6dfbf0e22168039c51fcc91053ed201c8ff97e5e7
MATLAB
1,334
28
% This function compare if two correlation coefficients are significantly % different. % The correlation coefficients were tansfered to z scores using fisher's r % to z transformation. % ref: http://core.ecu.edu/psyc/wuenschk/docs30/CompareCorrCoeff.pdf %-----------------------------------------------------------...
0bfa10fa1b3ff1f8e27ae68afbfbed8bc03330a4bb8948e7d338d2486cdeb5dc
MATLAB
1,336
34
function [z] = sandwich2x2(x, y) % z = sandwich2x2(x, y) % compute x*y*x' provided y = hermitian % and dimensionatity is 2x2xN %FIXME build in check for hermitianity z = complex(zeros(size(x))); xconj = conj(x); xabs2 = abs(x).^2; z(1,1,:,:) = xabs2(1,1,:,:) .* y(1,1,:,:) + ... xabs2(1,2,:,:) .* y(2...
be146df0ddbf48dba444e3fb94126b7220f5fed9dadd8c212f99628d88083c10
MATLAB
1,338
39
function [ypred,dval] = test_libsvm(cf,X) % Applies a LIBSVM classifier to test data and produces class labels and decision values. % % Usage: % [labels,dval] = test_libsvm(cf,X) % %Parameters: % cf - classifier. See train_libsvm % X - [samples x features] data matrix -OR- % ...
31a17e61a58170327c8d0a850d5fdd980da54e90403dacc30f9b6cdf2ff07786
MATLAB
1,341
40
function [ft,signIF] = instantaneous_frequency( xph, Fs ) % *WAVE* % % INSTANTANEOUS FREQUENCY returns the instantaneous frequency estimation % from the formula: % % d(Psi)/dt = \Delta(Psi_n)/dt = Arg(X_{n+1}*X_{n})/dt (2.11) % % where X is the analytic si...
89c21f463498f4b4932ad72eebb86bf0b032b443abb8077c57130d5fc1e2a9ed
MATLAB
1,341
42
function Xi = Xi_diff_BM(Xi_T,Xi_L,diff,kmax,N) % Function to build Xi operator with diffusion effects for BM (6 states per % k-value). % This function efficiently uses spdiags to build the large band diagonal % matrix that results from applying Xi_L and Xi_T to each order of states. % Diffusion changes the matri...
4809f422d1d0c658989997f7e6ce207444fccc1da4b811f2685ab1c641073a29
MATLAB
1,342
47
function fid = platform_fopen(fname,perm) % fid = platform_fopen(fname,perm) % % :description % % A utility function that opens a binary file across multiple % platforms. On the Mac and SGI, BrainVoyager file bytes must be swapped. % % :inputs % % fname file to open, e.g. 'myvolstats.vmp' % perm ...
622ac37ddf432c4b9b6757c6672fdbf81bcbfec11bab97b71c37b409150d86d4
MATLAB
1,342
52
%% Add path addpath(genpath('../Ionnic Channel'),genpath('../Tools'), genpath('../Synapses'), genpath('../Datas')); %% Import data from neuron (FS) dt = 0.01; Vmem = -90:dt:60; l_V = length(Vmem); %% Matrix Initialization sinf = zeros(1, l_V); sinf_error = zer...
a94598abc91aab7120fa31f3af91f24744ecb80100d975108444658d4cbf0772
MATLAB
1,342
50
function [fields] = get_special_fields_list(objtype) % Internal - gets a list of special fieldnames % % [SPECIAL_FIELDS_LIST] = GET_SPECIAL_FIELDS_LIST([OBJTYPE]) % % Returns a cell array of field names that you can't remove or mess % with. % % OBJTYPE (optional, default = ''). If this empty, returns the % common requ...
b06132aaacaf0a7381240e920b8871b1e66244570b3edaea9fe3864651480887
MATLAB
1,342
55
function [evals, evec] = eigdec(x, N) %EIGDEC Sorted eigendecomposition % % Description % EVALS = EIGDEC(X, N computes the largest N eigenvalues of the % matrix X in descending order. [EVALS, EVEC] = EIGDEC(X, N) also % computes the corresponding eigenvectors. % % See also % PCA, PPCA % % Copyright (c) Ian T Nabney ...
07f6468daa674c890aefdcae6f046324ada9add9d6eb8b22339f780c11a51773
MATLAB
1,343
48
function [run_dat, p] = eye_extract_runs(dat, event, p) % Initialize output variables run_dat = []; % Define number of timepoints n_tp = p.eye.seconds * p.eye.hz - 1; % Identify run events run_ind = [find(strcmp({event.type},'!MODE'))]'; run_events(:,1) = run_ind + 1; run_events(:,2) = [run_ind(2:end); numel(event)]...
4182842a6c3e1d3ded8551df943664dcc7f2be3617743342efded99610f3ed67
MATLAB
1,344
37
function theImage = Matrix2Grayscale(matrix) %Matrix2Grayscale Make a grayscale image from an input 2D matrix % theImage = Matrix2Grayscale(matrix) % % Used by MakeGrayImageFigureForMatrix % %See also MakeGrayImageFigureForMatrix % %History % % 7/26/2002 bds wrote it for matwave package, D.R.Williams' lab %...
f98fe90ee98236824a31c783917031ea02b3fcb1539724bc4d23bf90b38811ac
MATLAB
1,346
40
function [W,U]= GSP_Laplacian(mypath) %% load CC matrix W=load(strcat(mypath,'Data/marmoset_CC_connectivity.mat')); W=W.matrix_fle; % only analysis 55 regions, source (55 regions) * target (55 regions) n_ROI = size(W,2); W=W(1:n_ROI,:); [kden,N,K] = density_dir(W); % % ==================================...
16660a12b1cf37f0aca7f52f2d19b37cf60078e3c5a03ef7942fdc13551db5bb
MATLAB
1,348
32
function vidObj = msExtractdFFTraces(vidObj) %MSEXTRACTDFF Summary of this function goes here % Detailed explanation goes here segmentMask = nan(vidObj.cellAreaLimits(2)*2,vidObj.numSegments); for segNum=1:vidObj.numSegments index = find(vidObj.segments(:,:,segNum)==1); segmentMask(1:length(in...
545edecb7a18a97560464edc0b43f63ac9553f3895844b0b226c0284f6a9649d
MATLAB
1,348
71
function [SynC,ConStr] = XcConnection(HO,Hm,HeI,HeS,Hstd,B,varargin) % [H0,Hm,HeI,HeS,P] = XcConnection(t1,t2,binS,nbBins) % Find Synpatic connectivity based on cross-correlograms % % INPUT: % H0: raw CrossCorr % HeI: lower bound of confidence Interval % HeS: upper bound bound of confidence Interval % ...
ff493c1ecb35417e2880709181556851cff822a66a99798cbc292492e097cf9f
MATLAB
1,348
40
% This file is part of the Matlab Toolbox for Dimensionality Reduction v0.7.2b. % The toolbox can be obtained from http://homepage.tudelft.nl/19j49 % You are free to use, change, or redistribute this code in any way you % want for non-commercial purposes. However, it is appreciated if you % maintain the name of th...
28ed989f70199419a0ae4b6add988f8d37ce8e2e9ab653639ad79d27ce912a08
MATLAB
1,349
56
function [C,rate]=confmat(Y,T) %CONFMAT Compute a confusion matrix. % % Description % [C, RATE] = CONFMAT(Y, T) computes the confusion matrix C and % classification performance RATE for the predictions mat{y} compared % with the targets T. The data is assumed to be in a 1-of-N encoding, % unless there is just one colu...
605c54deb6a143856d5bc10736fb8c936df0fdff31b060b7c5de10ee15737fe5
MATLAB
1,349
41
function uploadMarkLinesImageToLog(slidePath) % This function uploads mark lines overview image to cloud % Written at Mar 11, 2020. %% Input checks if ~exist('slidePath','var') slidePath = [s3SubjectPath('04','LE') 'Slides/Slide03_Section02/']; end slidePath = awsModifyPathForCompetability([slidePath '/']...
23393d46aab8348ae9fadce4dd715e9631be56d0e44f4d8b3751d24b0c869c52
MATLAB
1,350
43
function LL = ME_vMMM_LL(y, r, mu, ka, Ik) % _ % Log-Likelihood Function for a von Mises Mixture Model % FORMAT LL = ME_vMMM_LL(y, r, mu, ka, Ik) % % y - an N x 1 vector of angles (domain: -pi <= y_i <= +pi) % r - a 1 x K vector of mixture frequencies % mu - a 1 x K vector of means % ka - a 1 x K ...
dfaead19394bff74e7126515efa9bd6d06d0a6c611aa1141b22c690d2078e88a
MATLAB
1,351
55
function b=lengthstandard(a,x) % function b=lengthstandard(A,x) % standardizes the length of each vector % input: % A:vector or matrix to be standardized % if A is an matrix, it standardizes each column-vector in the matrix % NaN are taken out of the matrix-coumns and not standardized % x:if x is sca...
15363d78b087c9fc1e312750ada9ba13d1f806aae2e75849a4fccdce7ccb2ded
MATLAB
1,352
70
function [errmsgs warnmsgs] = unit_separate_regressors(varargin) % USAGE :[ERRMSGS WARNMSGS] = TEST_(type) % % This is a script that tests the cross correlation performance metric. % % INPUT ARGUMENTS: % % STDOUT (optional, default = true) If true, prints errors and % warnings to screen as they occur. % % OUTPUT ARGU...
a86f0733c1f216f76d6f1007ba475f03f660a411d0df46056446b2b75f2cf592
MATLAB
1,352
53
REPEATS = 1000; T = 100; L = 2:10; ettaEffectSize = nan(REPEATS,length(L)); omegaEffectSize = nan(REPEATS,length(L)); for j=1:length(L) for ii = 1:REPEATS response = randn(1,T); group = mod(1:T,L(j)); [~,tbl,~,~] = anovan(response(:),{group},'model','full','display'...
5ba3b2e7ed1dc7d895b01c19b98601ccb4f4882a279706cc48acd72a410d604f
MATLAB
1,353
25
function ss_str = selectSimulation(true_field, rep_field) % sets the specified field to true in s_str. All other fields are false. % These match field names in setLoadingFunctionNames and correspond to % specific simulation runs. % initialize ss_str ss_str.run_morrell1field = false; % analyze the envfield_fixe...
0cbb9d2167a3005720777b5fcf3990334b5ee80c0388e729c6fe1dee5bfe2f2d
MATLAB
1,356
46
%% Plots V4 MI noise correlations (raw and MI) in cue epoch at cued and cue-opposite locations for superficial and deep layers %% Code layer_id = 1:2; fig_id = ["e","f"]; layer_labels = {'superficial','deep'}; for layer_flag = layer_id load(sprintf('V4_rsc_MI_%s.mat',layer_labels{layer_flag})) cue_onset...
354a06c97d88440f7de734c9164ae9cb315e86063a410489564816e7eda1ceff
MATLAB
1,356
49
function model = lvl2_estimate(p) % function model = lvl2_estimate(p) % % Performs a SPM second-level analysis. % % Input: % - p: Structure with analysis parameters. % % Output: % - model: Structure with all SPM settings used for this analysis % step (would be 'matlabbatch' in SPM). % % Simon Weber, sweber@b...
73fee0c8270b9b5fa2ffe41ae4a68082c304b9f7b25a647b44b7118aee01aa75
MATLAB
1,356
39
% This file is part of the Matlab Toolbox for Dimensionality Reduction v0.7.2b. % The toolbox can be obtained from http://homepage.tudelft.nl/19j49 % You are free to use, change, or redistribute this code in any way you % want for non-commercial purposes. However, it is appreciated if you % maintain the name of th...
16d9d6976d37171b4a54b28519b3b3eb27225663bbd0aee046cdf6df5cc74a67
MATLAB
1,358
50
ndip = 20; snr = [0.6 0.5]; snr2 = 0.7;%[0.5 0.8]; amp = [0 0.2 0.3 0.4 0.5 0.6 0.7 0.8];%[0.2 0.4 0.6]; phs = 2.*pi.*[0 1/17 2/17 4/17 8/17]; patchsigma = 0; N = [50 150];%100; state = rng(1,'twister'); %state = output.state; list = reshape(1:100,[10 10])'; for i0 = 1:size(list,1) for i1 = 1:numel(ndip) f...
766f787dfdfdef2d34de8907865b88f16340f82ea7a57a4782bec4055a213bf5
MATLAB
1,359
42
%{ Copyright (C) 2023 N. Suhas Jagannathan 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 3 of the License, or (at your option) any later version. This program is distributed i...
94ace2dc44b7ef8dd5f73d8edce0bbcf41767e3ec58ec89d19656a11ceabfb98
MATLAB
1,359
32
function [cfg, X, clabel] = mv_preprocess(cfg, X, clabel) % Applies a preprocessing pipeline to the data (train or test). % % This function is usually called automatically from within the high-level % functions such as mv_classify_across_time. % % Usage: % [cfg, X, clabel] = mv_preprocess(cfg, X, clabel) % %Parameters:...
2c8e6f177ea6e5aa52e884b1bde935a521f0c3c34d84248b9fe5c4056b2625fe
MATLAB
1,361
52
function [returnVar,msg] = Process_InvertDatSign(fbasename,nbChan,varargin) % USAGE: % Process_InvertDatSign(fname) % This function inverts the sign of the recording (e.g. for Neuralynx) % % INPUTS: % fname: dat file name (with or without '.dat' extension) % Copyright (C) 2019 Adrien Peyrache % % ...
00e45ad44f844d8931fd352e014a1e260a9f607667afb1c362bc15f478787a22
MATLAB
1,362
48
function [data, c, prior, sd] = dem2ddat(ndata) %DEM2DDAT Generates two dimensional data for demos. % % Description % The data is drawn from three spherical Gaussian distributions with % priors 0.3, 0.5 and 0.2; centres (2, 3.5), (0, 0) and (0,2); and % standard deviations 0.2, 0.5 and 1.0. DATA = DEM2DDAT(NDATA) % ge...
87987ce4ce7c123694b9cd05d6a7725e294f26d70bd99da1ae29e6f5ccd86c97
MATLAB
1,362
53
clear [task_info,supPath] = loadDBAndSpecifyDataPaths('Vermis'); EPOCH = 'targetMovementOnset'; req_params.grade = 7; req_params.ID = 4000:6000; req_params.remove_question_marks = 1; req_params.num_trials = 50; req_params.remove_repeats = false; req_params.task = 'saccade_8_dir_75and25|pursuit_8_dir_75and25'; req_...
df0e58712a866245a7ada3e31ee12d2998518b7762a36ec51f51548b48907a86
MATLAB
1,362
56
function CalibrateLEDorientation(varargin) % USAGE % CalibrateLEDorientation(angOffset) % % calibrate LED position relative to the expected position blue front / red Rear (to check...) % inputs: % angOffset: offset value (optional) %Parameters checkOldOffset = 0; load('Analysis/BehavEpochs.mat','wakeEp') if...
802308d96517209fa6b01fa4d671bc856585299f438985cd27f63b3f211c0764
MATLAB
1,363
48
% generate small size images % last update: October 25 2022 % Amirhossein Farzmahdi clear close all clc % add path addpath(genpath('functions')) images_dir = 'mat_files/'; category_names = [{'car'};{'boat'};{'face'};{'chair'};{'airplane'};{'tool'};{'animal'};{'fruit'};{'flower'}]; load (images_dir+"names") load(imag...
4242b76260f0ca5c5d12cf7b21bf352cd3b369b3bcb61fca6fed0dc9b472cb0e
MATLAB
1,365
49
function [h, hdata] = hbayes(net, hdata) %HBAYES Evaluate Hessian of Bayesian error function for network. % % Description % H = HBAYES(NET, HDATA) takes a network data structure NET together % the data contribution to the Hessian for a set of inputs and targets. % It returns the regularised Hessian using any zero mean...
b8dd7fed70574de6cdcdf7abcf898865d3dddc9dec4b8996e09c307768664e03
MATLAB
1,368
60
clear [task_info,supPath] = loadDBAndSpecifyDataPaths('Vermis'); EPOCH = 'targetMovementOnset'; req_params = reqParamsEffectSize("pursuit"); lines = findCspkSspkPairs(task_info,req_params); significance = nan(1,length(lines)); for ii = 1:length(lines) cells = findPathsToCells (supPath,task_info,[lines(1,ii...
5e9c3a4bb206a5ad7de0c741b30de6e2840327b24d47da10698aa68392547786
MATLAB
1,369
60
load('data/DataTest.mat') load('data/nnets.mat') computeStatsTest y(y==-1)=0; X_tst=squeeze(blobDataNan(:,:,:)); paramsRelevance=0; X_tst(isnan(X_tst))=0; X_tst=X_tst(:,:,paramsIdx); Y_tst=categorical(y); %% clear acc accMeanT clear xRocV clear yRocV clear aucV clear xRoc yRoc clear YPredV ...
3b6194cc38688100cc4819e0d9baaa3a85b0826d11e1451015705b16a2df62b1
MATLAB
1,370
48
s = size(Lm,2); p = size(Y,1); Ps = sum(Qns,1)/n; Fmatrix = zeros(6,s); tempdig_a = digamma(a); for t = 1:s kt = size(Lm{t},2); temp_alt = Xm{t}.*repmat(Qns(:,t)',kt,1); Xcor_t_Qns_weighted = Xcov{t}*sum(Qns(:,t),1) + Xm{t}*temp_alt'; Fmatrix(2,t) = eps; Fmatrix(3,t) = +.5*n*(kt-1)*Ps(t) ... ...
def63401f76ebf32d805bf51f5bb730d9bb43cb613f00008af95a4abbc7a630e
MATLAB
1,370
45
%function h = PlotTraces(x,t,sr,scale,color,ifnorm, Axes2Fit,plotfun) % x is a matrix of signals to plot: time x nchannels x ntraces % t is time axis, sr - sampling, scale - coefficient to scale up the signals % color - to use, norm - if you want ot normolize them all evenly function h = PlotTraces(x,varargin) x=squee...
3eada19ad4a6a978c3cd0cd1f28e75b924dc73c98be8e2921de58f4f97f02449
MATLAB
1,372
58
function [beta, R, r] = weighted_regression(y,x,w,wflag) % Perform weighted_regression of y onto x using weights w % Outputs: beta=beta weights, R=r-square value, r=residuals % Use as [beta, R, r] = weighted_regression(y,x,w) if nargin<4, wflag = 0; end if ~wflag, %compute output using voxel specific weights [...
6835cab453c41b424e7acc5c5c528141177e47f57010097602d7a8703a36de33
MATLAB
1,372
47
function [phi, phi2] = evaluate_velocity(v, v0, mask, c, densities) % [PHI, PHI2] = EVALUATE_VELOCITY(V, V0, MASK, C, DENSITIES) % % Evaluate velocity estimates, using the average spatiotemporal angular % error. % % V - Estimated velocity field % V0 - Correct velocity field % MASK - Ignore values where mask is zer...
b9b3a747e653a1145bcbafac99371c86d4facb844d9dd663007cceb4f4e911c6
MATLAB
1,373
34
function EnhanceOpticalFlow(exportFolder, enhOptFlowParams, relMat, smoothDiffImage) % Params minR = enhOptFlowParams.minR; maxR = enhOptFlowParams.maxR; enhSig = enhOptFlowParams.enhSig; enhNumSig = enhOptFlowParams.enhNumSig; enhBgSubSig = enhOptFlowParams.enhBgSubSig; rArray = minR:maxR; % Enhance Optical Flow filI...
f72bd3d105a90950d671d886786a4ff4a1435f3d8bc7b36252f4b49fb3bcb760
MATLAB
1,374
47
function [split,numpieces]=explode(string,delimiters) %EXPLODE Splits string into pieces. % EXPLODE(STRING,DELIMITERS) returns a cell array with the pieces % of STRING found between any of the characters in DELIMITERS. % % [SPLIT,NUMPIECES] = EXPLODE(STRING,DELIMITERS) also returns the % number of piec...
4dbbafd81b15a33ff4448f157097e99bde56e234362da0bbc1e7ce7530c0c591
MATLAB
1,376
53
function g = rbfderiv(net, x) %RBFDERIV Evaluate derivatives of RBF network outputs with respect to weights. % % Description % G = RBFDERIV(NET, X) takes a network data structure NET and a matrix % of input vectors X and returns a three-index matrix G whose I, J, K % element contains the derivative of network output K ...
445604813a3358060adb83181407ba123064fa842ef90a548a02d8a0774ace9b
MATLAB
1,377
59
function [scanAbs,Pixel] = yOCTFromDicom (filepath, yI) %This function loads a grayscale version of scanAbs from a Dicom stack file. %Dimensions are (z,x,y) %INPUTS % filpath - filepath of output tif file (stack is z,x and each frame is y) % yI - Optional, which y frames to load if awsIsAWSPath(filepath) %Load...
e5f7c5afb299e9b402eee7f40f61cbf8239f952118c5cb4c50a6dfe318dce21d
MATLAB
1,378
44
req_params.grade = 10; req_params.cell_type = 'CRB|PC|BG|SNR'; req_params.task = 'speed_2_dir_0,50,100|pursuit_8_dir_75and25|saccade_8_dir_75and25'; req_params.remove_question_marks = 0; req_params.ID = 4000:5000; req_params.remove_question_marks = 0; req_params.num_trials = 40; sessions = uniqueRowsCA({task_info.ses...
fe4c8e0e378e14381cb8c0a8da2de8052ec2f320043b0617cf9392014c2f1afa
MATLAB
1,379
45
function [sleep, res, fmt] = detSleep(actigraphy, epoch, varargin) %DETSLEEP do sleep detection % % [SLEEP, RES, FMT] = DETSLEEP(ACTIGRAPHY, EPOCH, STARTTIME, QUALITY, WINDOW, PARAMETER) % performs sleep detection on ACTIGRAPHY of epoch length EPOCH and % return results to the caller. % FM...
966f1f3e2f2ffef4e3be7cea87cb111513cb27aaae18f5199964ff16a2e4267e
MATLAB
1,380
44
clear,clc %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % This script is used to generate figure for the mean map of grey matter volume on % brainnectome 246 atlas across participants % % 7-22-2022 % Jin Liu % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%...
a573f648eadd484f6fd8be9086d06fc2fe2f2b91d9a47c1f8d42627863604d00
MATLAB
1,380
49
function [xf] = generate_decay_target_wave( image_size, dt, T, ... frequency, lambda, sigma, varargin ) % *WAVE* % % GENERATE DECAY TARGET WAVE TEST DATA generates a simple test dataset for % use with the functions in WAVE % % ...
ab5a4e23782a69de756f291d32fde413f7cccb135eafbd89af4b472d11bf1c28
MATLAB
1,381
56
function ic = intervalRate(tsa, is, TimeUnits, varargin) % Returns rates of a TSD in each subset of an interval % % USAGE: % ic = intervalCount(tsa, is, options) % % INPUTS: % tsa - a tsd object % is - an intervalSet % % OUTPUTS: % ic - a tsd object, where the timestamps correspond to each ...
62a33da715b7a52e7fb12d77b0f0a87d630320280d6d8548f5b7d6da5ede110e
MATLAB
1,383
39
% function varargout = get_filenames_spm5(varargin) % % Function to get file names using SPM5. Supports both wildcard and % regular expressions for file names (not for paths). % % INPUT: % file_path (1 x n string) % optional: filenames with wildcards (e.g. *.img or rf*.img), or % f...
933719260d0627fe7598a4a1d75978eb0373bddf1774bc0fcfbfd9e799e42cfc
MATLAB
1,383
39
% function varargout = get_filenames_spm8(varargin) % % Function to get file names using SPM8. Supports both wildcard and % regular expressions for file names (not for paths). % % INPUT: % file_path (1 x n string) % optional: filenames with wildcards (e.g. *.nii or rf*.nii), or % f...
3ff50bc55f69138cc269312654667f4c2a40f0c3c5d176ff67204c38b69e85f4
MATLAB
1,386
31
function decoding_out = correlation_classifier_test(labels_test,data_test,cfg,model) % % History: % 2016-08-09: Removed bug that true_labels were set to be labels_test % rather than unique(labels_test) which is also how correlation_classifier % deals with this if isstruct(data_test), error('This method requ...
983609d2a3da9baac1c9b487dc72e3b7c85da070c477d5ae0b3536e396e7a9bf
MATLAB
1,386
45
function net = netinit(net, prior) %NETINIT Initialise the weights in a network. % % Description % % NET = NETINIT(NET, PRIOR) takes a network data structure NET and sets % the weights and biases by sampling from a Gaussian distribution. If % PRIOR is a scalar, then all of the parameters (weights and biases) % are samp...
ea0c9ce1066208cb563ddc199f2d5da0aec9150b67b2fe2b016a891d9fb50f77
MATLAB
1,387
36
function copy_brain_mask(sub_id, p) % function copy_brain_mask(sub_id, p) % % Copies the 'mask.nii' image (containing a binary mask of brain voxels) % that was created during SPM first-level analysis into a subject-specific % 'rois' folder, so that it can be used in later analysis steps. % % Input: % - sub_id: ID of...
2c9cc58a34b8478b44d15fa463c266f89a48400117a6137e2d9660e0ad0e384d
MATLAB
1,389
58
function [errs warns] = unit_confusion() % [ERRS WARNS] = UNIT_CONFUSION() % % Tests the CONFUSION confusability matrix calculation. errs = {}; warns = {}; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % BASIC TEST [g d] = create_synth_guesses_desireds(); actual = confusion(g,d); % N.B. this DESI...
b85c983e32818ab797065c8ebcc0ccd5839633de6e49232346422c68ce621e05
MATLAB
1,389
39
% function varargout = get_filenames_spm12(varargin) % % Function to get file names using SPM12. Supports both wildcard and % regular expressions for file names (not for paths). % % INPUT: % file_path (1 x n string) % optional: filenames with wildcards (e.g. *.nii or rf*.nii), or % ...
2fe31a55adeb8e619141d2a879e8c6e89c2effb8f937ac93a1c05b3189ecb15c
MATLAB
1,390
37
function SubtractBackground(exportFolder, bgSubParams, origImage) % Params bgSubSig = bgSubParams.bgSubSig; bgSubOneSidedNumSig = bgSubParams.bgSubOneSidedNumSig; bgSubPadSize = bgSubParams.bgSubPadSize; bgSubMeanFac = bgSubParams.bgSubMeanFac; % Pad Image bgSubImage = padarray(origImage, bgSubPadSize, bgSubMeanFac*me...
956644df930f58d23326b04921325211c536edfe3a6601b77b0b9293bfd70ace
MATLAB
1,391
49
function result = mv_select_result(result, metric) % For a result(s) with multiple metrics, selects a metric. % %Usage: % result = mv_select_result(results, metric) % %Parameters: % result - result struct or cell array of result structs % metric - desired metric. All other metrics are removed. % %...
caecc20086fb7646b09a595555666f111d8fdebba7434abb96b35f2d1fe03e9e
MATLAB
1,391
52
function [acts scratch] = test_lda(testpats,testtargs,scratch) % Testing function of LDA, normally you don't need training and testing % functions for LDA, but to keep cross_validation.m most flexible % both functions exist % % function [acts scratch] = test_lda(testpats,testtargs,scratch) % % This is the testing fu...
0e9992db7f06d4ccf2006fad8ddc0b7f3febe4fd8c98c759c16bdbf84a196f57
MATLAB
1,392
52
clear all nInst = 250; nVars = 10; X = randn(nInst,nVars); w = randn(nVars,1); y = sign(X*w + randn(nInst,1)); wTest = randn(nVars,1); fprintf('Testing gradient using forward-differencing...\n'); order = 1; derivativeCheck(@LogisticLoss,wTest,order,1,X,y); fprintf('Testing gradient using central-differencing...\n')...
679919a3a7292b3ae370aef095d10ea13954f3219827a0377b0f2ed32ecfd4ab
MATLAB
1,392
65
function [X,Y,GoodRanges,wstruct] = LoadPos(fbasename) % loads position and speed from a position file file (ending in .whl) % % USAGE % [X,Y,V,GoodRanges,wstruct] = HeadDirectionWhl(fbasename) % % INPUT: % fbasename: session file basename % % OUTPUT: % X: a tsd object of x position values % Y: ...
8e3301c17603ad419b3169a9bcf68fe8fa03d77eda6100e2375c6aa4f3853e5d
MATLAB
1,392
49
function [dt] = datetime(seconds) % Spits out the date and time in yymmdd_HHMM format % % [dt] = datetime([seconds]) % % The advantage of this is that alphabetic order is also % chronological). % % If SECONDS = true, adds _SS at the end (defaults to false). % % UPDATE: it looks like there's a bug in DATESTR, so we're ...
96693250cdbc69483295f63b169e1e30a8b99a95c30e54d32d8df94793c15507
MATLAB
1,393
36
function [feat thresh conf] = decisionStump(wl,trainpats,weight); % [FEAT THRESH CONF] = DECISIONSTUMP(WL,TRAINPATS,WEIGHT); % % Implements weak learner in the form of a decision stump as computed by % AdaBoost.MH. % % This is part of the Princeton MVPA toolbox, released under the % GPL. See http://www.csbmb.p...
146b35cdb27b12cd600dbe07956e509c99082bf751be2c66618e9cfa141997e6
MATLAB
1,394
50
function Dist = MaxDistCP(Qto,Qfrom,BB,MaxDist) Dist=ones(1,size(Qfrom,2))*MaxDist; Range=floor((BB(2,:)-BB(1,:))/MaxDist); tic Done=0; LookAt=zeros(1,size(Qfrom,2)); for x=0:Range(1), for y=0:Range(2), for z=0:Range(3), Low=BB(1,:)+[x y z]*MaxDist; High=Low+MaxDist; ...
3990c5c19b7bc87f9117abad7c79b98f55229ecb91088fe5018a281668732941
MATLAB
1,394
56
function L = length(O, TimeUnits, varargin) % Returns the length of each interval in the set % % USAGE: % L = length(O, TimeUnits) % % INPUTS: % O: an intervalSet object % TimeUnits: a units object or the abbreviation string % % OUTPUT: % L - a tsd object , where the timestamps correspond to ea...
6334eafeee3dd79d41d99d364f12f2902a0153ece225f5656438149165b49405
MATLAB
1,395
45
function [acts scratchpad] = test_template(testpats,testtargs,scratchpad) % Template testing function % % [ACTS SCRATCHPAD] = TEST_TEMPLATE(TESTPATS,TESTTARGS,SCRATCHPAD) % % This is the template testing function to use when creating your % own classifier testing function. Gets called after TRAIN_TEMPLATE % % See also...
fdb7e8f3cd24c6cc195607a8c7c31d05d2acee0ac16deaabebb4ca8e40d7112b
MATLAB
1,395
39
% function varargout = get_filenames_spm12b(varargin) % % Function to get file names using SPM12b. Supports both wildcard and % regular expressions for file names (not for paths). % % INPUT: % file_path (1 x n string) % optional: filenames with wildcards (e.g. *.nii or rf*.nii), or % ...
36968f2304a26e003c2e4e4e0e6ed3f5da5593390ab667e3fc3d478d957702b7
MATLAB
1,397
60
function tsi = interp_missing(tsa, TimeUnits, varargin) % Interpolate missing values in continuously sampled tsd % % USAGE: % tsi = interp_missing(tsa, OptionName, OptionValue, ...) % % INPUTS: % tsa - a tsd object % % OUTPUTS: % tsi - a tsd object, with the missing values interpolated, assuming ...