sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b47027dd3394929c94f845e226ab0fc13bf535309b13b118649e42c98b6ca30e
MATLAB
2,238
72
function field = field_convert(inputField,dims) % FIELD_CONVERT Converts cell field to matrix field and vice versa % % field = field_convert(inputField,dims) % % inputField - Field to convert % dims - Number of dimensions % field - Converted field %{ Copyright © 2011 by Université catholique de Lo...
6e94d7c92656a8cbe41b81ba402f6bdfb8daa1d84a186a67bfc0020331fe40c2
MATLAB
2,239
86
% function [L weights] = CrossValidationPeerCheck(S,Q,ep) function [L,weights] = CrossValidationAssemblyPrediction_Cells(Starget,Qtarget,Sref,Qref,angBin,ang,ep,lambda,bins) nbEp = 10; epV = regIntervals(ep,nbEp); fprintf('Launching Cross-validated Peer info\n') nbC = length(Starget); nbCref = length(Sref); dQ = Dat...
bc7412c169bb546a5249aa55b2fd8bdfa7d93906416a39e8040d88a291ef72ad
MATLAB
2,239
59
function links=gap_closer_s(segmentlists_time,segmentlists,max_interframe_distance,max_gap_closing_distance,spots_s,voxel_size) xy_ratio=voxel_size(1); z_ratio=voxel_size(3); % time matrix segment_start_times=cellfun(@(cell_variable) cell_variable(1), segmentlists_time); segment_end_times=cellfun(@(cell_variab...
5e0802aea0a9db3dae5477d23d2d8a4d81e01a5c2a5f86d9130aa36fd2bb24a1
MATLAB
2,248
49
function [anterdir,posterdir,dorsaldir,ventraldir,leftdir,rightdir]=apdvlr_axes_2(coords,guess,scale_factor,str, normal_vector,chosen_point) midpoint=mean(coords,1,'omitnan')'; [coefs,~]=pca(coords); dorsaldir_counter=0; for i=guess(:)' dorsaldir_counter=dorsaldir_counter+dot(midpoint,normal_vector)-dot(normal...
7dd680b1a3666420ab3ea0cee6d9950e417295307dcf3e34ee10f2cb0234eaa2
MATLAB
2,248
66
function [subj new_objnames group_mat] = duplicate_group(subj,objtype,old_groupname,new_groupname) % Duplicate an entire group % % [SUBJ NEW_OBJNAMES GROUP_MAT] = DUPLICATE_GROUP(SUBJ,OBJTYPE,OLD_GROUPNAME,NEW_GROUPNAME) % % Calls DUPLICATE_OBJECT on each object in the group, renaming them % based on the NEW_GROUPNAME...
a81f540b9dba2ff2f7051caca8dc4f402e6d593e943f84581553b69a89dccdd9
MATLAB
2,248
90
function ss = sumsOfSquares(y,groups) ss.total = var(y)*(length(y)-1); tot_mean = mean(y); % Design Mat levels_a = unique(groups{1}); levels_b = unique(groups{2}); DFa = length(unique(levels_a))-1; DFb = length(unique(levels_b))-1; N = length(groups{1}); X = nan(N,DFa+DFb+DFa*DFb); first_ind_a = 1; first_ind_b = ...
ab6deab2e6bc0873f9c9b70d63986292c9f363c79249cc5c95f491a69858e809
MATLAB
2,249
79
% Description: % Computes the inverse of a symmetric matrix using the cholesky % decomposition and compares the runtime to that of the standard inv % function. % % Author: % Eric Blake % Black River Systems Company % blake@brsc.com % 05/14/2012 % Compile the MEX file. clc; disp('C...
ed82fa30a91658d7e4395254c38ecca1e098a9bd331c34b57ba8b66055497c5f
MATLAB
2,252
109
function X = gaussFilt(X,N1,varargin) % Xsm = gaussFilt(X,N1,N2) % % 1 or 2-d gaussian filtering with border correction % Input: % X: vector (or matrix) to smooth % N1: sd of gausswin for the first dimension. If N1==0, no smoothing % N2 (optionnal): in case of X is a matrix, sd of smoothing on the 2nd dim...
1dbd2a5730b026c94dccb57d8343ca107db64996e685cb481007662e50556506
MATLAB
2,256
83
clear [task_info,supPath] = loadDBAndSpecifyDataPaths('Vermis'); SD =15; raster_params.time_before = 350; raster_params.time_after = 800; raster_params.SD = SD; raster_params.smoothing_margins = SD*5; corr_window = raster_params.time_before + (50:250); req_params.grade = 7; req_params.ID = 4000:6000; req_params.re...
8a3f932908e0facc6ee6c5301e23f78ab9aa34532d369fc2fd174cd99181a16b
MATLAB
2,259
83
% % X is #time points x [HbO/HbR/HbT] x #channels % dc.dataTimeSeries is time x channels % When dealing with DWT, almost never deal directly with wavelet and % support functions, only need high and low-pass filters and input % signal function WX = calcDWTMatrix(X) % X = ones(2^10,1); % Let matlab takes ca...
6093ba7bd5e6aaa51f82673d6a1a7cfb2be7e6719ed59d4b0e0011c6ab68ee7e
MATLAB
2,260
78
function [errmsgs warnmsgs] = unit_statmap_mitchell() % USAGE :[ERRMSGS WARNMSGS] = TEST_STATMAP_MITCHELL() % % This is a script that tests the mitchell voxel selection method. % % ERRMSGS = cell array holding the error strings % describing any tests that failed. If this is empty, % that's a good thing % % WARNMSGS =...
167daa53dc4ae6b33cad54e31339438bbe82593f582d3564972795a3fe774416
MATLAB
2,262
106
function A = PhasePrecess(A) % A = getResource(A,'PfcThetaPhase'); A = getResource(A,'HcThetaPhase'); A = getResource(A,'StartTrial') startTrial = startTrial{1}; A = getResource(A,'TrialOutcome') trialOutcome = trialOutcome{1}; % A = getResource(A,'PosYS'); % YS = YS{1}; % A = getResource(A,'PosPhiR'); % phiR...
91d7955c0903b778d865ab071f02d88b59cf4ba5aaeedd90bb33119e7f944279
MATLAB
2,262
70
classdef PopulationPsthDistanceClassifierModel < ClassifierModel properties psthMap SD = 30 smoothingMargins = 300 end methods function mdl = train(mdl,X,y) psthMap = containers.Map('KeyType','double','ValueType','any'); classes = un...
eede9d92a405eb76911ab226e1c68ac6b00107aff2ebd7fdcff3700ac637df4a
MATLAB
2,267
80
%DEMGAUSS Demonstrate sampling from Gaussian distributions. % % Description % % DEMGAUSS provides a simple illustration of the generation of data % from Gaussian distributions. It first samples from a one-dimensional % distribution using RANDN, and then plots a normalized histogram % estimate of the distribution using ...
12533bf4a12383ab5342ceb888aa0e311c775094203a06c6d2d83f5ec020d537
MATLAB
2,270
79
function K_out = updateK(B, I, S, Kb_eye, Kb_pc) % Update all the relevant things in the K structure given a new set of eye % and PC weights (concatenated) K_out = []; K_out.dt = B.dt; K_out.p = I.p; Kb_eye_pc_new = [Kb_eye(:); Kb_pc(:)]; % Default values from optional inputs K_out.EH = []; K_out.EP = []; K_out.PH ...
aeea4939bad10efd2ee973180c17732f562ed46ff49fba6ac14f413c3b3f7540
MATLAB
2,271
93
clear [task_info,supPath,~,task_DB_path] = loadDBAndSpecifyDataPaths('Vermis'); EPOCH = 'cue'; PLOT_CELL = false; ONLY_TIME_SIG = false; req_params = reqParamsEffectSize("pursuit"); %req_params.cell_type = {'PC cs'}; %req_params.ID = 5666; lines = findLinesInDB (task_info, req_params); cells = findPathsToCells (s...
946b4026a404c9c59fa5b4c5eaa29ad8229d142004f3a5d7410755b7c0321cf1
MATLAB
2,272
61
function info_calc = computeMLEFieldInfo(eps_vals, eta_vals, J_i, n_obs) % Computes the infromation between the MLE estiamte of the field value h % and the true value h for conditionally independent spins coupled to h % through the hamiltonian H = eta*J*s + eps*s. % % Inputs: % eps_vals: vector of epsilon values...
1318c59a9ea8ae3b8a2c457916ef92c44803b588294d21c743951202c48db40d
MATLAB
2,273
72
clear all supPath = 'C:\Users\Noga\Documents\Vermis Data'; load ('C:\Users\Noga\Documents\Vermis Data\task_info'); req_params.grade = 7; req_params.cell_type = 'CRB|PC ss'; req_params.task = 'saccade_8_dir_75and25'; req_params.ID = 4000:5000; req_params.num_trials = 100; req_params.remove_question_marks = 1; raster_p...
6ae21b67751cda9a7d3b4fad74b03801125999a5ab6e1ccb896e3d07e1b27929
MATLAB
2,273
60
%% Main Script walking through the steps for EEG analysis (Project: PT_EEG) % belongs to manuscript "Neural correlates of perspective-taking in 4-year-olds" %Run the Initializing Script to set variables and parameters cd 'D:\PT_EEG_Analysis\' % specify location of EEG scritpts Initializing_Script_PT_EEG(); %% ...
728529e35a359393c8ca70213f5f0109d2cb826359cadff5a974ff4c8e6fa61c
MATLAB
2,273
56
function beh_file_generation(beh_input_path,N,output_path) %% loading data disp('=================================================================='); fprintf('covariate files preparation\n'); % load behavior data beh_meas=readtable(beh_input_path,'sheet',['Stanford_cohort_' N]); %% data preparation numopt_mathres_v...
a621d016a58d24c42bc296ff4fab7df4bdefa88f5fd493c8d377a841f80efbd4
MATLAB
2,278
77
clear all; addpath('/Volumes/LASA/TBI_OpenNeuro/TBI_openneuro/timeseries/inputs/'); addpath('/Volumes/LASA/TBI_OpenNeuro/Shared_code/Hopf_TBI_ON_personalized/'); load schaefer_MK.mat; load tseries_openneuro_tbi_tp123_sch1000.mat; % Load your data % Parameters of the data TR=2; % Repetition Time (seconds) NPARCELLS=10...
2386065778c9dd7ace36cede7bee32ebc3ce0dbb86c648af7f586389aa9e94ba
MATLAB
2,280
71
function t_points = out_of_sample_est(points, X, mappedX) %TRANSFORM_SAMPLE_EST Performs out-of-sample extension using estimation technique % % t_points = out_of_sample_est(points, X, mappedX) % % Performs out-of-sample extension using estimation technique on datapoints % points. You also need to specify the or...
559617e5f159f6f5c028bb2ca8158ae098d693c69e444c2eeabffe4bf3348e4f
MATLAB
2,280
76
% SURFACEOBJECT = FILLBULLSEYE(varargin) creates a % wedge "patch" using xdata/ydata from a polar plot. The color of the patch % is determined scaled by the value of the vector. To be used with % createBullseye. % % % varargin can take the following inputs: % -cdata,rho1,rho2,theta1,theta2 % -cdata (assume...
840c8d0e991e84e5d9ff7911d11e70ff949acc0ada4e1ebc8770b17426ef9129
MATLAB
2,281
69
function test_suite = test_parse_filename_prefix %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> catch % no problem; early Matlab versions can use initTestSuite fine end initTestSuite; end function test_prefix() filename = ...
dc984557b013081ed038a6b1b092f46385ed33e708848dae7398b72ff56e9e23
MATLAB
2,281
79
function [subj] = blur_pattern(subj, patname, fwhm, varargin) % BLUR_PATTERN - Spatially blurs a pattern. % % Usage: % % [SUBJ] = BLUR_PATTERN(SUBJ, PATNAME, FWHM, ...) % % Spatially blurs a pattern by 3D convolution with a Gaussian % kernel with Full-Width Half Max of FWHM voxels. FWHM is % not restricted to integers...
48bb0aad47cc5f1427786740634942dac7328d06540854eada6ea04ef8a17da5
MATLAB
2,282
73
% IIRFILTFILT filter a signal using a double N pole butterworth. % % call Y = iirfiltfilt(X,Fs,flp,fhp,N,band) % % XF = IIRFILTFILT(X, FS, FLP) % XF = IIRFILTFILT(X, FS, [], FHP) % XF = IIRFILTFILT(X, FS, FLP, FHP) % XF = IIRFILTFILT(...,N) deter...
af1cb665b0d1410945268aae4b748e349fdd540f2356605c810cb2bdbb9f1ee9
MATLAB
2,283
40
function [ peak_frames, peak_dFFMax, peak_latency ] = Peaks_3STD( dFF_trace, uncaging_frame, SecPerFrame, num_std, peakthresh, MinPeakWidth) %Peaks_3STD finds peaks that are >= 3std above the baseline mean, and %records the frames and the amplitude of these peaks, split into those %peaks that occur before and after ...
2730dea01269b409c5d97198198dfa94d5c159f5277d1b48f00439c90d12d0b0
MATLAB
2,284
81
function [ annulus ] = createAnnulus( n, r, w ) %createAnnulus Create a binary annular mask % % INPUT (all optional) % n - size of the annular mask as a scalar, or vector with coordinates % r - radius of the annulus in pixels % w - width of the annulus in pixels % % OUTPUT % annulus - n x n matrix with the ann...
56ccb2c7c8e16bd9a4aed908ced85d1d8b87db16ee4652eff2445f16ea4cfcab
MATLAB
2,284
74
% Run this script after scriptSetupML, it will connect to jupyter, copy % files and can terminate the instance %% Inputs id = ''; dns = ''; origPath = ''; % Where this instance data started from %% Jenkins if exist('id_','var') id = id_; end if exist('dns_','var') dns = dns_; end if exist('or...
aece41776cedc2fea5fd798ba7711041545f57e0500d670f3fe4ce5cd9a1175c
MATLAB
2,285
67
function PlotClusterTrackMovie(movieExportFolder, fileName, image, tracks, trackColors, pxPerMicron, secBtwFrames) close all %% Parse inputs fullIdxList = unique(tracks(:, 4)); pointSize = 40; lineWidth = 2; numMicrons = 10; %% Initialize % Initialize figure h = figure; g1 = imshow(image(:, :, 1)); hold on; set(h, ...
19dbe2b2bb920b001f29e16b4b95bfdac84a0c286babb0ae71105b36a8ac351a
MATLAB
2,287
67
function layer = dropoutLayer(probability, NameValueArgs) % dropoutLayer Dropout layer % % layer = dropoutLayer creates a dropout layer that randomly sets % input elements to zero with a probability of 0.5 during training. % During prediction, the layer has no effect. This can help prevent % overfittin...
cb8aa6d5557ab8d270e7136c80d03b6dcc142088212df1cd319e0983cdc73ce9
MATLAB
2,288
55
function vidObj = msCalcSegmentRelations(vidObj,calcCorr, calcDist, calcOverlap) %MSCALCSEGMENTRELATIONS Summary of this function goes here % Detailed explanation goes here if calcCorr segCorr = zeros(vidObj.numSegments,vidObj.numSegments); end if calcDist segDist = zeros(vidObj.numSegment...
bb24e5409ae1cd203bf3516e167078e40f281b6ef2d16768de1e95fab5cc9048
MATLAB
2,292
47
function [anterdir,posterdir,dorsaldir,ventraldir,leftdir,rightdir]=apdvlr_axes(coords,guess,scale_factor,str,ant_dx) midpoint=mean(coords,1,'omitnan')'; [coefs,~]=pca(coords); dorsaldir_counter=0; for i=guess(:)' dorsaldir_counter=dorsaldir_counter+dot(midpoint,coefs(:,2))-dot(coefs(:,2),coords(i,:)); end d...
9f384e0b5b6a7c2e5d11da854ae83065c80a70d75fb95243443c8e3de221ae9a
MATLAB
2,295
84
function stats = posthocVARfromData(data, net, estStates, sortFlag, nIter, p_ref) if nargin<5 nIter =100; p_ref = 0.01; end if nargin<6 p_ref = 0.01; end K = length( net.ARmodel); M = size(data{1},1); VBprior.ao = 10^-3; VBprior.bo = 10^-3; VBprior.no = M + 2; VBprior.Wo = 10^3*eye(M); noSubjs = le...
735dc254693630cbee72824db2c01dd556460ece1200f3074c182111167aa80b
MATLAB
2,296
82
% Simulate data to examine effect of noise correlations in populatin of neurons % % addNoiseCommon: add noise correlations % NperGroup: number datapoints per group % Ngroups: number of groups/classes. Default is =2, can also accomodate =3. % addNoiseSignaldependent: 0 no, 1 add signal dependent noise % function [data, ...
02804e3db1b99671b090dc3326e6379ab98edb56c629226bea0a64a258eb8bb9
MATLAB
2,298
81
function d = estimate_disparity(leftim, rightim, kernelsize1, sigma1, ... kernelsize2, sigma2, dmax) % D = ESTIMATE_DISPARITY(LEFTIM, RIGHTIM, KERNELSIZE1, SIGMA1, ... % KERNELSIZE2, SIGMA2, DMAX) % % Estimate disparity from a stereo pair, using the algorithm described % in section 7.3 o...
617c674cf16162b7f4105ba651264841ca321f74ab5d83e68992283c90a18166
MATLAB
2,298
71
#import "UnityAds/UADSPurchasing.h" #import "UnityAdsPurchasingWrapper.h" #import "UnityAdsUtilities.h" static UnityAdsPurchasingDidInitiatePurchasingCommandCallback iapCommandCallback = NULL; static UnityAdsPurchasingGetProductCatalogCallback iapCatalogCallback = NULL; static UnityAdsPurchasingGetPurchasingVersionCa...
50232e242a8b23e485a18ddc978ef261b1652984f7ec01f369ab2f76fb06ba10
MATLAB
2,299
68
function [X,y] = simulate_regression_data(typ, nsamples, nfeatures, scale) % Creates univariate regression data. % % Usage: [X,y] = simulate_regression_data(typ, nsamples, nfeatures, scale) % % Parameters: % typ - defines the relationship between predictors X and % response variable y...
80e0606efb2b4c8bea3e231d35d8d27c39e775af720af535c80a8ba9de09753b
MATLAB
2,299
72
function [scratchpad] = train_corr(trainpats,traintargs,in_args,cv_args) % Correlation-based classifier % % [SCRATCHPAD] = TRAIN_CORR(TRAINPATS,TRAINTARGS,IN_ARGS,CV_ARGS) % % See the related TEST_CORR function that gets called % afterwards to assess how well this generalizes to the test % data. % % Doesn't calculate ...
ee004d6e6e360cb588124ca98340ca027f6b6b23bfd8fb382ecf987befb4cba1
MATLAB
2,301
53
% function make_design_alldata(cfg) % % Function to generate design matrix with all data as training and test % data. This is useful e.g. for creating a weight map from all data. Please % remember to set cfg.design.nonindependence = 'ok' % % IN % cfg.files.chunk: a vector, one chunk number for each file in % ...
a8fe7b324692ccf2198e0c899f46a46a34a01af991fe5d8052901aad319c6950
MATLAB
2,302
78
function [Ty,diff,CI,da,db,df,p]=yuen(a,b,percent,alpha) % function [Ty,diff,CI,da,db,df,p]=yuen(a,b,percent,alpha) % % Computes Ty (Yuen's T statistic). % Ty=(tma-tmb) / sqrt(da+db), where tma & tmb are trimmed means of a & b, % and da & db are yuen's estimate of the standard errors of tma & tmb. % Ty is distributed ...
30bea7aa1eeab833d259f3383b832d225f455766ef02b5acb91f30c4d37eac34
MATLAB
2,303
73
close all; clear all; clc; Act = @(MaxAmp, Alpha, Tau_r, Tau_f, t) MaxAmp * Alpha * (exp(- t/Tau_f) - exp(- t/Tau_r)) /(Tau_f - Tau_r); % Act = @(MaxAmp, Alpha, Tau_r, Tau_f, t) MaxAmp * Alpha * (exp(- t/Tau_f) - exp(- t/Tau_r)); SamplingRate = 1000; % times per second % T = (0:TimeLength-1)/SamplingRate; T = -1...
ca0f7a2c84253f6aa02bb2152350b24d6e7d276a40f66e0a0554331c83543314
MATLAB
2,303
60
% redefine stimulus classes into 6 diff. classes % to be runned after generating stimuli marks from aux data in Homer3 GUI % Combined multiple snirf files into one. % strictly for ExperimentXXGUI folder % Only 1 snirf file function redefineStimulusClasses_MultiOnly(sbjNum,rawDataFN,respData) dir = ['C:\Users\mn0mn\Do...
fcfccd837be481e65fdce6ac01ecd6a9c374864b9f916f53758f324ffcf4da92
MATLAB
2,306
59
for s=1:length(subject_list) for trltype = 2 trodes=[]; G=[]; H=[]; looping_CSD_final=[]; subject = subject_list{s}; fprintf('\n\n\n*** Processing subject %d (%s) ***\n\n\n', s, subject); % Load the componen...
cf66e52383e491674928c4e4972daf17c6207b8df854fa927cadcdf58a7c0ace
MATLAB
2,309
79
%% 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); hinf = zeros(1, l_V); tauh = zeros(1,...
4fb13492cb260c8352c427f67458127cde0a3e0821804cdad32fe9c0781fcd99
MATLAB
2,312
51
%% Supplemental CODE for CSFpulse calculation from EPI fMRI data % Kim, J. H., Im, J. G., & Park, S. H. (2022). Measurement of CSF pulsation from EPI-based human fMRI. Neuroimage, 257, 119293. % % The data type can be either nii or Nifti. % These codes are running based on Matlab 2020a. % Manual processes are need...
a34f89308323a60f48cf3ee4a2131ba1ee4c52f996daaeefbef566f6b2820a5f
MATLAB
2,316
69
function [data, mask] = load_raw_data_masked(p, sub_id, mask_only) % function [data, mask] = load_raw_data_masked(p, i_sub, mask_only) % % Load (realigned) raw data, masked with ROI. % Uses an adapted version of spmReadVolsMasked.m from the cvmanova toolbox % by Carsten Allefeld, accessible at % https://github.com/all...
c3ef248d91407f6cb4fe488eb753388d13e5f8ad23f7a884f41b648faabf834f
MATLAB
2,316
28
%Fetches mni coordinates for all contacts across subjects that are within %subregions of interest (contrast of 2 broader regions), with their flicker response amplitude and %significance. %Requires structure subject to have fields .anat, .flickerneuro_ssep_amp_val %and .flickerneuro_ssep_amp_sig. function [mat1,mat2,m...
3169e10e00b5b8d0c4efa74519e26bd605e9478ba9d921413ac91c8d7c9cfc2e
MATLAB
2,317
67
function plotFilterFreq(K, hf, cs) if ~exist('hf','var') hf = figure; else figure(hf); clf; end f = [0.5 1 2 3.33 4 5 8 10 12.5 16.6700 20. 25. 32.5000 40 50]; xlims = [0 0.05]; if ~exist('cs','var') cs = {'b','k','r','c','m'}; end sHandle = gobjects(4,3); for k = 1:12; sHandle(k) = subplot(...
991002eea8a4bda98decc56065ebbce07e0205e6942d4b891c731b7034b6c65c
MATLAB
2,317
80
function [corrected_data, sigmas,dn, times, Mcorr] = SOUND_veryfast(data0, LFM, iter,lambda0,sigmas, estimate_just_noise) % % This function performs the SOUND algorithm for a given data based on beamforming filtering, which provides a very fast implementation % % input: % data: channels x time points x trials (not...
df01bc1f83b6288ab5bb24ba51e8bd2b7f6e97749d5cc3c9871f2f205853cce5
MATLAB
2,317
88
function [no,xo1,xo2] = hist2(y1,y2,x1,x2) %HIST2 2-D Histogram. % [N, X] = HIST2(Y1,Y2) bins the elements of Y1 and Y2 % into 10x10 equally spaced containers % and returns the number of elements in each container. If Y1 and Y2 are % matrices, HIST works down the columns. % % N = HIST(Y1,Y2,M,N), wh...
56b44621576082fe546bdf616f2ac59bf39f697e29d846415144ec31e48d2045
MATLAB
2,320
75
function [err,Eq] = Plane_Equation (Triplets, verbose) % % [err,Eq] = Plane_Equation (Triplets, [verbose]) % %Purpose: % Determine the equation of the plane passing through three points % % %Input Parameters: % Triplets is an Nx1 vector of strucutres. Each structure defines a plane % .XYZ : is a 3x3 matr...
7dc72d664113cb700b001085919c0b3ca4d94d9b767c309e95cae821983bef41
MATLAB
2,320
65
% Collect general section statistics %% Inputs datasetTag = ''; % Which dataset tag to load? Will load the latest unless specific date is writen in tag isGroupBySubject = true; % Would you like to group results by subject %% Load st structure [datasetPath, datasetName] = s3GetPathToLatestDataset('10x',datase...
91b628a3242a965c6c509eb91edfdd8bd3ff032d5d6414e0a45f1af236396593
MATLAB
2,320
63
function [Vectors, Av_Vector, AngleDiff] = Initial_Vectors(Traj_in, radius,Target_Angles, Animal, TargetNum, merge) % calculates the initial vector and average initial vector of Trajectories % input should be trajectories truncated at specific radius % inputs Target_Angles and TargetNum are needed to calculate th...
92141e0319b3bff5a5a25112ba05d13912303ea14b884f54f160565d801e3489
MATLAB
2,321
86
function [fh, rasterAx, histAx,matVal] = ImagePETH2(S, center, TStart, TEnd, varargin) % Display a PETH-like plot for continuous variable such as EEG % Uses RasterImagePlot2 % Adrien Peyrache 2007, adapted from Battglia font_name = 'Arial'; font_size = 10; font_weight = 'bold'; line_width = 2; figure...
54109658624c5b53b2f765c28e3ea449918aad97a8cce746a5ceafd29df40378
MATLAB
2,323
63
% redefine stimulus classes into 6 diff. classes % to be runned after generating stimuli marks from aux data in Homer3 GUI % Combined multiple snirf files into one. % strictly for ExperimentXXGUI folder % Only 1 snirf file function redefineStimulusClasses_AVCA() dir = ['C:\Users\mn0mn\Documents\ResearchProjects\spata...
5b5ebec3aba3e65f36b481cf7cf724c82498e4039fff366c1904136a21a3f1cf
MATLAB
2,323
81
%% 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); ninf = zeros(1, l_V); taun = zeros(1,...
60addadc6e601436b96fc20d57bab267b061b774c0aaced2cf433796526ebca9
MATLAB
2,330
61
function DistributionSingleCellOverTime(histExportFolder, histDataFilename, relMat, diffIm, magMat, angMat, dataBinWidth, relThresh) %% Calculate Histogram Data % Set mainFlowMask mainFlowMask = ... double(relMat > 0).* ... % Where the relMat is > 0 double(diffIm > 0).* ... % Where the diffIm is > 0 do...
6f03360aca907916b7197234475c8fb909171bbf4a0c75a9d5be2d0a8ac516a6
MATLAB
2,331
102
factor=1 %% load("neurons_by_hand.mat"); load('neurons_reconstructed_max_2_e.mat'); s1=size(hand_e,1); s2=numel(neurons_reconstructed_max_2); guessed=zeros(1,s1); taken=zeros(1,s2); sizes=12; TP=0; FN=0; FP=0; minimum_distance=sizes.*factor; for i=1:s1 current_neuron=hand_e(i,[3 2 4]); best=3...
0e7e1d3d99d066fdb5d733d4c5e8629ab3627b30622506fe5b7afc9bde2dc22a
MATLAB
2,332
77
function a = gmmactiv(mix, x) %GMMACTIV Computes the activations of a Gaussian mixture model. % % Description % This function computes the activations A (i.e. the probability % P(X|J) of the data conditioned on each component density) for a % Gaussian mixture model. For the PPCA model, each activation is the % condi...
97e92fda59094f8ee9ee00cdb562531c497ddfddb956e9bedc234c759332e308
MATLAB
2,333
83
%-Configfile for preprocessfmri.m %- for spm 12 %__________________________________________________________________________ paralist.spmversion = 'spm12'; %-Please specify parallel or nonparallel %-e.g. for preprocessing and individualstats, set to 1 (parallel) %-for groupstats, set to 0 (nonparallel) paralist.paral...
eca47732b42f530525fe5c7cbf96aa3bfd7e8f45b11190bdd3f2f78620f4a89f
MATLAB
2,333
81
clear all close all format compact clc % script to calculate the statistics for each scan given this will currently only run if distances have been measured % for all included scans (UsedSets) [dataPath,resultsPath]=getPaths(); MaxDist=20; %outlier thresshold of 20 mm time=clock;time(4:5), drawnow method_string='T...
0b9601213eadcaad9c73bd3f3598c51c67d5e9958b38faa1aeb1c23adfba76b3
MATLAB
2,334
75
function mr_fmontage_vga(anat,func,mask,slices) % functional montage superimposed on anatomical montage % License: %===================================================================== % % This is part of the Princeton MVPA toolbox, released under % the GPL. See http://www.csbmb.princeton.edu/mvpa for more % informat...
9d0500ac15e60487f59357e323b7af13973be1baf90978bfe6a66c3a0ca2687b
MATLAB
2,336
67
function [r,T] = mvnrnd(mu,sigma,varargin) %MVNRND Random vectors from the multivariate normal distribution. This is an % open source version that emulates a subpart of the behavior of the same % name function from the MATLAB stats-toolbox. % It emulates the 3 input, 1 output argument MATLAB-version, % where ...
e1dc4988e5d491ce81f6497b6a022d68ba6f3bb718991241bb1e3407d6cec9ac
MATLAB
2,337
43
function protocolset = xMakeAnalogwaveformtabs(destinationpath) % Make Analogwaveform objects using info from an excel file. % See excel file specified below (path_in) for how to setup such a file % -----------------------------------------------------------------------------------------------------------...
6e99b2537fbfe81509e3a960fc73e73e590281c325dc7bbc36e639638d70293f
MATLAB
2,339
49
%Performs PSD analysis for all trials in a flicker session, and saves data. %2024/02/25 function PSD_results=run_PSD_flicker(data,trials) %initialize PSD_results variable: PSD_results.label=data.label; PSD_results.condition=repmat({''},1,length(trials.condition_code)); % Reformat data into chronux...
bb37eff19d5ef3e92a5673ba929779c19c04c7e835408e4db3457d7ffb38c57d
MATLAB
2,339
85
%% Generates the initial ms data struct for data set contained in current folder ms = msGenerateVideoObj(pwd,'msCam'); % Newer versions of the Miniscope system do not require Column Correction. % If this is the case for you still run msColumn Correction() then run the two lines of code below it. ms = msColumnCorrecti...
9e983d39d79a5d6426012aa8273175f6e528c1a45f2e58fc10b07b26b51abbc5
MATLAB
2,342
62
%{ 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...
efeb161c282c890308d68f5583969144b8a0acbea7077dba4fda037990974182
MATLAB
2,343
73
% % [Sin,SNin] = Sin_vsh_ctf(r_sphere,R,EX,EY,EZ,Lin) % % Calculate the internal SSS basis Sin for a CTF system % using vector spherical harmonics % function [Sin,SNin] = Sin_vsh_ctf(r_sphere,R,EX,EY,EZ,Lin) % Copyright (c) 2016, Elekta Oy % --------------------------------------- % % Redistribution and use of the Sof...
4bad813084084cd4a91fa497f3d8410a108d119be0a5daeaedb8bc587ca721e5
MATLAB
2,344
76
function [bfca_cv, voxel_cv, fwhm_cv] = pSVR_nested_cv(all_results, p) % function [bfca_cv, voxel_cv, fwhm_cv] = pSVR_nested_cv(all_results, p) % % Perform nested cross-validation to determine the optimal voxel-number and % feature-space smoothing FWHM value for each participant, based on the % results of all other pa...
83047780d22c21737503b5ab3e3c97a0f97bae79c46b7cd170ac2621dc0ffc92
MATLAB
2,346
63
function [fx] = f_Hampton(x,P,u,in) % Hampton's "influence learning" model: evolution function (Hide and Seek) % function [fx] = f_Hampton(x,P,u,in) % Hereafter, the learner is referred to as the "agent", whereas her % opponent is referred to as the "other". % Let p=P(o=1) be the agent's prediction of the other's next ...
5f0631330144ed8d0a30ec8495875daee760f5cc7e10108523708c674a82559b
MATLAB
2,350
76
function [perfmet] = perfmet_for_class_corr(acts,targs,scratchpad,args) % This is the performance metric for the correlation classifier % % [PERFMET] = PERFMET_FOR_CLASS_CORR(ACTS,TARGS,SCRATCHPAD,ARGS) % % For each test brainstate, find the training brainstate that's % most similar. The guess is the category of that ...
4e30711067bea074adac3fb4660f92c4181b618e44e7d694721f1ba91f123525
MATLAB
2,351
100
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. % Drea Thomas 6/15/95 drea@mathworks.com % Warning: If the figure or axis units are non-default, this % w...
87da4afed412a536ca736350ed727b149c95ae8c4467a2f43204a8cb175b19a4
MATLAB
2,354
81
% This initialisation is need to run this function in stand alone mode clc;clear all;close all; data_prefix = 'M89971_20210723_sess11_rec6_SWE'; rawdata_folder = 'E:\NAS_SD\SuiviClient\Triffilieff\AnnaRoman\DataAnna_Baseline\M89971'; analysis_folder = 'E:\NAS_SD\SuiviClient\Triffilieff\AnnaRoman\AnalysisAnna_Baseline\M...
773d10ab7e69fefbbc3319e4c3eae84cedeb37d0ffafe045223bcfc57911b7da
MATLAB
2,357
98
function [tmd] = triggeredMeanData(tsa, events, tmax, varargin) % Event-triggered mean of the Data component, triggered on events (TODO) % % TODO: Overlap wth the ETAverage function. Need cleaning % % USAGE: % [tmd] = triggeredMeanData(tsa, events, tmax, options) % % INPUTS: % tsa: a tsd object, assumed to...
c4ad0320f831e8c1d731f062efbbeec0f269348b97bb0df9369f1f5932dccb2c
MATLAB
2,357
50
function [randomizedConditions, randomizedIndeces] = randomize_conditions(conditions, numberOfTrials) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Based on 'conditions', create output of length 'numberOfTrials', which is % composed of the randomized elements of 'conditions' with the co...
b31a65e557c2697ae4fd50b4a7df8fd65b0ea4f0fd884ff87d140c2ffd7c6cf4
MATLAB
2,360
95
clear [task_info,supPath,MaestroPath] = ... loadDBAndSpecifyDataPaths('Albert behavior before recording'); PROBABILITIES = 0:25:100; req_params.task = 'pursuit_8_dir_75and25'; req_params.num_trials = 50; req_params.remove_repeats = false; behavior_params.time_after = 1000; behavior_params.time_before = 0; behavi...
9821f0a88e2fc026eb178b7af3863f42d81cbb2c2eb52dff42751c41c6be115e
MATLAB
2,361
79
% PCA OF BEHAVIORAL DATA % % % % Authors: Rafael Naime Ruggiero, 2021 %Load data matrix load('Matriz_corr.mat') %Zscore data matrix Xz = nanzscore(X,2); %Reordering the matrix. Xz = Xz(:,[2,1,3,4,5,6]); %PCA [coeff, score, latent, tsquared, explained, mu] = pca(Xz); coeff(:,1)=coeff(:,1)*-1; ...
5d47d6866cb3ee0a15cfe1f9c5284a6099fc6574f39954a097dc91cb283e1f19
MATLAB
2,363
80
function create_rois_from_prob_maps(p, roi_name) % function create_rois_from_prob_maps(p, roi_name) % % Creates binary region of interest (ROI) masks from probability maps % published by Wang et al (2015). The set of probability maps can be % downloaded from: % http://scholar.princeton.edu/sites/default/files/napl/fil...
5c2f3c93b4e3693eb2318411cc71e13bcc2a0681508fce254e04f2b55c9fa664
MATLAB
2,364
49
addpath(genpath('/dagher/dagher11/filip/Software/BrainSpace-0.1.2')); addpath(genpath('/dagher/dagher11/filip/Software/gifti-main')); addpath(genpath('/dagher/dagher11/filip/Software/netneurotools')); addpath(genpath('/dagher/dagher11/filip/Software/neuromaps')); addpath(genpath('/dagher/dagher11/filip/Software/nifti_t...
a5d691111f62427fdbb12242b7b0584715f8e556f6689bd1b73a2a7a7d72a450
MATLAB
2,365
80
function [Ty,CI,diff,se,df,p]=yuend(a,b,percent,alpha) % function [Ty,CI,diff,se,df,p]=yuend(a,b,percent,alpha) % % Computes Ty (Yuen's T statistic) for two dependent groups % Ty=(tma-tmb) / sqrt(da+db), where tma & tmb are trimmed means of a & b, % and da & db are yuen's estimate of the standard errors of tma & tmb. ...
821a5b0b523047b9a2a682142d6c22c00c4a1e8f06a9749e4f0f90931b486649
MATLAB
2,367
66
function ellipse=fit_ellipse(XY) % ellipse fitting of data points XZ = [:,2]. % Output of the function is a struct with the ellipse parameters % [xc,yc,d1,d2,phi] and a list of xy values for plotting the result. % This ellipse fit was proposed in article % A. W. Fitzgibbon, M. Pilu, R. B. Fisher % "Direct Le...
2cab44d9d00cea78ef69bc2fc69c1e4e1fca3116fcc4f7707990e073f842a16b
MATLAB
2,368
48
% Check if variable Exclusion_Info exists already. If yes, load it. if exist([output_dir output_specific 'Exclusion_Info.mat']) == 2 load([output_dir output_specific 'Exclusion_Info'],'Exclusion_Info'); end for s=28:length(subject_list) subject = subject_list{s}; fprintf('\n\n\n*** Processing subjec...
cc2929e1dad2acecd26049ac6407e0b8f1dee33c160480e0f34cd6c551454c98
MATLAB
2,371
79
clear all nInst = 500; nVars = 200; X = randn(nInst,nVars); w = randn(nVars,1); y = sign(X*w + randn(nInst,1)); w_init = zeros(nVars,1); funObj = @(w)LogisticLoss(w,X,y); fprintf('\nRunning Steepest Descent\n'); options.Method = 'sd'; minFunc(@LogisticLoss,w_init,options,X,y); pause; fprintf('\nRunning Cyclic Steep...
a0241b66cd83d2587132b9b3de6735762790e9be37608edec5cd96afa28be05f
MATLAB
2,372
80
% function [ranks,ind] = fget(labels_train,vectors_train,varargin) % % Feature selection subfunction using F-score function [ranks,ind] = fget(labels_train,vectors_train,varargin) labels = unique(labels_train); for i = 1:size(labels,1) train_index{i} = labels_train == labels(i); %#ok<AGROW> end if nar...
c506b9fda94bded967a7082fb2e08183ba8ad5788c5d843492c110e0287c9e28
MATLAB
2,376
96
function A = PhasePref(A) %Parameters b = fir1(96,[0.1 0.3]); % cellId = 44; A = getResource(A,'CellNames'); A = getResource(A,'SpikeData'); A = getResource(A,'HcTrace'); A = getResource(A,'Sleep1Epoch'); sleep1Epoch = sleep1Epoch{1}; A = getResource(A,'Sleep2Epoch'); sleep2Epoch = sleep2Epoch{1}; A = getResource(A...
0dcf1a17bcfea2fcf408621f0e8526cf5e94531261e47f2da84de144ea6a40c6
MATLAB
2,377
55
function [spike_burst_dyn_table]=well_compute_spike_burst_dynamics_220211(allregion_unit_matched) %despite the name, this function computes spike dynamics for the wells % This folder contains the contains the mea structs %load(strcat(parent_dir,'\','allregion_unit_matched')) % Parameters fs = 25e3; % Init...
90b1fc8f3315a88f548e219bdb7b50c9b3083dc1326dee7f0b68109559072f47
MATLAB
2,381
76
function create_readme(varargin) % % Create a README in a BIDS dataset. % % USAGE:: % % bids.util.create_readme(layout_or_path, is_datalad_ds, ... % 'tolerant', true, ... % 'verbose', false) % % :param layout_or_path: % :type layout_or_path: ...
7d36940a4bdf6a46259eea6ebb514d9fe03456a17ba5ccca453da8e230319b6f
MATLAB
2,382
104
function tsa = tsd(t, Data, varargin) % Constructor of TSD object % % USAGE: % tsa = tsd(t,data, 'optionName1', optionValue1,... ) % % tsd is a class of "timestamped arrays" % composed of an array of timestamp (column vector), and an array of data % associated to each timestamp (first index corresponding ...
817df21a1e193800cd8350f5449737e9405c03ee050e6049aee6615691cc1113
MATLAB
2,382
83
%% Add path addpath(genpath('../../Ionnic Channel'),genpath('../../Tools'), genpath('../../Synapses'), genpath('../../Datas')); %% Import data from neuron (FS) dt = 0.01; dtSI = dt*10^-3; Vmem = -90:dt:60; VmemSI = Vmem .* 10^-3; l_V = length(Vmem); %% Matr...
f53ac3d6573d053ee64171206217f524840a9f023d771591ee5d7a57d5480d26
MATLAB
2,383
66
% @title Convert .mat of synaptic connections into .txt file % @file mat_to_synmatrixf.m % @author Romain Beaubois % @date 06 Aug 2021 % @copyright % SPDX-FileCopyrightText: © 2021 Romain Beaubois <refbeaubois@yahoo.com> % SPDX-License-Identifier: GPL-3.0-or-later % % @details % > **08 Mar 2021** ...
9d75a22e5cad2951f080435298fe40d84d816353a9b4d9a1369b7ac6ee84949b
MATLAB
2,384
79
function spots=bd3d_t_local_s(wholestack_local,sizes_local,thresholds_local,sigmas_local,zsizes_local) % volume LOG filtering filtersize=[sizes_local sizes_local zsizes_local]; h=-fspecial3('log',filtersize,sigmas_local); % this can be taken out of the function If=imfilter(wholestack_local,h,'symmetric'); % re...
5f0d4b3230305e5856999258dd78628b5cc046efe85cbef09523e771dfeda72a
MATLAB
2,386
62
function [c] = savgolay( order, halfwidth, reverse ) % SAVGOLAY: Implements Savitsky-Golay smoothing. This smoothing technique fits a polynomial % to a moving window of data using linear least-squares fitting. Derivatives, as % well as the function value, can be determined at the center point. Since the % coeff...
3c0c3ff9514d0fdc063028fa7fd79104ea4bb72fc8fdd74d0dff8c347f5bcf59
MATLAB
2,388
71
function parallel_pool(n_workers, restart, rng_shuffle) % function parallel_pool(n_workers, restart, rng_shuffle) % % Initializes parallel worker pool, with the option to restart an already % exististing pool and to shuffle the random number generator on each % worker individually. % % Input: % - n_workers: Number o...
739705821d73e261a8d9403d1480ea1959e7c81367cfdac0aaea433277660cd0
MATLAB
2,389
77
function model = lvl1_contrasts(sub_id, p) % function model = lvl1_contrasts(sub_id, p) % % Defines and calculates constrasts for a SPM first-level analysis. % % Input: % - sub_id: ID of the current subject. % - p: Structure with analysis parameters. % % Output: % - model: Structure with all SPM settings used fo...
a7c8caaee42bfec8b24e0da34574236fdb24b3f032f355504800f056716a4dc6
MATLAB
2,390
72
function EnableDisableGuiPlotBttns(handles) global maingui if isempty(handles) return end if ~isempty(maingui.dataTree.currElem.GetRawData()) set(handles.radiobuttonPlotRaw, 'enable','on') else set(handles.radiobuttonPlotRaw, 'enable','off') end if ~isempty(maingui.dataTree.currElem.GetDod()) set(ha...
cac1b2e457bd2078dd55cc48846f3803d1921c5a1f7df9d971443cc746819999
MATLAB
2,391
68
function [fx,dfdx,dfdp] = f_Qlearning(x,P,u,in) % // VBA toolbox ////////////////////////////////////////////////////////// % % [fx,dfdx,dfdP] = f_Qlearning(x,P,u,in) % Reinforcement-learning evolution function for a n-armed bandit task % % An RL agent learns by trial and error. A bandit task is such that, after % eac...
38e816f17b373b5ca3813def4e0f38f1588e598c7312d1c383d31d7c3800b314
MATLAB
2,392
93
function [no,xo1,xo2] = histCont2d(z,y1,y2,x1,x2) % HISTCONT2D 2-D histogram of continuous measure % [N, X] = HIST2(z,Y1,Y2) bins the elements of Y1 and Y2 % into 10x10 equally spaced containers % and returns the average value of z for each bins. % % N = HIST(z,Y1,Y2,M,N), where M and N are scalars, use...
1beb2787915930dfbcbc7b0983584a8e81b1da7b5b373926f5e502771e52c99c
MATLAB
2,393
61
function pipeline_patdif_state_at_cue_decoding() cfg = load('neurovar_cfg.mat').cfg; for i_sub = 1:44 fprintf(strcat('Decoding Sub_', string(i_sub),'\n')); pipeline_dir = fullfile(cfg.global.deriv_dir, 'pipeline_patdif_state_at_cue_1st', ... strcat('sub-',sprintf('%02d...
68be3cb8a9afd26a92f557007ef86d7368ad10a288d7f3a23d11b3d44a940f4b
MATLAB
2,395
81
function [errs warns] = spm_test_omnibus(varargin) % [errs,warns] = UNIT_SPM_RUNALL(varargin) % This function simply calls the entirety of the SPM unit tests creating a % monolithic script that you can run to test everything in one shot % instead of running them all seperately. % % FEXTENSION(*.nii/.img) % If ...