sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
1210dd850b8c159e8a5159051859f46c5da9ed292a602227d85ec73840dd15a4
MATLAB
2,420
51
%% WRAPPER SCRIPT FOR AUTOMATED SEGMENTATION OF SYNAPSES FROM MULTI-EXR IMAGES %% % Image processing up to this point was: background subtraction, median % filtering, and automated thresholding in ImageJ % Last modified 6/13/22 % Note: this script has not been updated or maintained, but has been % provided in ...
1212a91db21e572e711a5eadd197e90060ccd80387a19c9f4d7e8a9b468d8ec5
MATLAB
2,420
76
function [h, p, stat] = ttest_clustercorr(dat1, dat2) % wrapper around fieldtrip's cluster-based permutation test on a % timecourse, behaves similarly to matlab's ttest % input: nsubjects x time addpath('~/Documents/fieldtrip'); ft_defaults; % ============================================= % % RESHAPE DATA % =========...
4b4b7dc5ef8db883b1d6b027f96a2a59867615aa460c243fdf32600b2168cb9c
MATLAB
2,420
70
function [msmooth, Vsmooth, loglik, VVsmooth, m0smooth, V0smooth, VV0smooth] = ... ldsInfer(y, A, C, Q, R, init_mu, init_V, varargin) % Kalman/RTS smoother. % Input/ output is same as for kalmanFilter % For learning with EM, we also need to compute % VVsmooth(:,:,t) = Cov[Z(t+1), Z(t) | y(1:T)] t=1:T-1 % We follow Ma...
50f4c7ae8bc9d2fecdc1d2feb156a609cd7e02ae1135556b1700cd5e92a8383b
MATLAB
2,420
91
function setviewpoint(ax, coordsys, viewpoint) % SETVIEWPOINT changes the viewpoint for a 3D image that contains data in a known coordinate system % % Use as % setviewport(ax, coordsys, viewpoint) % % For example % setviewport(gca, 'mni', 'left') % % See alo FT_PREPARE_LAYOUT>getorthoviewpos, COORDSYS2LABEL if is...
6cf9915654f1f01da71870a01e83ad6db25b5ff7d7f63da400995a695719b992
MATLAB
2,420
58
%% Select the current procotol % (Note: a Brainstorm folder already exists for this subject) % Get the protocol index iProtocol = bst_get('Protocol', ProtocolName); if isempty(iProtocol) error(['Unknown protocol: ' ProtocolName]); end gui_brainstorm('SetCurrentProtocol', iProtocol); [sSubject, iSubject] = bst_get(...
4c00025ad7507f9f646760f2f3f9c2f4e358249e79b983ef8a1413c5f9bd2f10
MATLAB
2,421
75
% Runs various limited-memory solvers on 2D rosenbrock function for 25 % function evaluations maxFunEvals = 25; fprintf('Result after %d evaluations of limited-memory solvers on 2D rosenbrock:\n',maxFunEvals); fprintf('---------------------------------------\n'); fprintf('x1 = %.4f, x2 = %.4f (starting point)\n',0,0)...
3bb727e957e977f59055b634674dbdf03d3ef1836cb2e5aec7fae797a856a3dc
MATLAB
2,422
63
%% S3 Fig: To plot time course after block averaging for each condition over all subjects clear all clc load incongruent_allsub_2probe_final.mat load congruent_allsub_2probe_final.mat load incongruent_allsub_2probe_final_hbr.mat load congruent_allsub_2probe_final_hbr.mat % Delete the following subjects due to noise ac...
60b213bf23e1d56ccc7f35ba4df77f89abd9accf8ab0541802b2cd23339f95cb
MATLAB
2,422
101
function hout=suptitle(str) %SUPTITLE puts a title above all subplots. % % SUPTITLE('text') adds text to the top of the figure % above all subplots (a "super title"). Use this function % after all subplot commands. % % SUPTITLE is a helper function for yeastdemo. % Copyright 2003-2010 The MathWorks, Inc. % Warni...
9bbe725d268e8370fb7e36a52e0f7caaecc6d4cf92da4d72b7a77999c183fca2
MATLAB
2,423
85
function [synData,synLabels] = generate_synthetic_set(data,labels,varargin) % % AUTHORSHIP % Math Lead & Primary 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 WAR...
2bc916f7fd1ece8ef89403c045d66ebb57cc4b291ad6c463f6511642c440e006
MATLAB
2,425
55
qq=1; %sheet number [Familiar_object_exploration_start]=xlsread('File.xlsx',qq,'C:C');% Start time point of object exploration period [Familiar_object_exploration_end]=xlsread('File.xlsx',qq,'D:D');% End time point of object exploration period [x]=xlsread('File.xlsx',qq,'A:A');% Time [y]=xlsread('File.xlsx',qq,'...
cd8d2b3c01739ce93297fd379bf60a232c900a8cf4aa4a078adec1e1746b15ae
MATLAB
2,426
80
clear figure set(gcf,'color','w'); set(gcf, 'Position', [230,430,200,400]) ellipse_ratio = zeros(1,2); ellipse_angle = zeros(1,2); semimajor_axis = zeros(1,2); semiminor_axis = zeros(1,2); for line = 1:2 subplot(2,1,line) if line == 1 %R4d load('ER4d_list.mat') load ellipse_data_ER...
54faeae99fb0c1cb3e861121bae9c8c1c3def673c4a79ba441c582de1806f963
MATLAB
2,427
79
% Companion function to pca. % % Use pca to retrieve the principal components U and the mean mu from a % set fo vectors X1 via [U,mu,vars] = pca(X1). Then given a new % vector x, use y = pca_apply( x, U, mu, vars, k ) to get the first k % coefficients of x in the space spanned by the columns of U. See pca for % genera...
d0b2a7d818ae66a8974b30427be9e4c389e169bf45a3bfd8e18efafbd51355e8
MATLAB
2,427
71
function [s,baseused] = structoverlay(sbase,sover,varargin) % [s,baseused] = structoverlay(sbase,sover,varargin) % Overlay 'leaf nodes' of sover onto sbase % % sbase: scalar base struct % sover: scalar overlay struct % % s: scalar struct, result of overlay % baseused: cellstr of 'paths' specifying fields where sbase va...
f421921364cc1af5ddb65f37bde2e631255f130788e15d3f72d07479039fae7d
MATLAB
2,427
98
% This function runs the Normalize substraction to % the functional data series (+ high pass filtering) % Author: Milena Capiglioni, University of Bern % Contact: milena.capiglioni@extern.insel.ch % Last update: Nov.2023 % Feel free to use the software and report any bugs! % If you use/modify this code for your futur...
fe64df25703bf0bba0179ed15cbf0cbf778ab0cf01e6e44a92c29eb9f36b9e80
MATLAB
2,427
58
% This script plots mesh cross-sections and NIfTI data when availble %; % Copyright SNM/WAW 2018-2023 % addpath('../engines/graphics'); VT = VT1; f = figure('WindowState','maximized'); %% below is XY-code y = Y(1); % Display NIFTI slice I = round(y/d1d2d3(2) + N1N2N3(2)/2); S = squeeze(VT1(end:-1:1, I, :))'; ...
26b87beff872fff5c7bd23db8f93870f4c47f32630b16b3f24871db81766a4b2
MATLAB
2,428
70
addpath('../engines/bem_fmm_engine/'); addpath('../engines/graphics/') load(fullfile(model_path,strcat(patno,'_',model_name,'_NIfTIOverlap.mat'))); %% Dipole location in mm dip_center_pos = (strdipolePplus + strdipolePminus)/2; X = dip_center_pos(1)*1e3; Y = dip_center_pos(2)*1e3; Z = dip_center_pos(3)*1e3; %% Calcul...
b7d864b2ea81489ca1b24e8ad4822215c09a33f1d646ed5385554828425c8aeb
MATLAB
2,428
76
function h5save(filepath, X, dset, varargin) %H5SAVE Create and save a variable to an HDF5 file. % Usage: % h5save(filepath, X) % h5save(filepath, X, dset) % % Args: % filepath: path to HDF5 file % X: variable to save % dset: name or path to dataset (optional if variable name can be determined by inputname) ...
cda8561e5a97e7d65dd904ee2e3f43f5027392bbe4c48fd47adb44ad3fb14faa
MATLAB
2,428
81
%% Generates the figure 4d %% Requires set: % - fn_timing % - res_path % - mapper_name % - CHANGE_POINTS workspace = getenv('WORKSPACE'); fn_timing = [workspace, '/data/cme/timing.csv']; res_path = [workspace, '/results/cme/ch10_mappers_cmev3_disp.json']; mapper_name='BDLMapper_12_30_60'; CHANGE_POINTS = 10; % Get th...
5896a49f414bab21fc77ad2e6d2a3c49323ffa6f8036fad777494db4549bdd20
MATLAB
2,429
57
% SVD_forMSI.m % Sarah West % 8/6/20 % Runs SVD on all the data from a given animal. Must be done with MSI or everything will die. % For each mouse, loads the filtered and blood vessel regressed data, concatenates it all % together, runs SVD, then saves the outputs. clear all; n_compressions=200; pixels=256; %size of...
a987836b9d73f69c949e2735e230e8e6af7481d5cd17ab0cc61cbbb8c0b3a484
MATLAB
2,429
96
%% Interpolate some data using a joint Gaussian % Based on p140 of "Introduction to Bayesian scientific computation" % by Calvetti and Somersalo clear all setSeed(1); D = 150; Nobs = 10; xs = linspace(0, 1, D); perm = randperm(D); obsNdx = perm(1:Nobs); hidNdx = setdiff(1:D, obsNdx); % Noisy observations of the x v...
03460ab8facb9b7d428b5b56a9a8e963de9c22f7575ded907978c8211e83ed46
MATLAB
2,430
69
function [y,iflaw]=dopnoise(N,Fs,f0,d,v,t0,c); %DOPNOISE Complex noisy doppler signal. % [Y,IFLAW]=DOPNOISE(N,FS,F0,D,V,T0,C) generates a complex % noisy doppler signal, normalized so as to be of unit energy. % % N : number of points. % FS : sampling frequency (in Hertz). % F0 : target frequency (in Hertz)....
44b240230e0b6aad6920e26b31cfc404999220982b1e5a23f528f1210dfff86d
MATLAB
2,431
74
function [r2, rmse] = rsquare(y,f,varargin) % Compute coefficient of determination of data fit model and RMSE % % [r2 rmse] = rsquare(y,f) % [r2 rmse] = rsquare(y,f,c) % % RSQUARE computes the coefficient of determination (R-square) value from % actual data Y and model data F. The code uses a general version of ...
3b6402e8914eedb3f6ace95dd7eb8041a6301909108b5db41bf9e8f221d82ea6
MATLAB
2,432
40
clear r_other_asbl_int_on r_other_asbl_int_off r_out_asbl_int_on r_out_asbl_int_off [traces] = extract_variables ('traces',[],resultsPath, 'all', [],conditionType,conditionValue); [pyr_id,int_id] = extract_variables ('nCells',[],resultsPath, 'pyr', 'int',conditionType,conditionValue); [si_img] = extract_variables ('s...
528bdfbf4907623b17f6617df26549a6ee99d4a53a8eaf5b8d4ea4148ebc30bc
MATLAB
2,433
91
function spkDat = SplitAll(spkDat, varargin) Fs = spkDat.Fs; wvFs = Fs * spkDat.upsample; clustList = setdiff(unique(spkDat.id), 0); [wL, nChan, ~] = size(spkDat.waves); pk = spkDat.peakLoc; wP = spkDat.wavePad; wL = wL - 2*wP; win = 1000 * [1 - pk wL - pk] / wvFs; chanList = 1:nChan; subtractMean = true; method = 'is...
db253ed421942465f7056ff0e9dad5ea07bcec20905451f0274fa863a5b8cf13
MATLAB
2,434
122
% % Test Helmholtz particle FMMs in R^3 % zk = complex(1.1); N = maxNumCompThreads nsource = 2000; source = zeros(3,nsource); idist=1; if( idist == 1 ), theta=rand(1,nsource)*pi; phi=rand(1,nsource)*2*pi; source(1,:)=.5*cos(phi).*sin(theta); source(2,:)=.5*sin(phi).*sin(theta); source(3,:)=.5*cos(theta); end if...
f870bb893667dbde2ccdad2d97703e36a5e195bcfc44f767c626f4dbd34fb6dc
MATLAB
2,434
44
classdef sourceIntensityDistribution % sourceIntensityDistribution Summary of this class goes here % Detailed explanation goes here properties radialDistr (1,:) double {mustBe012OrNaNOrNonnegativeArray} = NaN % Radial near or far field distribution - 0: Top-hat, 1: Gaussian, 2: Cosine (Lambertian), Array...
a6c1865bcdbca3b59019b9d67425cf7ab46315a571fd936ec3d13ea241afabdf
MATLAB
2,435
87
function [badChannels,resMat] = detectBadChannels(cfg,task) thr = cfg.bchthr; sections = cfg.sections; dataset = cfg.dataset; if strcmp(task, 'Rest') sample_epochs = cfg.epochs; else disp('Non-Rest'); end %import raw data cfg.dataset = cfg.dataset; % cfg.channel = {'MEG'}; sens...
d58b19ec40aaee11d45312a35917ba8da966dd8a0dd99bc4ee1b212e29bfb848
MATLAB
2,435
95
function [VarStruct, StatOpt, IsMAT]=w_uiLoadMat(varargin) if nargin==0 PDir=pwd; elseif nargin==1 PDir=varargin{1}; else error('Invalid Input'); end if exist(PDir, 'file')==2 PDir=fileparts(PDir); elseif exist(PDir, 'dir')==7 PDir=PDir; else PDir=pwd; end VarStruct=[]; StatOpt=[]; [File, Pat...
07777af42ee58f799773cb3eb2742852ab77ab657e9cadab77788aa78fe24067
MATLAB
2,436
66
function data = loadHastieMixtureData() % Load Hastie mixture data from % http://www-stat.stanford.edu/~tibs/ElemStatLearn/datasets/mixture.example.data % http://www-stat.stanford.edu/~tibs/ElemStatLearn/datasets/mixture.example.info % %% Data % Data is a struct with the following fields: % x - 200 x 2 m...
ca927b1515c20c903321d6d2046e77790e20c5ac5629f7ac83ee9f15b47db4a4
MATLAB
2,436
83
% plot_Fig6d % Plot leverage of Min activity on behavior %% Load data medA = load(fullfile(saveLoc, 'for_plots_mediation_norm_to_se')); %% Plot settings mediatedDimsA = [3 11 27]; % MinC, MinI, Tin ('for_plots_mediation_norm_to_se') rows = 1; colms = 2; sFont = 6; xLims = [0.2 0.55]; yLimCho = [-3 ...
0d14f37e39b89490ba870d5353e2a0edc0929b9698b31eb7c41ddef4faade715
MATLAB
2,437
78
function G = filterGauss( dims, mu, C, show ) % n-dimensional Gaussian filter. % % Creates an image of a Gaussian with arbitrary covariance matrix. The % dimensionality and size of the filter is determined by dims (eg dims=[10 % 10] creates a 2D filter of size 10x10). If mu==[], it is calculated to be % the center of t...
f115961c960fef8be5a5e8cea73fb03e0be90ff686e06d7e4c1d611cd9b83c17
MATLAB
2,437
102
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % To fit a 2-D gaussian % m = Image %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [cx,cy,sx,sy,PeakOD] = Gaussian2D(m,tol); % % [sizey sizex] = size(m); % [x,y] = MeshGrid(1:sizex,1:sizey); % fit = abs(PeakOD)*(exp(-0.5*(x-cx).^2./(sx^2)-0.5*(y-cy...
7152d978c7860460a3e9a30ae56f9737334401405c9f89fa50b0b22b72031b44
MATLAB
2,438
54
function projectDir = afxFirstlevel(subjects,denoisingOptions,rois,projectName,analyses,incl) % default analyses if nargin < 5 analyses = {'fc_wholebrain','fc_network'}; end % load subjects, options and rois if necassary if ischar(subjects), load(subjects); end if ischar(d...
ccc1f730014b4d87ce546f293efbb5e7788e5136261d38adb2455a770146d95d
MATLAB
2,438
101
% theta = choose_orientations2(x,y,phi,wtheta,wphi) % % we will set the orientation to theta_t = phi_t + s_t * pi % we want to choose s_t to minimize % \sum_t cost(s_t|s_{t-1}) % cost(s_t|s_{t-1}) = [wtheta_t*d(\theta_t,\theta_{t-1}) + % wphi(||v_t||^2)*d(\theta_t,angle(v_t))] % % we will find the ...
def8618ce26eb1c74dadb15abc12b9e9bb7ea0854f6266b9c2fe7f00ea6b77a9
MATLAB
2,438
52
%% 功率谱密度 | power spectral density %% 非参数方法-周期图法 | Periodogram % 直接调用bandpower(X, fs, [f_low, f_high])完成功率谱估计和相对average band power特征提取 % 功率谱使用默认的modified periodogram函数估计 % X: single channel EEG signal (either a row vector or a column vector) % opts.fs: sampling frequency 信号采样率 % opts.f_low: freqrange — Frequency range f...
5809be253f56522ada08b62bd7351655f9fa2989dc284d7755a4a5014780e00a
MATLAB
2,439
80
classdef Singleton < handle properties (Constant) instances = containers.Map; end properties name end methods function obj = Singleton(name, varargin) % Create a new instance or return an existing instance with the same name. ...
e93e28a95f5f61de685f137e2084f439889f4a848360a4af6b80107d8ad06a90
MATLAB
2,440
123
function cls = cluster_stata(carta,elec_adj,n) % % cluster de significancia en 3 dimenciones siendo % % % en construccion % v.0.0.1 % P.Billeke dm = size(carta,3); el = size(carta,1); if dm == 1 els = size(carta,1); for ad = 1:length(elec_adj) rcarta = carta(elec_adj{ad},:); paso = bwlabel(rc...
3e3d1e742c430d19c1e5d79ca163b550577cb80a18748a6ee0e5a5fa602c036c
MATLAB
2,441
125
% this function reads raw data and pulls out metadata from them % such as temperature and pH % and saves it to a .metadata file with spikes function cacheTemperature(exp_name) spikesfolder = getpref('crabsort','store_spikes_here'); if nargin == 0 % do it for all of them allexps = dir(spikesfolder); for i = lengt...
77cc8e7570f2f34d7bb9e1a2a7e50e94629a74f9b69b9e46dd2f85e2e1cfe770
MATLAB
2,441
90
%% choose session datRoot = '/Volumes/LaCie/Farries recordings/'; %datRoot = '/Volumes/Elements/'; %srvRoot = '/Volumes/Recordings/Michael/'; rat = 'IM1261'; sesList = dir([datRoot rat '/20*']); sesList = arrayfun(@(x) x.name, sesList, 'UniformOutput', false) %sesList2 = dir([srvRoot rat '/20*']); %sesList2 = arrayfu...
e84493fe863f25c0e6716217fe8da5f003777919ed46ed4c6ddde14d3ae7d3bd
MATLAB
2,441
78
function EEG = InsertSaccadeTriggersIntoEEG(EEG, behDataFolder, minSaccSize, blinksToo) % call InsertSaccadesAsTriggers without having to do entire trioEEGLoad % script. it will insert them right into the EEG structure % if ~exist('minSaccSize','var') || isempty(minSaccSize) minSaccSize = 1 / .0203; % size of min...
ff81e33d31346c355f4a1358cd474d1e502b0ccd608b4e15c4941260eda2a9a8
MATLAB
2,441
51
classdef CBIG_VK2019_unit_test < matlab.unittest.TestCase % Written by Valeria Kebets and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md methods (Test) function test_example(testCase) % create output folder current_dir = fileparts(mf...
3b380feb3e54166894261b12dd6bba569f4b03ac9de41be49bb16c43c30dec4d
MATLAB
2,442
105
% This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful,...
651d7d66fbf5ccb0a2c4705f5dadae56c31d28b84deec28727a6fd77e43d5ccb
MATLAB
2,442
101
[t,TIN, TOUT,EC,EI,CHOICE,RT,COH,SESSION] = get_and_prep_data(); %% e = EC-EI; tind = t>=0.1 & t<=0.4; ee = nanmean(e(:,tind),2); % p = publish_plot(2,1); p.next(); curva_media(CHOICE, COH, ee<nanmedian(ee), 2); hold all curva_media(CHOICE, COH, ee>nanmedian(ee), 2); hl = legend('low contra-ipsi Min', 'high contr...
9dd6ccb2c5cd90f23bc929d496793ce8dcc8c2a63ddf1fd4a9d6dc4366e6ebe6
MATLAB
2,442
99
% [newX, snr1, snr2, Mx, My] = adjustCorr2s(X, Cx, Y, Cxy, MODE, p) % % Linearly adjust variables in X to have correlation Cx, and cross-correlation Cxy. % Rows of X, Y, and newX are samples of (random) row-vectors, such that: % 1: newX = X * Mx + Y * My % 2: newX' * newX = Cx % 3: newX' * Y = Cxy % % MODE is...
2c8eb6cb0a83715e2d08bfef429ee21f61de7c41c78cfb2b5691785a09220984
MATLAB
2,444
73
function [XL,XR] = stereo_triangulation(xL,xR,om,T,fc_left,cc_left,kc_left,alpha_c_left,fc_right,cc_right,kc_right,alpha_c_right), % [XL,XR] = stereo_triangulation(xL,xR,om,T,fc_left,cc_left,kc_left,alpha_c_left,fc_right,cc_right,kc_right,alpha_c_right), % % Function that computes the position of a set on N points giv...
ecc3a093ade1dcf121322767f1569203eb2486929f87590db6aea92ee982959f
MATLAB
2,444
74
% Author: Birgit Nierula % nierula@cbs.mpg.de function [EEGorig, EEG, cfg] = eeg_prepro_loop7_1_allBlocks(subject, veog_channames, heog_channames) %% loop 7: check ICA components with SASICA % define variables subject_id = sprintf('sub-%03i', subject); analysis_path = [getenv('ANADIR') subject_id '/eeg/prepro/']; ...
1dac53cd37e4b468958d8aa243b5c958e0872c6921f4c85139e8e07e9c56e808
MATLAB
2,445
79
%% ---------------------------- Plot Linear ----------------------------- linear_fig = figure(); plot(rr, intersections, 'linewidth', 2 ); grid; xlabel('r, \mum', 'interpreter','Tex') ylabel('Intersections'); print(linear_fig, ['results/' name '/sholl_linear_' name '.png'], '-dpng'); savefig(linear_fi...
6cb2eff62ec47a79ca8fda03a7bfb6b7a5c994879c568859df7b9fad733f552a
MATLAB
2,445
102
function [S,P] = simRace2DDM(t, varargin) % returns stucture S with fields % .decTime (decision timer) % .choice (0 or 1) % .dvTin (dv of the positive choice) % test % t = (0:0.001:1); [X,P] = simRace2DDM(t); % simRace2DDM(t,'seed',P.seed); % varargin pSet = inputParser; addParameter(pSet,'coh',0); % -1..1 scale ad...
8321b7387a6b3854c8ed299360b2ea687d84eeb5443b784c3043bfead50d17a7
MATLAB
2,445
72
function [X,X1,X2] = VBA_Fourier2DBF(L1,L2,N,dct) % creates 2D Fourier basis functions % function X = create2dbf(g1,g2,N) % This function evaluates Fourier basis function sets, evaluated on a 2D % domain defined by 2 grids g1 and g2. Let z(x) be a 1D-field of length L. % It can be decomposition using the Following Four...
93a38e0552add6d055cdfabe432c6ec1a8e4cbe3189de0563573c7aa2e43a39b
MATLAB
2,445
118
% Z -> Xj -> Yj % Z is mixture node % Xj is binary tag % Yj is response of tag detector % We generate some synthetic correlated binary data % consisting of 10s and 01s setSeed(0); D = 4; % num bits/ nodes mixWeights = normalize(ones(1,D)); N2 = 20; X1 = repmat([1 0 0 1], N2, 1); X2 = repmat([0 1 1 0], N2, 1); X = [X...
a07a14088bb03da0ddf86abfb248c53cc368ba0fe1513a726de0a00a5a3b8a0f
MATLAB
2,445
71
function [records,party,senators,bills,nmissedVotes] = senateDataLoad() % Senate Voting data from 109th Congress 2004-2006 % % records % 542-by-100 matrix of -1, 0, +1 representing the voting records % of 100 Senators on 542 bills. % % party % the party to which each senator is affiliat...
a6f9ec09d41778b323b4733edafe52d23a969971fd9844dd7362713e7324438c
MATLAB
2,445
62
% This script shows how to process and manipulate loaded datasources and % how to call dataspace module-functions on them. % % The same exact procedures apply to programatically loaded datasources (not involving the GUI). % % % %<PRE> % This file is part of dspace-core. % ...
f8e45f7428fdca5d5b3b514379d18c36224ec5338f8249d803494ce5e9f1a014
MATLAB
2,445
83
function [closestPtBef,closestPtAft,idxB] = findBeforeAfter(A,B,type) % findBeforeAfter This function finds the closest value of B to each value of A. % % Inputs: % A: A matrix of values % B: A matrix of reference values % Type: Type of points we want to return (3 options) % 'both' = find the closest p...
0b2ff7598389d423806c3075e5d7adb6321ca8fbcf06bb30c39105955d7b23b6
MATLAB
2,446
50
function CBIG_preproc_unit_tests_cmp_clusters( your_clusters, cmp_dir ) % CBIG_preproc_unit_tests_cmp_clusters( your_clusters, cmp_dir ) % % Compare your 100 subjects clustering result with the ground-truth unit % test result. % % Inputs: % - your_clusters % Your 17 network clustering result by running the s...
cd3b17d1d6b46bd0ac1e5320868821832c3f144f586cd2fb1b759fed5927ad1f
MATLAB
2,446
59
%% % =================== BEHAVIORAL ANALYSIS: MIXED MODEL ==================== % Mixed model to study the impact of run and instruction on the error rate. %% clc; clear all; close all responses_description = ... readtable('F:\SEM_mri\MRI\Behavioral analysis\responses_description.xls'); qi_data = readta...
273a8547507967062fdd1c7bea55e808094236b62980a2c0f444e3bfa8fefa6c
MATLAB
2,447
106
function [myfft, freq, handle] = fft_plot_scnlab(dat, TR, varargin) % :Usage: % :: % % [myfft, freq, handle] = fft_plot_scnlab(dat, TR, varargin) % % :Inputs: % % **dat:** % is a data vector (column) % % **TR:** % is the sampling rate of the data you put in % in seconds / sample, or 1/Hz %...
a9233999be9217303eb6c5b90e10767c6465dcc279036888315182b3986499b8
MATLAB
2,447
86
% Renamed from calc_Fig4a_S9 %% Decoder performace: fixed time window %% weights from 450ms applied to all time points for %% 1. all neurons, %% 2. only Tin neurons, %% 3. no Tin neurons, %% 4. no Tin or Min neurons load(fullfile(saveLoc, 'par_sess')) %% Aligned to motion onset % Take out the...
b56e0d2ccb439e38b594af364c5e853e17d5d89d5932876e671dd2ec62816ec2
MATLAB
2,447
69
function [Kernel, features, D] = build_kernels_PCAstates(datadir, hmmdir, kerneldir, HMM_name, Fn, Kn) % [Kernel, features, D] = build_kernels_PCAstates(datadir, hmmdir, kerneldir, HMM_name, Fn, Kn) % % build kernels from HMMs using PCA-reduced state parameters and transition % probabilities/initial state probabilitie...
3a869f9aecd6feb6966a6519eb8599919d8527969f690f26a0eef8a1bd578481
MATLAB
2,448
93
classdef DataAugMontage < handle properties idx % [nx3] (m,f,t) ims % [n imnr imnc 3] locs % [n x npts x d x ntgt]. mask % [n x imnr x nc] isMA name = '' % character description maskrgb = [0 1 1]; end methods function obj = DataAugMontage end function init(obj,ma...
9c547483058d00f542995b1f038881013e20d6864032cc2a4b08b1b2aec12571
MATLAB
2,448
66
clear tilling_queue kk = 0; for ii = 1:size(read_file_name,1) for jj = 1:size(read_file_name,2) for ll = 1:size(read_file_name,4) kk = kk+1; tilling_queue(kk).channel = ll; tilling_queue(kk).side = iamge_set_folder_detail(ii,jj,ll); tilling_queue(k...
bb476c3fdf9af8e16756bcb00dddb595aabed9302cec664823b8e337fcf9e56f
MATLAB
2,448
81
function l = filelist(directory, filemask, recursive) % Return a list of all files of the specified type in a directory structure % * .svn files and directories are ignored % * directories are not included in the list even for *.* - see dirs() % %% Inputs [default] % directory [pwd()] the top level directory % file...
82a118d411c3505fd68383a203381189dcc3358021d5e29dcd9eb9c0856026c1
MATLAB
2,449
77
function [CIJtree,CIJclus] = my_backbone_wu(CIJ,avgdeg) %This is a modification of the original Brain Connectivity Toolbox function %to allow the computation of only minimum spanning trees with an average %degree of 0 %BACKBONE_WU Backbone % % [CIJtree,CIJclus] = backbone_wu(CIJ,avgdeg) % % The network back...
1e2c8be2c04f55a0c57b6a1ae0fde82dd38c84f54154304c308399a5de4ccdbc
MATLAB
2,450
67
function CBIG_preproc_DVARS_FDRMS_Correlation(DVARS_file,FDRMS_file,output_dir_name) %CBIG_preproc_DVARS_FDRMS_Correlation(DVARS_file,FDRMS_file,output_dir_name) % % This function is used to compute the correlation between DVARS and FDRMS. % This correlation shows whether DVARS and FDRMS are able to caputure % ...
6a90b3462dda6a6a4b49fdff0627cdc17b438fae65fc6e21b51d43974884027f
MATLAB
2,450
76
function errorbarT(h,w,t,xtype) %errorbarT Adjust the width and thickness of errorbars % errorbarT(H,W,T) adjust the width of error bars with handle H. % The input W is given in the units of the current x-axis. % The input T is the 'LineWidth' of the errorbar % errorbarT(H,W,T, 'RATIO') adjust the width o...
b4c6e69e40776a414d885506afdbcc4f8f42e3476c0378d237545f609be249bf
MATLAB
2,450
81
function tocStatus( id, fracDone ) % Used to display the progress of a long process. % % For more information see ticStatus. % % USAGE % tocStatus( id, fracDone ) % % INPUTS % id - unique id of progress indicator % fracDone - value in (0,1] indicating percent operation completed % % OUTPUTS % % EXAMPLE %...
7a250297e62ca35aa0d21eed2bd3e70ae9aec08ca66d18765b689c76a95ab1d1
MATLAB
2,451
68
function X = thomson_problem(n, d) % Simple attempt at computing n well distributed points on a sphere in R^d. % % This is an example of how Manopt can approximate the gradient and even % the Hessian of a cost function based on finite differences, even if only % the cost function is specified without its derivati...
d10f3f5ca9f2ae86ef0322ce602e10316b4b2a3b13d2b8a7fc606a8f331309a9
MATLAB
2,451
97
function [no,xo,idx] = myhist(varargin) % almost the same as hist, except it can take weights % Parse possible Axes input i = find(strcmpi(varargin,'weights')); if ~isempty(i), weights = varargin{i(end)+1}; varargin([i,i+1]) = []; end error(nargchk(1,inf,nargin,'struct')); [cax,args,nargs] = axescheck(varargin{:})...
0ae9ec1276d298e907a10191327872ddf57eeb4343ac49b39a5290c742d38c76
MATLAB
2,452
75
%% set up paths JAABAcodedir = '/groups/branson/home/bransonk/behavioranalysis/code/Jdetect/Jdetect'; labelfiles = { 'Y:\Jay\videos\M186hm4dBPN\labeler\labels.lbl' 'Y:\Jay\videos\M187hm4dBPN\labeler\labels.lbl'}; rootdatadir = '/tier2/hantman'; addpath ..; addpath ../misc; addpath(fullfile(JAABAcodedir,'filehandl...
2e9465c442867c087a0731da2f4c5cf3f760ba309b8dcd6bfd3762612ac9b2f1
MATLAB
2,452
82
clear srcinfo ns = 4000; srcinfo.sources = rand(3,ns); srcinfo.stoklet = rand(3,ns); srcinfo.strslet = rand(3,ns); srcinfo.strsvec = rand(3,ns); nt = 3999; targ = rand(3,nt); eps = 1e-5; ntests = 2; ipass = zeros(ntests,1); errs = zeros(ntests,1); ntest = 10; stmp = srcinfo.sources(:,1:ntest); ttmp = targ(:,1:ntest...
61dbeabe39c6f7efaa93fd53babcdbd93a95f8613625b7638930bfac7b7d79d6
MATLAB
2,452
86
function [source] = fixinside(source, opt) % FIXINSIDE ensures that the region of interest (which is indicated by the % field "inside") is consistently defined for source structures and volume % structures. Furthermore, it solves backward compatibility problems. % % Use as % [source] = fixinside(source, 'logical'); ...
a18e35033043ff4ed0d074222d9f3136d3e088318b349df1d3f1e5823a19a056
MATLAB
2,452
93
function newevlist = wlAux_getReconFromWave(oldevlist, label) % function newevlist = wlAux_getReconFromWave(oldevlist, label) % % This function fills in "times", "wave", "mag", "freq", and "phase" in a % seires of event records by copying a set of signal traces stored in % "auxwaves" that begin with the specified pref...
f81550467ea370de1e22b202670a9f16940b083720ba5b92d608f1381531b355
MATLAB
2,452
62
%----------------------------------------------------------------------------------------- % Plot decoding performance for chemical vs. perceived odor identity % % Kehl et al. 2024 (DOI:XX) % Single-Neuron Representations of Odors in the Human Brain % Figure 4h % Author: Marcel Kehl % License: MIT License %---------...
1d82e710f2223844835619f0cda9d2b8844e2e5e78631d25d268795c5eb9ba7e
MATLAB
2,453
51
function [estimate_frequency,complexity] = simpleHjorth(test,Fs) %% ============================= Inputs =================== %% % test : is the input vector signal % Fs : is the sampling freqeuncy used to derive the frequency from Radians % to Hz. %% ============================= Outputs ============================ %...
8468458a29eb0d968519a72a5a5e2015d6f7328421afa7422e2e5368ad2ca57d
MATLAB
2,453
70
function [Num_Bins,Bin_Edges,Bin_Labels,Bin_Centers,Histogram,Normalized_Histogram,... Cumulative_Histogram,Normalized_Cumulative_Histogram]=Multi_Histogram(Data,Bin_Range,Bin_Size) if any(Data==Inf) warning on warning('Removing Inf values!') Data(Data==Inf)=NaN; end if an...
ae00d0b538aa1ae7493572ca8095d461cb5b61ccd0ed3fafcd21ab69b5992d6b
MATLAB
2,453
98
function [video,n_frames] = tif_to_video(filename,frame_rate) % % >>> OPERATION >>> % Converts series of TIFF files into an AVI video. Uses MPEG-4 compression by default. %% % >>> USE >>> %Select first TIFF file in the folder. The remaining files will be %automatically found and concatenated %If not provided, frame r...
0bb6ddda1641833b811e0bab308f4c0393e86ded9c841c5dd691b8826499b11c
MATLAB
2,454
58
function sens = undobalancing(sens) % UNDOBALANCING removes all balancing coefficients from the gradiometer sensor array % % This is used in CHANNELPOSITION, FT_PREPARE_LAYOUT, FT_SENSTYPE while isfield(sens, 'balance') && isfield(sens.balance, 'current') && ~strcmp(sens.balance.current, 'none') fnames = setdiff(fi...
1c786016c6b61a20d0c6930c7c6c0aaf380d7abc32d4f65d6a754ab56b4f601b
MATLAB
2,455
89
function [swf] = read_besa_swf(filename) % READ_BESA_SWF % % Use as % [swf] = read_besa_swf(filename) % % This will return a structure with the header information in % swf.label cell array with labels % swf.data data matrix, Nchan X Npnts % swf.npnt % swf.tsb % swf.di % swf.sb % Copyright (C) 2...
265b5fadea882485959791a71bd4bc1cd5219ffd9e923a8a2ffce2046f19c5f9
MATLAB
2,455
58
% This script plots mesh cross-sections and NIfTI data when availble % % Copyright SNM 2017-2022 addpath('../engines/graphics'); addpath('../engines/bem_fmm_engine'); VT = VT1; f = figure('WindowState','maximized'); x = X(1); % Display NIFTI slice I = round(-x/d1d2d3(1) + N1N2N3(1)/2); % minus here! S = squ...
885ddd9855965727a835813d473ca8484ee2d7fa250062eb2c958872a73f4227
MATLAB
2,455
65
function sqrtPd = getSqrtPrecon(problem, x, d, storedb, key) % Applies the square root of the Hessian preconditioner at x along d. % % function sqrtPd = getSqrtPrecon(problem, x, d) % function sqrtPd = getSqrtPrecon(problem, x, d, storedb) % function sqrtPd = getSqrtPrecon(problem, x, d, storedb, key) % % Return...
898a38c3ac4b3ea6da18e350784a8c65dc08ff7fd243ab580d624790b2d4fd70
MATLAB
2,455
68
function im_out = nii2mat(data_path,x1_range,x2_range,x3_range,size_factor,up_thresh) % this function extracts the img from the NIfTI file and returns the desired % range and desired rescaled image as a double with no processing or % interpolation % % Input: % >>> x1_range = range of rows % >>> x2_range = rang...
481a3f496c1b83e3602c931a62c43ef659b0045f156dab2b4c2257696c033c8a
MATLAB
2,456
71
% Author: Birgit Nierula % nierula@cbs.mpg.de function [eeg_chans, esg_chans, bipolar_chans] = get_channels(subject_nr, includesEcg, includesEog, study_nr) if isempty(subject_nr) % subject_number is set to [] for general use subject_nr = 12; %this is just a dummy-subject number end %% returns EEG, ESG and bipol...
53a8d051f5772fb2f7bded7619d6a22bdc1b527150bc1a737704cc81ed98f100
MATLAB
2,456
84
function [meg] = read_ctf_dat(filename) % READ_CTF_DAT reads MEG data from an ascii format CTF file % % meg = read_ctf_dat(filename) % % returns a structure with the following fields: % meg.data Nchans x Ntime % meg.time 1xNtime in miliseconds % meg.trigger 1xNtime with trigger values % meg....
990136789201295909e78c6731630e7b8ca4278e059dcbe930767adf61cdd168
MATLAB
2,456
61
function [ss,p,pwmd] = dabest3(data,identifiers,p,pwmd,varargin) %-------------------------------------------------------------------------- % Data inputs have two valid options: % Option 1: % data: nx1 vector of values (double, int, etc) % identifiers: nx1 cell array of labels % Option 2: % d...
aaa631e205651b80b8587302dac3a781a0d3d17a4391f93d193b8f5983cb2a23
MATLAB
2,456
83
function demo_excludeData () % // VBA toolbox ////////////////////////////////////////////////////////// % % [posterior, out] = demo_excludeData () % Demo of simulation and inversion of a dynamical system that is sampled on % an irregular grid (not all timepoints are observed) % % More generally, this demo shows how to...
b10b4c152e9929262ef29ede67bd65834fa54d578bdf1208dd08a6dd55cd1b1e
MATLAB
2,456
105
%% Illustration of some subderivatives of a function at point x0. % %% % This file is from pmtk3.googlecode.com figure('Color',[1,1,1]); blueX = [-1 , 0 , 0.75 , 1.15 ,1.3 , 1.8]; blueY = [0.35 , 0.2 , 0.3 , 0.8 ,1.05 , 2 ]; f1 = @(x) 0.4*x; %tangent line f2 = @(x) 0.7333*x - 0.25; %tangent line...
b9b0ae0d0429a21f3385e8d4d681f4d20e3b8f06ddd7e91cd9b597a838a473d5
MATLAB
2,456
86
function [PL_PET] = PL_PET_atlas(PET_scan,MRI_atlas) save_imgs = 0; %% Slices regions = cell(6,1); regions{1} = [96 75;96 96;87 96;87 75]; %slice=155 regions{2} = [96 75;96 96;87 96;87 75]; %slice=156 regions{3} = [93 75;93 96;87 96;87 75]; %slice=157 regions{4} = [93 75;93 96;87 96;87 75]; %slice=158 regions{5} = [...
2368ff6bed4b4c112a9b355ddfe2335c4cf96bd6dd8a368e3de5791a2d6e3254
MATLAB
2,457
76
function [c_source_file,c_other_file] = coregister_4d(source_file, target_file, other_file, out_path, com_flag) % Source and target should be a single volume (3D). Other can be a 4D file % which will be expanded. matlabbatch = []; tag = 0; %Expand "other" filenames other_vols=[]; for i=1:length(other_file) [other_p...
b3bb3c0dbcee6814e36d40e33733042e4b4f91a193a54594ba6adbf9b881a3eb
MATLAB
2,457
88
% This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful,...
3db65ffb4e85edf16c7d828ed791e542b8b250a5aab040cbc1b6a141ebdd6440
MATLAB
2,458
57
% 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 ...
d5ebfd2c7a4683d8035259e6355285361846bc2784446b2788e69ab85cbc6dbd
MATLAB
2,458
78
function dat = ft_preproc_medianfilter(dat, order) % FT_PREPROC_MEDIANFILTER applies a median filter, which smooths the data with a % boxcar-like kernel, except that it keeps steps in the data. This function requires % the MATLAB Signal Processing toolbox. % % Use as % [dat] = ft_preproc_medianfilter(dat, order) % w...
34ed9274cf6cef2156c42e0ca4c7904b76198127ad0a2fc33f842a467ef04cad
MATLAB
2,459
68
% Wrapper script to turn GROUP-AVERAGED parcellation files into FreeSurfer annotation % files. % % Assumes ind_parcellation output from Kong2019 CBIG pipeline. % Written by M. Peterson, Nielsen Brain and Behavior Lab %To run: % 1. Claim computing resources using salloc (ex: `salloc --mem-per-cpu 6G --time 2:00:00 -...
86501c2e6d8f315698952ae02a7ca597d1e38739f3fbdb118a4218df8068bd00
MATLAB
2,459
88
% outfilenames = SaveFigLotsOfWays(hfig,basename,[formats]) function outfilenames = SaveFigLotsOfWays(hfig,basename,formats) if nargin < 3, formats = {'fig','png','pdf','svg'}; end [path,basename] = myfileparts(basename); basename0 = basename; outfilenames = {}; for iteri = 1:2, if iteri == 2, ...
d2a1e44e92cbd65d7301afd1a14c63802c0e7a8dfc25e0b0f3f5785501da85a8
MATLAB
2,459
123
function [u,ss,K,v]=PCA_MoG(y,varThresh,verbose) if ~exist('varThresh','var') varThresh = 0.95; end if ~exist('verbose','var') verbose = 1; end n = size(y,2); p = size(y,1); [u,s,v] = svd(y',0); ss = diag(s); va = cumsum(ss.^2./sum(ss.^2)); ind = find(va>=varThresh); K = min(ind); u = u(:,1:K); if ~verbos...
f315eb8adfaadd455f2e194c628c7b094de393ab80fb42cd721477f7d1aad9b0
MATLAB
2,459
84
% HIFIE_SPDIAG Extract diagonal using hierarchical interpolative factorization % for integral equations via sparse apply/solves. % % This algorithm computes each diagonal entry by multiplying from the left % and right by unit coordinate vectors, taking advantage of the sparsity of % each such op...
de7e65d73d73367ac0b373104eb0d7be95a41243f1c2af7e1a6e97c6f6daf03b
MATLAB
2,460
118
if ~exist('n_ima'), data_calib_no_read; end; check_active_images; n_col = floor(sqrt(n_ima*nx/ny)); n_row = ceil(n_ima / n_col); ker2 = 1; for ii = 1:n_col, ker2 = conv(ker2,[1/4 1/2 1/4]); end; ny2 = length(1:n_col:ny); nx2 = length(1:n_col:nx); %II = I_1(1:n_col:end,1:n_col:end); %[ny2,nx2] = size(I...
e5a43eea298a8b33f98762eb78833cfac7a3c491c18eb7978f1398ad00bb80f5
MATLAB
2,461
81
function [times,id,group] = CCGParameters(varargin) %CCGParameters - Reformat time series for CCG computation % % USAGE % % [times,id,group] = CCGParameters(series1,group1,series2,group2,...) % % series1... time series (one column) with optional IDs (in the second % column, such as obtaine...
e9b149917d917d2a5ab09c87043b9338666cd8c8ae30098d29d4bc7342248094
MATLAB
2,461
63
% EXPERIMENTSMANAGER Goes through the input and output directories % Detailed explanation goes here % % First, get the experiment numbers function [experiments,crops,keypts,registrations,cell_detections] = ExperimentsManager() loadExperimentParams; % filename = fullfile(params.INPUTDIR,sprintf('%sround%d_%s.tif',...
dce6ce62f8b1fbc084d40d91ac29c4b6a8eda77b59b1d58aaa88e0b84ce99b17
MATLAB
2,462
72
% PhotoreceptorModelLinWrapper % % Purpose: % Evaluates the fit of a linear model to the response of a photoreceptor. % Used in optimization routines to find the best-fitting linear model parameters. % % Input: % coef - A vector containing the coefficients of the linear model. % coef(1) - Scaling factor ...
40d3c58200755f3ef81d400e173cf0d6d7e429f3436202b10fe3ded840c01051
MATLAB
2,463
81
function [A,Wout]=mkfilt_eloreta(L,regu,W); % makes spatial filter according to eLoreta % usage A=mkfilt_eloreta(L); or A=mkfilt_eloreta(L,regu); % % input L: NxMxP leadfield tensor for N channels, M voxels, and % P dipole directions. Typically P=3. (If you do MEG for % a spherical volume cond...
96bd27def51a03bff37ab00ccfa740d2ed76fa81df730748af240383b03a77c6
MATLAB
2,463
75
function [Tmatches, setts] = TrajPlotPars(type,animal) if type==1% CorrIncorr, All Correct, active stimuli setts{1} = 1:2; setts{2} = [1 2 7 8]; setts{3} = 7:8; setts{4} = [1 2 7 8]; setts{5} = 1:2; setts{6} = 7:8; elseif type==2% Cross-modulated setts{1} = 13:16; setts{3} = 17:20;...