sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
11ed33c7d0c69fe9fe2aaf6a178f7ef80be6eec5152060a745ae9defb45bc010
MATLAB
1,398
47
load('DataTrain.mat') computeStatsTrain meanParamsP=squeeze(nanmean(blobDataNan(y>0,:,:),1)); stdParamsP=squeeze(nanstd(blobDataNan(y>0,:,:),1)); meanParamsN=squeeze(nanmean(blobDataNan(y<=0,:,:),1)); stdParamsN=squeeze(nanstd(blobDataNan(y<=0,:,:),1)); cLP=meanParamsP-2*stdParamsP; cHP=meanParamsP+2*stdPa...
c46c9db69b61ff9e359d99868da46be955ed77c770d9354661820b2b2abfbf13
MATLAB
1,398
50
function rc = psychlasterror(varargin) % psychlasterror - Replacement for Matlab-7 'lasterror'. % This is hopefully useful for older Matlab installations and % for the Octave port: % % If the 'lasterror' variable, M-File or builtin function % is supported on your Matlab installation, this function % will return it. % %...
4014ee3299f1d310cf63b300e4c6c08f43ba61e10dd6c0217eae4eb9b4aaeba8
MATLAB
1,401
72
function p = peaks(tsa, varargin) % Get peaks in data % % USAGE: % p = peaks(tsa, OptionName, OptionValue, ...) % % INPUTS: % tsa - a tsd object % % OUTPUTS: % p - a tsd containing the peaks of tsa % % OPTIONS: % 'Extremes' - the kind of peaks: % 'MaxMin' - both max and mins are ret...
d08eb943bee650a4514da9370d0ced898857d477ac51ded73d055d58060f0383
MATLAB
1,402
59
%% does adding an effect for movement reduce the omega for other variables? clear all T = 10; N_TRIAL = 80; %average per condition effect_size = [0:20]; var_vals = 40; N_CELL = 80; t_response = [3:5]; match_d = []; for d=1:8 match_d = [match_d; d*ones(N_TRIAL/8,1)]; end match_p = [ones(N_TRIAL/2,1);2*ones(N_TRI...
04b76a4bc51ec557f01c8fd8e7e46b2368e824fe9ead43f5e020d5527d5d6842
MATLAB
1,403
51
%% Plots V4 noise correlations (raw and MI) in cue epoch at cued and cue-opposite locations %% Code load('V4_rsc_MI.mat') cue_onset_win = [500 2500]; epoch = num2str(cue_onset_win(1))+"_to_"+num2str(cue_onset_win(2)); plot_flag = 1; % to plot or not to plot for bin_flag = 12 % > 5 spikes/s geometric mean t...
631bf789f006582accbdddbfaa856c216d2efd6217b5d562957f0eec1ce6fd3c
MATLAB
1,403
40
function refreshDiary(this, actigraphy) % REFRESHDIARY Update diary elements from ACTIGRAPHY % % $Author: Peng Li % $Date: Feb 29, 2026 % ax = actigraphy.actiAxis; ptH = actigraphy.Decoration.YAdjust; yrange = actigraphy.Decoration.YLim; delete(findobj(ax, 'Tag', 'DiaryPatch')); delete(findobj(ax, '...
944533da07ebbb8979d13d8613cc4a44f43691d278d627fa5b9ebb1380c43e6d
MATLAB
1,403
55
%% Plotting L2 Norm results load('L2_norm_RFTrials.mat') theta_actual.G = best_thet_est.G{1}{1}(1,:); theta_actual.B = best_thet_est.B{1}{1}(1,:); for iLambda = 2:11 mb_sse.G(iLambda-1,:) = sum((theta_actual.G(end-15:end) - best_thet_est.G{iLambda}{1}(1,end-15:end)).^2); mb_sse.B(iLambda-...
0e5651b887962cd95cd7b264d671dcdbb4321e13d40897d242b76c3a8d0bfd81
MATLAB
1,404
36
% This script validates caner healthy vs non healthy is in agreement with % cancer name libraryNames = {'LC','LD','LE','LF','LG','LH'}; st = loadStatusReportByLibrary(libraryNames); LxC = cellfun(@(x)(contains(x,'LGC') | contains(x,'LHC')),st.subjectNames); IsHealthVsLxCConflict = (st.isSampleHealthy == LxC)...
5ed9d9f71543023a7f5ced646ea2e640b6e00f82e999c9a2dfac96c0542a052e
MATLAB
1,404
45
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % This script is used to generate figure for the mean map of gray matter % volume on brainnectome 246 atlas across participants % % 7-22-2022 % Jin Liu % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear,clc ...
7938a98853a40dca20d9507432cacdaf2f6f63ca7c5b0e0853f3fa90a0dae6de
MATLAB
1,404
43
function net = gpinit(net, tr_in, tr_targets, prior) %GPINIT Initialise Gaussian Process model. % % Description % NET = GPINIT(NET, TRIN, TRTARGETS) takes a Gaussian Process data % structure NET together with a matrix TRIN of training input vectors % and a matrix TRTARGETS of training target vectors, and stores them...
e84477a93d4221c1c2a464fb68064fd4fd58166cb0d7c1dc088dcfd09b4dd4f0
MATLAB
1,404
73
function p = peaks(tsa, varargin) % Get peaks in data % % USAGE: % p = peaks(tsa, OptionName, OptionValue, ...) % % INPUTS: % tsa - a tsd object % % OUTPUTS: % p - a tsd containing the peaks of tsa % % OPTIONS: % 'Extremes' - the kind of peaks: % 'MaxMin' - both max and mins are ret...
bf48b4c2bf83b434320f4ba475558de051584d8aacd513b22561c1e9acf2a721
MATLAB
1,405
55
%% Behavior figure MaestroPath = 'C:\Users\Owner\Desktop\DATA\albert\'; supPath = 'C:\noga\TD complex spike analysis\Data\albert\speed_2_dir_0,50,100'; load ('C:\noga\TD complex spike analysis\task_info'); req_params.grade = 10; req_params.cell_type = 'CRB|PC'; req_params.task = 'speed_2_dir_0,50,100'; req_params.ID ...
cdcec19fc675a48dd23a18f8ab30efc677b4b346bffb428ecfa7dcf9a260ea14
MATLAB
1,405
50
% 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...
8b5c8139d7a99cf1bbe08a0e2f3e8eb950ea9acc235b910634737c757fa3a8ac
MATLAB
1,406
32
function data_epo = data_eeglab2epo(data_eeglab, event_eeglab,classname) % EPO struct % .fs sampling rate [samples per second] % .x multichannel signals (DOUBLE [T #channels #epochs]) where T is the number of samples within one epoch % .clab channel labels (CELL {1 #channels}) % .y c...
a8678d9330f903464fc0c9934d7ae8ddcb7493221421679dc64ed5f0d6f67aad
MATLAB
1,406
66
function b = isequal_prec(x1,x2,n) % Usage: % % b = isequal_prec(x1,x2,n) % b = isequal_prec(x1,x2) % % Description: % % Compare two numbers for equality based on the nth decimal place. % If the 3rd argument is not supplied then x1 and x2 have to be preceisely % equal for the function to return true...
c8b42e264f278eb0db0b60611fd91fcfaf74feb615c7f80e3f3f6593f549f67a
MATLAB
1,407
58
function [ blockmem ] = random_blocks(Y, M) % Creates a vector of 1:N split into M random blocks. % License: %===================================================================== % % This is part of the Princeton MVPA toolbox, released under % the GPL. See http://www.csbmb.princeton.edu/mvpa for more % information. %...
67f920f816350d38ea27d3702f7947e19954f912f790b571fef55add94114e9a
MATLAB
1,408
45
function [cc,pv,center_point] = phase_correlation_rotation( pl, cl, center_point, varargin ) % *WAVE* % % PHASE CORRELATION ROTATION correlation of phase with rotation angle % theta (circular-circular), given the curl % of the phase gradient vector ...
f428dd1df490701356a07e81ca2dfaa3708714ca1dab85a4e4d531d88003f235
MATLAB
1,410
36
#import <UnityAds/UnityMonetization.h> #import "UnityJsonAdditions.h" const void* UnityMonetizationCreateNativePromoAdapter(const void* pPlacementContent) { if (pPlacementContent) { UMONPromoAdPlacementContent* placementContent = (__bridge UMONPromoAdPlacementContent*)pPlacementContent; UMONNativeP...
6d82043b200bf09ed3a0fe21438d36d63c8a123746ad58f0fd4318812b3ecd7e
MATLAB
1,411
55
function [fh,dArea] = PETH(S,center,TStart,TEnd, varargin) % USAGE % % H = PETH(S,center,TStart,TEnd, 'BinSize',binsize) % S : ts % center : ts of reference times % TSart/TEnd : bounds of PETH % optional: % 'BinSize' : size of bins in 10^-4s % Adrien Peyrache 2007 font_name = 'Arial'; font_siz...
e77e823cc2786e22d80e48c6232231e4f4d6d0ac8d3ea7051f14a04d9c0f2ea3
MATLAB
1,415
52
function ep = LoadEpoch(fbasename,epname) %ep = LoadEpoch(fbasename,epname) %Adrien Peyrache, 2012 Fs = 1250; %try if exist([fbasename '-states.mat'],'file'); load([fbasename '-states.mat']) states = states(:); t = [0:length(states)-1]'; switch lower(epname) case 'sw...
d4d7884f4f8fcb0b59dff8a5dc347a8118d274626abfb890532223d7288924a8
MATLAB
1,416
33
function varargout = neighborhoodloop(varargin) % NEIGHBORHOODLOOP Implicit loop over neighborhoods. % % Example: % Let f be a matrix. Then % h = neighborhoodloop(2, [3 5], f, ones(size(f)), @(f,c) median(f(c>0))); % implements a median filter with 3x5 kernel and proper median computations % near the borders. % % This ...
27a86438cbfcd145c59a2ad6c93c762387ada4ad81e8a655cf16a4335fee3c15
MATLAB
1,417
46
function awsSaveMatlabFigure(figureHandle, pathToSave, isMaximizeBeforeSave, isCloseFigureAfterSaving) % This function saves a matlab figure handle as png to the cloud / local % drive. % INPUTS: % - figureHandle - use gcf for current matlab figure handle. % - pathToSave - s3 or local path to save figure to. %...
678719a294813da9a3e36a0074155b72920e5a3187c71804dee751cab17a4f26
MATLAB
1,417
38
function y=fProcess1(targetdata,targetpath,savepath,calendar) realtargetpath = targetpath; realtargetdata = targetdata; calendartoday=calendar; realsavepath = savepath; for cnt = 1:length(realtargetdata) cd(realsavepath); data0 = realtargetdata(cnt).name; load([data0 '_prepare_save.mat']); cale...
d1b5af39bf85035b256a92801d7801edaa144f0b631d93823493b0de7b06262e
MATLAB
1,417
33
function [] = runBreak(taskStruct, dispStruct) % instruction # Screen('TextSize', dispStruct.wPtr, 40); Screen('TextColor', dispStruct.wPtr, dispStruct.textColor); DrawFormattedText(dispStruct.wPtr, '- Summary -', 'center', 50); text1 = ['So far you''ve played ' num2str(taskStruct.trialTotal) ...
14cf23281afd15e2f51814498336d4a9d2ed054caa5859ec45230fd789581c13
MATLAB
1,418
43
function smp_map_data = bv_createsmpmap(vmp,reco_srf) % function smp_map_data = bv_createsmpmap(vmp,reco_srf) % % Given a vmp (stats in the volume) and a reconstructed surface, create an % smp stat map by sampling the stat volume at the vertices. % % History: % % 2004.03.10 bds wrote it % 2004.06.10 ...
81dd68eaaa18cf3fca6d76883e0dd8b6e159e185a8c1b259421c33a378c7448f
MATLAB
1,419
32
function L = crossCorrModel_Intensity(preTrain,postTrain,preTest,postTest,binT,params) % Computes the cross-validated log-likelihood of a spike train given a (predictor) spike train in a % gaussian temporal window of a given s.d. and mean. % % USAGE % % L = crossCorrModel_Likelihood(preTrain,postTrain,preTest,pos...
90415458227c8fd78aba1f75dbd51a809bef6762545ca75c1e79bc5b99c10e4c
MATLAB
1,420
35
function [maskSeries, maskWindow, maskLength] = doMask2(dataLength, epochInSec, dataStartTime, maskStartTimestr, maskEndTimestr) %DOMASK2 generate masking series based on start and end time % % $Author: Peng Li % $Date: Jan 09, 2020 % $Modif.: Dec 02, 2020 % relocation % May 17, 2021 % ...
4642f915cc1ad202af9bd8e7955f015bdba95d3c4984224e5b92ef5b4748d31c
MATLAB
1,421
73
function [errmsgs warnmsgs] = test_smooth_predictions(varargin) % USAGE :[ERRMSGS WARNMSGS] = TEST_(type) % % This is a script that tests temporal smoothing using the % prediction function. It mostly tests the parameter handling of % the function. % % INPUT ARGUMENTS: % % STDOUT (optional, default = true) If true, p...
811bcb10552d1becdc4003ffe046425b61cd8f5790ae393b8dc28699ad5be899
MATLAB
1,421
51
function [e, edata, eprior] = gperr(net, x, t) %GPERR Evaluate error function for Gaussian Process. % % Description % E = GPERR(NET, X, T) takes a Gaussian Process data structure NET % together with a matrix X of input vectors and a matrix T of target % vectors, and evaluates the error function E. Each row of X % corr...
b326c38d20f3d0d412eced46e081f21210a63bdc933d6784d178f22dfc2d9b3e
MATLAB
1,422
63
function data = Product(transformer, data) % % Computes the row-wise product of two or more columns. % % % Arguments: % % :param Input: **mandatory**. Names of two or more columns to compute the product of. % :type Input: array % % :param Output: **mandatory**. Name of the newly generated column. ...
0756d610c583d31955ad2ff469fa1a0addcde1f16e43b1d2e26b5ab8333b3022
MATLAB
1,423
50
function [xf] = generate_plane_wave( image_size, dt, T, ... frequency, lambda, orientation, varargin ) % *WAVE* % % GENERATE PLANE WAVE TEST DATA generates a simple test dataset for % use with the functions in WAVE % % dat...
f4ba8cef8cc89d093b17431c34179b2a222c8c174144e28826c5ddcfdaf8ccf6
MATLAB
1,426
52
function [d] = cross_entropy_deriv(code, e, x, perf, pp) % Derivative of cross-entropy % % [D] = CROSS_ENTROPY_DERIV(CODE, E, X, PERF, PP) % % See CROSS_ENTROPY.M % This is part of the Princeton MVPA toolbox, released under the % GPL. See http://www.csbmb.princeton.edu/mvpa for more % information. % License: %======...
448e41a9fb16b821aef89a03df0786047eee0f4c8a59509e59efbfee64c7eb01
MATLAB
1,427
40
% Y = spharm_fast(theta,phi,l,m,p0) % % Orthonormal spherical harmonic function (Arfken, p. 681) for quantum % numbers l and m. Angles theta and phi should be given in radians. % p0 contains the values of the Legendre polynomial % function Y = spharm_fast(theta,phi,l,m,p0) % Copyright (c) 2016, Elekta Oy % -----------...
968825f8a02fd460006442baa26a8df3defe2897cc869ef5f2301514008ed555
MATLAB
1,428
49
function [] = check_1ofn_regressors_subj(subj,regsname,xval_selname) % [] = CHECK_1OFN_REGRESSORS_SUBJ(SUBJ,REGSNAME,XVAL_SELNAME) % % wrapper for check_1ofn_regressors that also takes in a % group of xvalid selector indices, to confirm that your % regressors won't elicit 1-of-n warnings % License: %=================...
d6c08ea11be2ba1d99af6c70023f2274b473f4225582ab12427211a6669f91c4
MATLAB
1,428
58
function [] = mvpa_add_paths() % Adds the paths necessary to use the MVPA Toolbox. Assumes % that you've already got this script in your path, and so % it uses the location of this script to determine the root % directory of the rest of the MVPA scripts. That way, it % doesn't need an argument. % % Usage: MVPA_ADD_PAT...
253559a11f8f68d6b445d7e1e7a1daa7e86fa74b88184a7df973ae6a5cd366d1
MATLAB
1,429
43
function [LL, LF] = bhvr_LL(y, z, r, mu, ka, Ik) % _ % Log-Likelihood Function for a von Mises Mixture Model % FORMAT LL = ME_vMMM_LL(y, z, r, mu, ka, Ik) % % y - an N x 1 vector of response errors (domain: -pi <= y_i <= +pi) % z - an N x 1 vector of swap errors (domain: -pi <= y_i <= +pi) % r - a 1 x ...
6627749dd3b980f8bad7cbbd83eab11843eb474c15f79461e1c4ab311bba205a
MATLAB
1,430
40
function string=implode(pieces,delimiter) %IMPLODE Joins strings with delimiter in between. % IMPLODE(PIECES,DELIMITER) returns a string containing all the % strings in PIECES joined with the DELIMITER string in between. % % Input arguments: % PIECES - the pieces of string to join (cell array), each...
cec36de270b11420a92f84197dc1f41ecd083786397d2fbd4e60ae073ba63572
MATLAB
1,430
49
function msRastorPlot(vidObj,segmentRange,offset,showFiring, color) %MSRASTORPLOT Summary of this function goes here % Detailed explanation goes here if (isempty(color)) index = [1 4 7 10 3 6 9 2 5 8]; cmap = colormap(jet(256)); numColors = 10; colors = 0.8*cmap(ceil(2...
5d3c85f3cea466e5a3b99457896c6e8724cb903b14134a0daa79e3213a5ccc3e
MATLAB
1,432
47
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Authors : Farad KHOYRATEE, Romain BEAUBOIS % Create Date : 04 Mar 2018 % Update Date : 10 Aug 2021 % % Description : % % Revision : % > Revision 0.01 - File created % > Revision 0.02 - Integrate sum in function % % Addit...
e1de9bca618824d99ca699ee22cabb80400254378c3b8bdc3478305250854055
MATLAB
1,432
76
function [biasmean1, biasstd1, bias_rp1] = CrossCorrBootstrap2(Sdata, S, E) nbins = 10; binsize = 10; n_cells = length(Sdata); bias = ones(n_cells,n_cells, 50) * NaN; bias_rp = ones(n_cells,n_cells) * NaN; for l = 1:50 [SM, EM] = NonRippleTimes(Data(S), Data(E)); for i = 1:n_cells Sdatam{i} = Restrict(Sdat...
8911b403718db7c280f9ef40ac7ef4d6bf368b1771f3df3d581efc041f23a832
MATLAB
1,433
33
function [] = runPause(taskStruct, dispStruct) % instruction # Screen('TextSize', dispStruct.wPtr, 40); Screen('TextColor', dispStruct.wPtr, dispStruct.textColor); DrawFormattedText(dispStruct.wPtr, '- Pause -', 'center', 50); text1 = ['So far you''ve played ' num2str(taskStruct.trialTotal) ' ...
68a262e8815a284f2d2ce16baa15d72607b4c66a42103ffae8bb75a97b952917
MATLAB
1,434
47
function [coefficients levels] = db4dwt(X, N) % Imitates the wavedec function in wavelet toolbox. % % [coefficients levels] = db4dwt(X, N) % % This is hard coded with values of the 'db4' wavelet taken from % online resources. % License: %===================================================================== % % This is...
cd1a94c9b2e42b8a1975d1be8dc80134b2daab14d47c868b3c508c63e490b3cd
MATLAB
1,434
52
function [res, fmt] = detAlpha(actigraphy, epoch, varargin) %DETALPHA do detrended fluctuation analysis and fit results % % [RES, FMT] = DETALPHA(ACTIGRAPHY, EPOCH, REGION, FILENAME, STARTTIME, FILEPATH, QUALITY) % performs detrended fluctuation analysis on ACTIGRAPHY of epoch % length EPOCH seco...
b05cd0136ecb1e4308abc66f299aa32d79b2b1073c430925f271cd3cb06eaf06
MATLAB
1,435
33
function [coeffs] = CalculateT1Map(T1raw_reordered_reshaped,tvalues,ivalues) %UNTITLED Summary of this function goes here % Detailed explanation goes here opts = optimoptions(@lsqcurvefit,'Algorithm','levenberg-marquardt'); tmax = max(tvalues); if isnan(ivalues(1)) fun = @(coeffs,tva...
42aad3bd933c436e6d7d8df5480aa80692cc913638609d9c845481baad5a27b8
MATLAB
1,438
39
function varargout = read_header(software,filename,varargin) % function varargout = read_header(software,filename,varargin) % IN % software: String with software to read header in cfg.software (e.g. 'SPM8') % filename: name of volume (full path , 1 x n string) % varargin: Any additional things that s...
42dac05c0aac7fe79a5a4a5a5c9a4be159aef2e132b891828e5b6422893f44e3
MATLAB
1,438
49
% plot average of coefficients across all subjects for each channel % divide subplot into different conditions sbjList = {'12','13','14','15','16','17'}; figSaveDir = ['C:\Users\mn0mn\Documents\ResearchProjects\spatailAttentionProject\ProcessedDatafNIRS\GroupResultAll\Figures']; % hardcoded ssBetaTotal = zeros(49,3...
492dedda217bb277e451b37a5a80542e24b6d8f90c37ff41ac2ad0c0f147856b
MATLAB
1,438
70
function [c] = cellcov(x, y, dim, flag) % CELLCOV computes the covariance, across all cells in x along % the dimension dim. When there are three inputs, covariance is computed between % all cells in x and y % % X (and Y) should be linear cell-array(s) of matrices for which the size in at % least one of the dimensio...
aa59da968d0418ee94a4682aabf453f89cac91f97b9127ebd0c2f80384c13be5
MATLAB
1,439
53
function [pm_no] = get_perfmet_called(results,desired_name) % [PM_NO] = GET_PERFMET_CALLED(RESULTS,DESIRED_NAME) % % If you have only one perfmet, this will return % 1. DESIRED_NAME must be empty or the name of the single % perfmet. % % If you have multiple perfmets, this will return the index % of the one that matche...
1126c16a5a8bd7abaca20b8dc60db0e5a86b58cd323a6684edbaadf02e12c6e8
MATLAB
1,440
69
function [cleanAng,epCleaned] = CleanWhl_Ang(ang,ep) st = Start(ep,'s'); en = End(ep,'s'); daSt = Data(Restrict(ang,st)); daEn = Data(Restrict(ang,en)); dt = median(diff(Range(ang))); addTime = []; addAng = []; epCleaned = ep; for ii = 1 : length(st) -1; if st(ii+1) - en(ii)<5 da1 = daEn(i...
21e71c4479ea70f1fe6ab63ed805865e9f8ad931423ac09d367de59989b0fb3b
MATLAB
1,440
40
% This function computes the second term of Eq. (6), which is an estimate of how eye movements and stimulus dynamics redistribute power in space-time. % % It relies on two fundamental assumptions which must be always taken into account, and must be used with caution: % 1) eye movements do not depend on the ext...
d0f9ea81b4816aa543c2ed6c58b2ba70744886ba8cb13eddfc3371796582c297
MATLAB
1,441
54
function [xf] = generate_rotating_wave( image_size, dt, T, frequency, direction, varargin ) % *WAVE* % % GENERATE ROTATING WAVE TEST DATA generates a simple test dataset for % use with the functions in WAVE % % data description: a 2d rotating wave % % INPUT ...
1534554fc964d8e22cbba522af1edb487c46ad05409d3799e260c0716d70e202
MATLAB
1,443
47
function trialStruct = buildTrialStruct(cards) trialStruct = struct(); trialStruct.cards = cards; trialStruct.isHigher = trialStruct.cards(1) < trialStruct.cards(2); % choice left/right trialStruct.guessL = NaN; trialStruct.guessR = NaN; % actual choice trialStruct.respKey_Guess = NaN; ...
6a9c5f232135692d8d2ae1a1377a60e8e579506b86337d1cd98676deebe6b20c
MATLAB
1,445
38
function FigureA_NoParams(fileExportFolder, imageA, vxMat, vyMat, relMat, thetaInDegrees, thetaInRadians) h = figure; dispImage = mean(double(imageA), 3); dispImage = RenormalizeImage(dispImage, .1); dispImage(dispImage(:) == 0) = mean(dispImage(dispImage(:) ~= 0)); imagesc(dispImage); axis equal; disp(' '); numMasks =...
f42f7a89fc12048d629df1043c561b426e1a339923a5601ebac92fc409c915e8
MATLAB
1,445
35
function model = distance_train(labels_train,data_train,cfg) % This function averages samples within the same class. It then passes the % data for calculations of distance estimate carried out in similarity_test. % TODO: place calculations in separate function even though they are % simple. switch lower(cfg....
0a84dbfb19aea19a268071bc8e58a6d68befb13b6bb7b1deecb2c7aea3080b33
MATLAB
1,446
43
function stdshade_egNeurons(amatrix_all, amatrix_jk, alpha,acolor,F,smth,r) % usage: stdshading(amatrix,alpha,acolor,F,smth) % plot mean and sem/std coming from a matrix of data, at which each row is an % observation. sem/std is shown as shading. % - acolor defines the used color (default is red) % - F assignes the us...
12282d9780edd26cfc846671dc5cccdb2d560a98fde2971e3086e2c48fffd07b
MATLAB
1,446
50
function dispv(rule,str,varargin) % function dispv(rule,str,varargin) % % Run fprintf with first the argument 'verbose argument level'. % Input arguments: % rule: minimal level of the current argument at which is printed % (i.e. print only when this level or higher) % level: verbosity (0:...
1761e751a21211d594846660793fb7bd4fbcba34e1aad2633d44b0fe87a79822
MATLAB
1,447
53
function [acts scratchpad] = test_ridge(testpats,testtargs,scratchpad) % Generates predictions using a trained ridge regression model % % [ACTS SCRATCHPAD] = TEST_RIDGE(TESTPATS,TESTTARGS,SCRATCHPAD) % % License: %===================================================================== % % This is part of the Princeton M...
791f5ed18e2226dd8e88f297b77aa17b42afc329d7e82530f4a3b160c3b1409e
MATLAB
1,447
43
function [segmentlists_time,segmentlists]=build_links(links) links{end+1}=NaN; segmentlists=[]; segmentlists_time=[]; origin_id=1; for i=2:numel(links) origin_id=1; traces_id=numel(segmentlists)+1; while ~isempty(links{i}) && sum(~isnan(links{i}(:,1)))~=0 origin=links{i...
759793488b424bf09535e5abdae79389d4af355e48d4b80039dd3a48a252feb4
MATLAB
1,448
32
function [fx] = f_kToM(x,P,u,inF) % wrapper around recursive k-ToM evolution function % function [fx] = f_kToM(x,P,u,inF) % A k-ToM agent with k>0 learns the unknown parameters (theta) of her % opponent's learning and decision rules. Typically, theta includes her % opponent's prior volatility about herself (which contr...
dd76570ef04c64e072f65ac520a4e761dcd17a8fbb80e0a05af929c18c005d67
MATLAB
1,448
58
%% Plotting L2 Norm results load('data/L2_norm_RFTrials.mat') theta_actual.G = best_thet_est.G{1}{1}(1,:); theta_actual.B = best_thet_est.B{1}{1}(1,:); for iLambda = 2:11 mb_sse.G(iLambda-1,:) = sum((theta_actual.G(end-15:end) - best_thet_est.G{iLambda}{1}(1,end-15:end)).^2); mb_sse.B(iLa...
33fc577f2a58cbbbd8027971e4c6da298a4b552d2e384c55f970d3249fc97014
MATLAB
1,449
42
% function [sigma,shrinkage] = covshrink_lw(data) % % Function to calculate shrinkage according to Ledoit & Wolf (2004). See % http://www.econ.uzh.ch/faculty/wolf/publications/wellCond.pdf % % Maximal shrinkage is done towards the mean variance. % % INPUT: % data (n_samples x p_dimensions) % OUTPUT: % si...
45ae0a047a05d791feb00a9f87126221cfa4359198828a185feabb2ad3a8a5a8
MATLAB
1,449
37
function [gx] = g_VBvolatile0(x,P,u,in) % computes the probability of the learner choosing 'a=1'. % [gx] = g_VBvolatile0(x,P,u,in) % This function derives the action emission law from the current belief of % the learner. It is valid in an empirical context akin to a multiarmed % bandit problem, whereby the learner is a...
22b90a429173133fb6ee52d2632ee78369790aa019d6ae7b05133de49d940cdd
MATLAB
1,452
36
function ms = msMeanFrame(ms, downsample) %MSMEANFRAME Summary of this function goes here % Detailed explanation goes here meanFrame = cell(size(ms.alignmentROI,2),1); minFrame = cell(size(ms.alignmentROI,2),1); for ROINum=1:size(ms.alignmentROI,2) meanFrame{ROINum} = zeros(ms.alignedHeight(...
9e78ea8b32ea6dbe924d37cc6289ad051b7aca19591bf1a91501741b455c705b
MATLAB
1,453
45
function Schaefervolumecombined = importfile(filename, dataLines) %IMPORTFILE Import data from a text file % SCHAEFERVOLUMECOMBINED = IMPORTFILE(FILENAME) reads data from text % file FILENAME for the default selection. Returns the data as a table. % % SCHAEFERVOLUMECOMBINED = IMPORTFILE(FILE, DATALINES) reads data ...
097879f2da74cadce4f198526b247e1d783e92c3094c8be33e9d44a0202ddee9
MATLAB
1,454
51
% kernel unit test % % compute kernel matrix tol = 10e-10; % Random data N = 30; F = 10; X = randn(N, F); cfg = []; cfg.kernel = 'rbf'; cfg.gamma = 1; cfg.regularize_kernel = 1; %% regularize_kernel should just be adding a diagonal cfg.regularize_kernel = 0; K = compute_kernel_matrix(c...
9a4db8a4d3627c8261f90c8388ad58c448b1a8196bbfb04b999ec19fd8933230
MATLAB
1,454
69
function [Y] = LaplacianScore(X, W) % Usage: % [Y] = LaplacianScore(X, W) % % X: Rows of vectors of data points % W: The affinity matrix. % Y: Vector of (1-LaplacianScore) for each feature. % The features with larger y are more important. % % Examples: % % fea = rand(50,70); % options = []; % ...
cc11d72b14fc19cf0978e3806db0414968d09bc26c9608d40b6eddd5b7afc6b1
MATLAB
1,454
54
function [A, b] = prepare_displacement_matrices(A1, b1, A2, b2, displacement) % [A, b] = PREPARE_DISPLACEMENT_MATRICES(A1, b1, A2, b2, displacement) % % Compute matrices used for displacement estimation as defined by equations % (7.32) and (7.33) in Gunnar Farnebäck's thesis "Polynomial Expansion for % Orientation and...
b7f0440b97b5d2caac66d4a7291101dbfd8660e9bb105ac10ef7a57ca4c53b4f
MATLAB
1,455
50
function plotVisualOcclusion(I, K, c) % Parameters amp = 10; % (deg/s) t_before = 0.2; % (s) t_after = 1; % (s) t_light_off = 0.5; % (s) t_light_on = 1; % (s) t_smooth = 0.02; % (s) % Run simulation tt = -t_before:K.dt:t_after; head_curr = zeros(size(tt)); target_curr = smooth(amp*(tt>0...
539997f98f0d3987a38df7ab3739be16a32c5f1bc2fdf9f01dfda7ccd6642d70
MATLAB
1,456
40
function runPlotPerfBarChart(sbjNum,numClasses,feat) processedDataDir = ['C:\Users\mn0mn\Documents\ResearchProjects\spatailAttentionProject\ProcessedDatafNIRS\Experiment' num2str(sbjNum)]; % pick one, duh. set feat = 0 if don't want to re-run. switch feat case 1 % cumulative sum from 0, ind channel ...
183144716bb0c2d7b9154a6bdbd0b82a2ea79b3c05da3a254c90769104ffdefd
MATLAB
1,457
67
function r = rate(tsa, varargin) % TODO: overlap with intervalRate % r = rate(tsa, is, TimeUnits) returns average rate of tsd object, measures in % its timeSpan period, or in an arbitrary interval % % INPUTS: % tsa: a tsd object % an intervalSet , if present rate will be calculated on that range only % OUTPUTS: %...
856628b306862528b9d1955b1fe223d4751de0076b820cce860d2b5cc5ec3162
MATLAB
1,458
42
function [imgs_C1_layer] = hmax_C1_layer(images) % measuring C1res READPATCHESFROMFILE = 0; %use patches that were already computed %(e.g., from natural images) patchSizes = [4 8 12 16]; %other sizes might be better, maybe not %all sizes are required numPatchSizes = le...
029751b06cd5bf0d31cada7e64643187a4ee4a0de69ef47e1fce5421d402bd16
MATLAB
1,459
61
%% 13-6-17: steady state with MT, balanced -- now matrix version, not analytic function [Mss] = ssSSFP_MT(alpha,b1sqrdtau, TR,dw, T1x,T2,f,ka,G) M0b = f; M0a = (1-f); kb = ka * M0a/M0b; R1a = 1/T1x(1); R1b = 1/T1x(2); R2a = 1/T2; G = G *1e-3; %<- convert from us to ms gam = 267.5221 *1e-3; %< rad /ms /uT WT = pi*gam^...
598baad3b433720b862eb992a5c5f9f3ae95792b8acf080f010b4da2ac62aa9e
MATLAB
1,461
51
function [acts scratch] = test_bp_netlab(testpats,testtargs,scratch) % Testing function for BP_Netlab % % [ACTS SCRATCHPAD] = TEST_BP_NETLAB(TESTPATS,TESTTARGS,SCRATCHPAD) % % This is the template testing function that fits with % TRAIN_BP_NETLAB. See that for more info % % ACTS is an nOuts x nTestTimepoints matrix th...
a286ba6a135c83b9634aed44530e0fde59fd17870fe3f49e594f593a86944d1e
MATLAB
1,463
44
function BaseEval2Obj_web(BaseEval,method_string,outputPath) if(nargin<3) outputPath='./'; end % tresshold for coloring alpha channel in the range of 0-10 mm dist_tresshold=10; cSet=BaseEval.cSet; Qdata=BaseEval.Qdata; alpha=min(BaseEval.Ddata,dist_tresshold)/dist_tresshold; fid=fopen([outputPath '/' method_st...
f34a94603972bcbd62f8f445ceda132caff625bae334c9d99e837c7c844b4c23
MATLAB
1,463
47
function [hf_basefit, rmse_eye, rmse_pc, nrmse_eye, nrmse_pc] = ... plotBaselineResults(K, I, conds, tts, head, target, hevel, PC, light, sines, mask, hf_basefit) % Plot JR data & model before learning & get error % Use mask to select conditions if needed if ~exist('mask','var') || isempty(mask) mask = 1:min...
3316b25126d44be3ee2de6a99aa1b14ebcefb1a5b3f01127cd8b28366481a67e
MATLAB
1,464
34
function [ SlimSkel ] = SlimSkel3D( CellToSkel,THR ) %SlimSkel3D Skeletonizes and slims output to reduce residual thick branches %or spurs. % Uses Skeleton3D and parts of Skel2Graph3D and Graph2Skel3D %OUTPUT: 3D binary image of slim skeleton %INPUT: CellToSkel is a 3D binary image containing the cell we want to ...
d69ab6326d77fcacc3a5b821e19bdff75295a2efb92f14e2ac033e9255a4258b
MATLAB
1,465
56
function generateSimData(dirname, format) if ~exist('dirname','var') dirname = pwd; end if ~exist('format','var') format = '.snirf'; end dirname = filesepStandard(dirname); files = DataFilesClass(dirname, format, 'standalone').files; for ii = 1:length(files) if ~isempty(findstr(files(ii).name, '_sim')) ...
eaa61e4a4ca74320b9058a802eff2d7ccc65b57c5215d068d97983f10b15a036
MATLAB
1,465
31
function [FirstFrame_AboveBaseline] = FirstFrame_AboveBaselineMean(FluorescenceTrace, BaselinePeriod, z, STDorSEM, SearchAfterFrameX) %FirstFrame_AboveBaselineMean finds the first frame greater than or equal %to Z STD or SEM above the baseline mean % Michelle Cahill 20211111 adapted from Peak3STD written by MC 20211...
1274a48210b5b519b4b9be733889650168642a6b6fba699bbc4a9203fd455602
MATLAB
1,466
57
function h = hinton(w); %HINTON Plot Hinton diagram for a weight matrix. % % Description % % HINTON(W) takes a matrix W and plots the Hinton diagram. % % H = HINTON(NET) also returns the figure handle H which can be used, % for instance, to delete the figure when it is no longer needed. % % To print the figure correct...
869be180db32f92a3b38ed4a335dcba6c82e3448cb4b092017fa687d9e62daff
MATLAB
1,467
42
%% Plot SSD patterns for DBS contacts (Figure 2C) repo_path = 'Path_to\Manuscript_repository'; funcs_fpath = fullfile(repo_fpath, 'plotting\matlab_funcs'); addpath(funcs_fpath); addpath('Path_to\wjn_toolbox_tsbinns'); addpath(genpath('Path_to\spm12')); addpath(genpath('Path_to\leaddbs')); folderpath_analysis = 'Path_...
9c946a98f044c98868d0ffcee942f38a8891c08eb5059798572e7a9d117b157d
MATLAB
1,467
31
function p = betaScores(r) %BETASCORES Compute Beta scores for rank vector % p = BETASCORES(r) % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - % INPUTS: % r vector of normalized rank values on interval [0,1] % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ...
575f9df9ae384d0db07840f7b3228bffa39306e8a74d5eb91275c0b388c529bf
MATLAB
1,468
68
function L = CrossValidationSpatialCheck_Cells(S,lambda,X,Y,ep,varargin) nbEp = 10; dispBar = 0; binSize = 0.5; %in cms dispInfo = 1; if ~isempty(varargin) dispInfo = varargin{1}; end epV = regIntervals(ep,nbEp); L = NaN(nbEp,length(S),length(lambda)); if dispInfo fprintf('Launching Cross-validated spatial...
cc1c209f0e48f95337e44c7e6c27a23d3ea95a7157c30401415f83c9bca766b5
MATLAB
1,468
50
function [e, edata, eprior] = rbferr(net, x, t) %RBFERR Evaluate error function for RBF network. % % Description % E = RBFERR(NET, X, T) takes a network data structure NET together % with a matrix X of input vectors and a matrix T of target vectors, % and evaluates the appropriate error function E depending on % NET.OU...
000e0f65398d9f636ace19efa55ad6463396d749526d73cee6e276d94081f903
MATLAB
1,469
61
function [h,v,B,mu] = HeadDirectionField(tsa1,tsa2,ang,GoodRanges,varargin) % USAGE % [h,d,mu,p,kappa] = HeadDirectionField(tsa,ang,GoodRanges) % % Inputs: % tsa: a ts object (typically a cell!) % ang: a tsd object of head orientation % GoodRanges: an intervalSet object defining the time of val...
5c52837e783d031fe243c511de51842dcca1b2fc8a0b3d8398406eeb1ec0a9e0
MATLAB
1,469
65
function A = PhasePref(A) A = getResource(A,'SpikeData'); A = getResource(A,'HcChannels'); A = getResource(A,'MazeEpoch'); mazeEpoch = mazeEpoch{1}; A = registerResource(A, 'HcThetaPhase', 'cell', {[], []}, ... 'hcThetaPhase', ... ['spike phase with hc theta'],'mfile'); A = registerResource(A, 'HcThetaRhyt...
db0fb1576734c1bc475b013b59fbf39581f7999c122a274601469e171c287ba7
MATLAB
1,469
46
classdef PsthDistanceClassifierModel < ClassifierModel properties psthMap SD = 20; smoothingMargins = 300; end methods function mdl = train(mdl,X,y) psthMap = containers.Map('KeyType','double','ValueType','any'); classes = unique(y);...
246f398ae741b299a19b0d5197e90c11aeb53a50f55dcc14eeb6ffd6568dc554
MATLAB
1,472
49
function score = Cal_NMI(true_labels, cluster_labels) true_labels = double(true_labels); cluster_labels = double(cluster_labels); true_labels = true_labels-min(true_labels(:))+1; cluster_labels = cluster_labels-min(cluster_labels(:))+1; if size(true_labels,2)>size(true_labels,1) true_labels = true_label...
c78dbce65c8edc2b40c2eada75738519b71f78daa25371f21fd842d50bf25315
MATLAB
1,473
62
%% Behavior figure clear MAX_DELTA = 20; [task_info,supPath] = ... loadDBAndSpecifyDataPaths('Vermis'); behavior_params.time_after = 250; behavior_params.time_before = -100; behavior_params.smoothing_margins = 100; % ms behavior_params.SD = 15; % ms req_params.grade = 7; req_params.cell_type = {'PC ss', 'CRB',...
9db472d7242f0e5bb87a734e4bcbd19e1fb4ed8f7b57116ecb312ed83f97cea4
MATLAB
1,474
49
function [e, edata, eprior, y, a] = glmerr(net, x, t) %GLMERR Evaluate error function for generalized linear model. % % Description % E = GLMERR(NET, X, T) takes a generalized linear model data % structure NET together with a matrix X of input vectors and a matrix % T of target vectors, and evaluates the error functio...
d2265b77e99d321544d432556edc74c61a97e4ef815c2fc7bdb156b34c8f6818
MATLAB
1,474
49
function [acts scratchpad] = test_smlr(testpats,testtargs,scratchpad) % Generates predictions using a trained multinomial regression model. % % [ACTS SCRATCHPAD] = TEST_SMLR(TESTPATS,TESTTARGS,SCRATCHPAD) % % SEE ALSO SMLR, TRAIN_SMLR % License: % ======================================================================...
faca43e3f67032aa6d9d94693a6b2f3e67d344b02ebc5aeb0c09e4593eb07efd
MATLAB
1,474
42
function SimRes = simRespLatencies(CrossTime,SortedStim,uAM,thrs,offset,NDTime,maxRespDelay) nStm = size(CrossTime,1); nThr = size(CrossTime,2); nUStm = size(uAM,1); minRespDelay = 0; respWin = 0.75; % for hit rate RespDelaySim = min(CrossTime - offset + NDTime,maxRespDelay);...
b1ed0dcb55bf94b5125a352e73fb10da8298756e17324194ac449037fc6e9978
MATLAB
1,475
66
function [dmoco, beta, tstat, pval, sigma, CovB, dfe, w, P, f] = ar_glm_final( d,X,tune ) % preallocation dmoco = zeros(size(d)); beta = zeros([size(X,2) size(d,2)]); tstat = beta; pval = beta; w = zeros(size(d)); Sall=[]; for j = 1:size(d,2) y = d(:,j); B...
fcf6cec45e34366910a5097db8977aed52731e9bc7c47b396cac338f9cc11814
MATLAB
1,475
68
function iSD = GetSelectedSDPairIndex(iS, iD) global maingui SD = maingui.dataTree.currElem.GetSDG(); iSrcDet = maingui.axesSDG.iSrcDet; nSDPairsSelected = size(iSrcDet,1); nSrcs = length(SD.SrcPos); iSDs = mod(iSrcDet(:,1) .* nSrcs + iSrcDet(:,2), nSDPairsSelected) + 1; for ii = 1:length(iSDs) iSD = mod(...
37c7a7c1795afcd39273b222645bf126cb59c36b94741f4e537d1f4d65723209
MATLAB
1,477
49
function [p_val] = permutationTest(X, Y, sum_metric, num_iter, test_dir) % X has label 1, Y has label 2 % sum_metric: 'mean' or 'median' % num_iter: number of iterations % test_dir: 1 - left sided, 2 - right sided % load the same set of (pseudo)random seed everytime load('random_seed_permutation_test.mat','rand_seed'...
674e840dd592d281f6a1887d0836faea52c87a4106ccbcd9c44793c463e5d858
MATLAB
1,477
31
% % Compare simulated spike times to real spike times % cd '/home/nmsutton/Dropbox/CompNeuro/gmu/research/sim_project/code/holger_data/nate_scripts/for_jeffrey/' load_data cd '/home/nmsutton/Dropbox/CompNeuro/gmu/research/sim_project/code/gc_can/scripts/' animal_spikes = spikes(3,:)'; sim_spikes = readmatrix('/home/n...
0202d04c46485b7e335e197c76f6e9f84b603fd54765aaeacdc87ec433a4a4b7
MATLAB
1,478
35
%% Flow Cluster Control Script intPower = 0.9; clusterFilSig = 3; clusterFil = fspecial('gaussian', 6*clusterFilSig + 1, clusterFilSig); clusterFil(3*clusterFilSig + 1, 3*clusterFilSig + 1) = 0; clusterFil = clusterFil/sum(clusterFil(:)); cVec = (0.55:0.15:1)'; posThreshVec = 0.0001;%[0, 0.0001, 0.001, 0.005]; negThr...
119d107e638ce7f3276a9dbb989df604c7b461f36ddba888f3e49b1d5397e470
MATLAB
1,478
59
% DEMO_RPROP_3 Rprop with GPU acceleration % Show the use of GPU acceleration for the Rprop function and compare its % performances with the normal CPU-computed version % % Copyright (c) 2011 Roberto Calandra % $Revision: 0.60 $ %% Init numdim = [1000000 500000 100000 50000 10000 5000 1000]; p.verbosity ...
f38fdb4d8e2499bdd0f215c2fb80c487b7b85a2b91964b782aed29b6db81aa69
MATLAB
1,478
55
function [ matches ] = find_obj_regexp(subj, objtype, expr) % FIND_OBJ_REGEXP - Searches for objects using regular expressions. % % Usage: % % [ MATCHES ] = FIND_OBJ_REGEXP(SUBJ, OBJTYPE, EXPR) % % Searches through the SUBJ structure to find objects of type % OBJTYPE whose name matches the regular expression in strin...
34ea52644c73e78d6dab89a315de9642c0c5b350f15967965a27854beee84b5b
MATLAB
1,482
46
function [theta_wedge,rho_wedge] = getWedgeBorder(theta1,theta2,rho1,rho2) % GETWEDGEBORDER returns theta/rho vectors of the wedge border % coordinates that can be plotted using "polar" where: % % -theta1/2 is the starting/final angle of the wedge in degrees. % -rho1/2 is the inner/outer ra...
bca985a398c94a8e89d5d690204e5e70aa3a9de364acb837c07c43fb451accb0
MATLAB
1,482
66
function [output] = check_matlabVersion(varargin) % % This checks the supplied integers against the current version of matlab % and returns a -1 if the current version is older, a 0 if they are the % same and a 1 if they are newer. If you would like to only test the major % and minor versions then you can call the fun...