sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
2f889712b52e3ad82fa6118287aac8b2715a3af75add1c577c50bc4b8200b9f2
MATLAB
1,483
52
function plot_weight sensor_radius = 0.5; separating = 0.4999;%0:0.1:0.5; Lin = 4; for i = 1:numel(separating) [d s] = obtain_weights(separating(i),sensor_radius,Lin) end function [deep_weight,sup_weight] = obtain_weights(separating_radius,sensor_radius,Lin) i =1; deep_weight = zeros(1,...
a2191bc152edd535e546f61178c1a92f14ba158c828c700074e4471819163cca
MATLAB
1,483
35
function msBatchMatchSegmentsBetweenSessions(dirName, distThresh) %MSBATCHMATCHSEGMENTSBETWEENSESSIONS Summary of this function goes here % Detailed explanation goes here dataFolders = msBatchFindDataFolders(dirName,[]); for folderNum1 = 1:length(dataFolders) currentFolder1 = dataFolders{folderNum1}; ...
4db94e1d951a00939926f99b3389049610d137f822adbdb762a14e071115953d
MATLAB
1,484
29
function decoding_out = similarity_test(labels_test,data_test,cfg,model) if isstruct(data_test), error('This method requires training vectors in data_test directly. Probably a kernel was passed method is use. This method does not support kernel methods'), end switch lower(cfg.decoding.method) case 'cla...
105d573461b5db44ee8f8bc8e5b4529168d48cafe3d78712fdced534bf80e5a2
MATLAB
1,486
48
function [x_info, num_ava] = loadSimulationRunResults(sim_string, rep_list) if nargin == 1 rep_list = {''}; ss_str = selectSimulation(sim_string); else ss_str = selectSimulation(sim_string, rep_list{1}); end % rep_list = {''}; setLoadingFunctionNames x_info = cell(len...
a70a4eb13a6991c36ba8874dc8314950cf1e929cd32262f18a254eefa5ad6831
MATLAB
1,488
54
function [X] = db4idwt(coefficients, levels) % Imitates the waverec function in wavelet toolbox. % % [X] = db4idwt(coefficients, levels) % % This is hard coded with values of the 'db4' wavelet taken from % online resources. % License: %===================================================================== % % This is p...
c01af9424e318b08c6dd66c3038cf2d65c1ba433170f09f6bd55b8e77deb4753
MATLAB
1,488
67
function [shuffled idx] = shuffle(mat,dim) % Shuffles the order of a vector or 2D matrix % % [shuffled] = shuffle(mat,[dim]) % % DIM (optional, default = 1), determines which dimension to use to % shuffle the matrix % % Can't deal with >2D matrices. Any suggestions? % License: %===========================...
6275e6657fbc07c8621adebd4014641a6b8c6bce3c3911c3938fc43065505c0e
MATLAB
1,490
43
% function [sigma,shrinkage] = covshrink_lw2(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 variances (i.e. the diagonal), i.e. % shrinkage acts only on covariances. % % I...
781d9ff6dc64bf4cbf7c69ab6de35b136dd9f0c6b46f6f33a33cd91edfdc9b47
MATLAB
1,491
51
function field = field_exponentiation_inverse(field) % function field = field_exponentiation_inverse(field) % % Estimates the inverse field using a field exponentiation of % the provided field. % % INPUT ARGUMENTS % field - Field to perform inverse field exponentiation on % % OPTIONAL INPUT ARGUMENTS % N/A % % OUTPUT...
e02c769eff226ab48809fccf1c43b792a3a4848eb8087509fa1eff3a788d8d6a
MATLAB
1,491
37
% function check_software(software) % % This function checks that the specified software is available (if % additional software for cfg.software is needed at all). % % Internally, a persistent variable is used, so calls to the function does % not need any time once the software has been checked. % Kai, 2012-03-20 fun...
cfdca810dea1da95d7cf99b661df7158222669f4ad243a09bb4dcddef5aa3c46
MATLAB
1,492
69
function [beta, P] = robust_ar_fit( y ) warning('off','stats:statrobustfit:IterationLimit') yf = y; yb = flipud(y); bic0 = 1; bic = 0; P = 0; Pmax = 100; beta0 = []; beta = []; while bic0 > bic && P < Pmax beta0 = beta; bic0 = bic; P = P+1; % forw...
dce3a57e84e360bb209f7ced96c33773d0967a05e2aa3de0c4055943bc6a3bf7
MATLAB
1,492
44
clear all load('.\Public data\data_social_struct.mat') Subj_list = [1:32]; for num_sub=Subj_list %num_sub = 1:size(datastruct,2) y=datastruct(num_sub).Social.data(:,4) .* 0.5 - 0.5; z=datastruct(num_sub).Social.data(:,5) .* 0.5 - 0.5; fb=datastruct(num_sub).Social.data(:,2); isYout ...
a545afbc44e736760f90c294949d22ebf28a1d196dd86518243fbf371a7d2136
MATLAB
1,493
52
function [prob,a] = mdnprob(mixparams, t) %MDNPROB Computes the data probability likelihood for an MDN mixture structure. % % Description % PROB = MDNPROB(MIXPARAMS, T) computes the probability P(T) of each % data vector in T under the Gaussian mixture model represented by the % corresponding entries in MIXPARAMS. Each...
f597a79dd928c60d825e0f9815b9da2c69d9b474814485b2c7016a4201a8ee49
MATLAB
1,495
82
function RMSE = findPars_RL(x0) %%% this function derives RMSE based on a set of RL parameters (beta, bias, %%% w1). This functions output will be minimized through fmincon %%% optimization process global data global ChanType %% OP_cw=[]; CP_purp=[]; OC_cw=[]; CC_purp=[]; for i=1:size(data,1) beta=x0(...
0f296a2e536280a4c5fa9309c4c997c0c4b88ecdd2c6c3fe7acd7752551cd8f5
MATLAB
1,497
67
function PosSynchro_BlinkingLED(fbasename,nchannels,LedChannel,varargin) if ~isempty(varargin) colorvec = varargin{1}; else colorvec = [1 3]; end syncS = LoadBinary([fbasename '.dat'],'frequency',20000,'nchannels',nchannels,'channels',LedChannel); tDat = (0:length(syncS)-1)/2; epDat = thresholdIntervals(tsd(...
2f42c76e0298e0a607e38ad7732b8cb07dabe5ac4a3a327b48b3ebf8421658b7
MATLAB
1,497
49
function [imfStart, imfPeriod, imfAmplitude] = li_upmemd_cycle(comp, fs) %LI_UPMEMD_CYCLE calculate cycle start point, period, and amplitude of each % cycle from the component extracted using LI_UPMEMD % % $Author: Peng Li, Ph.D. % $Date: Mar 24, 2023 % % find local peaks and cycle lengths hImf = hilb...
4add8982b82894b60d7b33771023f8da7c5542204bedd366aca117ae6c91f5b2
MATLAB
1,500
53
function unittest_optimisation_DualCoordinateDescent % Test of optimisation functions % % Function: DualCoordinateDescent % % The function solves quadratic optimisation problems with box constraints, % more concretely: % % arg min a f(a) = 1/2 a' * Q * a - e' * a % subject to 0 <= a <= C % % A few such pro...
40628885619f9015381226ce87f6f1c5492ad60147e7aac1d386e9601713ba92
MATLAB
1,502
34
% util unit test % % squeeze1 tol = 10e-10; %% special case that X is scalar X = 12.2; print_unittest_result('[X scalar]', size(X), size(squeeze1(X)), tol); %% squeeze = squeeze1 for 2 elements X = ones(13, 16); print_unittest_result('[2 dims] no singleton', [13, 16], size(squeeze1(X)), tol); X = ones(80, 1); print_u...
4eaba8b05f469e0af76500ef3c758876a117be30b654872a163643076a11b3f9
MATLAB
1,507
46
function [status,txt] = ssh(cmd, isRunAsync) % USAGE: % [status,txt] = ssh([cmd, isRunAsync]) % INPUTS: % - If no inputs provided will return true or false indicating, is ssh % installed on this computer. % - cmd - ssh command to run. % - isRunAsync - when set to true will execute ssh command and ret...
e6ec12f0cb56497e494c0ec8c972a866247d0ed515af57c63e2d1fb914181fde
MATLAB
1,507
43
% Preprocessing unit test % % zscore tol = 10e-10; % Random data X = randn(6,10,20,30,10) + 1; % Get default parameters param = mv_get_preprocess_param('zscore'); %% z-scoring along dimension X should result in all mean=0 and std=1 for dd=1:ndims(X) param.dimension = dd; [~, Xd] = mv_preprocess_zscore(param...
093ebea819254f062d1a3dff372037b38d995c5cb39f363ef55a46cf614ca587
MATLAB
1,508
42
function [data, mask] = pSVR_prepare_data(data, mask, voxel_count, fwhm, labels) % function [data, mask] = pSVR_prepare_data(data, mask, voxel_count, fwhm, labels) % % Prepare data for pSVR reconstruction. Get the appropriate number of % voxels, run feature-space smoothing, adjust the format for TDT and remove % data...
7596005da8ceaa94fe241962160ced1c26d435f6fcce20ef7ed3e9500ea13207
MATLAB
1,508
74
% Investigate circularity in EC phases distribution %% Set up the environment statpath='/Volumes/ROBBOT/Projects/GridMagination/OfficialData&Results/3Iso/Script/06_HexadirectionalCoding/CircStat2012a'; addpath(statpath) WorkingDirectory='/Volumes/ROBBOT/Projects/GridMagination/Tables'; %% Load Phases df % SC 6-Fol...
90decaba5f8c7d946d8326466c4b22a723fe7bef6318e68341d0193f344513f6
MATLAB
1,508
46
function [data_sorted, sort_idx, sort_idx_img] = sort_data_by_activation(data, mask, sub_id, p) % function [roi_data, roi_idx, roi_idx_img] = extract_roi_index(data, mask, i_sub, p) % % Sorts data based on the t-value from a SPM t-image. % % Input: % - data: [n_trial, n_voxel,n_run, .n_tr] array with data. % - mas...
13e1638c35f521779784b29c1e26d4fcb387ea905f9e2e86e77d77085aee83fe
MATLAB
1,509
49
function demhint(nin, nhidden, nout) %DEMHINT Demonstration of Hinton diagram for 2-layer feed-forward network. % % Description % % DEMHINT plots a Hinton diagram for a 2-layer feedforward network with % 5 inputs, 4 hidden units and 3 outputs. The weight vector is chosen % from a Gaussian distribution as described unde...
b83c2807c99cfe5022af4ae3672c9cd93d29066f6d7569c2a108aadbe64ba87f
MATLAB
1,511
55
function [acts scratch] = test_bp(testpats,testtargs,scratch) % Testing function for BP % % [ACTS SCRATCH] = TEST_BP(TESTPATS,TESTTARGS,SCRATCH) % % This is the testing function that fits with TRAIN_BP. See that % for more info % % ACTS is an nOuts x nTestTimepoints matrix that contains the % activations of the output...
7c6f42d676aa887ce73f03654f5866c10ccbe7f536c9ec7c420518694156a21f
MATLAB
1,514
33
function [perf] = CalculateASLMap(T1rawSS_reordered_reshaped,T1rawNS_reordered_reshaped,tvalues,ivalues,T1blood) %UNTITLED3 Summary of this function goes here % Detailed explanation goes here opts = optimoptions(@lsqcurvefit,'Algorithm','levenberg-marquardt'); tmax = max(tvalues); fun = @(coeffs,ival...
0785323662253059d90f3279e00423b162392924b621cf44b115e4c326223d0c
MATLAB
1,516
58
function lat = rateChange(data,trailInxArray,curGroup,epoch,plotOption) % get baseline baseline_params.SD = 20; baseline_params.align_to = epoch; baseline_params.time_before = 500; baseline_params.time_after = 0; baseline_params.smoothing_margins = 100; response_params.time_before = 0; response_params.time_after =...
2fb3db27cabfefcdc8a550cb26eca8a9bf1e57de0c2d9a2f132d212c01856ed3
MATLAB
1,518
49
function [xf] = ... generate_gaussian_pulse( image_size, dt, T, amplitude, frequency, sigma, varargin ) % *WAVE* % % GENERATE GAUSSIAN PULSE generates a simple test dataset, following % the model of a space-time separable % Gaussian pulse. % % ...
5fee3f40e4b7c17aa674b45194e7ce15be7de968bda04e34760e3c510db20975
MATLAB
1,518
44
function [consDat, errorMsg, success] = getNoMovingEpi(datTT, fs, thre, minLenghNoMoving) %GETNOMOVINGEPI identify episodes from 3-D accelerometer signals DATTT that % correspond to when users do not move (less likely to be moving) % % INPUTS % DATTT: 3-D accelerometer data, unit g, N by 3 timetabl...
0c773e1281da828e8b257a84959fef7aa0d84ce56cf08896bfcc988d504ecb7b
MATLAB
1,519
40
function varargout = write_image(software,varargin) % Typical call % % function hdr = write_image(cfg.software, hdr, volume) % % or in general % function varargout = write_image(software,varargin) % Write image using the software specified by software (typically % cfg.software from decoding_defaults) %...
a8d8377e377d2c5358c935a1bbb6414bcd6c8bbc4c134afc207a2e4e0d931c0c
MATLAB
1,520
88
% c = str2cell(v) % c = str2cell(v,delim[s]) % % creates a cell array <c> from input array <v> % seperated by delimiter[s] <del> % % v : a string/vector of a ML supported data class % delim : array of delimiter[s] [def: isspace] % v-class syntax % ---------------------- % char 'xyz' % other [1 2 pi] % % no...
64e2b21756e14195b874c7c55a0397555b4552c8807c024f88fe5272b90cac51
MATLAB
1,521
72
function O = set(O,varargin) % Set intervalSet properties and return the updated object (TODO) % % TODO: what this function does??? % % if 'start' is one property, 'stop' must be one, and viceversa % batta 2001 % starting version t = []; property_argin = varargin; set_start = 0; set_stop = 0; while length(prope...
7dea1480081bdb5753f0fce743c1f4b0f60a99f9b138ff88766e9449391f188f
MATLAB
1,521
27
%% Load voltage recording of uncaging laser Pockels cell for each recording included in mydata % Assumes the filename listed in each recording of my data links to a % folder thatincldues a voltage recording .csv file % Michelle Cahill 20240111 %% start_dir = pwd; condition = fieldnames(mydata); for cond = 1:l...
c6b1c2cd8c71c32c1e9de86fc274091082560f15f7632fd42d5ce43611389e3c
MATLAB
1,525
36
function model = passdata_train(labels_train,data_train,cfg) % This function pretty much does nothing. % It serves for the case in which you only want measures about the data % (e.g. get the number of voxels ("dimension") of the searchlight/ROI or % the covariance matrix or the like. % % Also set % cfg.deco...
0d74dfd6e3f5255a313006f5ef0039517393e52b478378620776d470d10217a2
MATLAB
1,529
50
%% Import data from text file % Script for importing data from the following text file: % % filename: /dagher/dagher11/filip/Obesity_maps/data/PLS1_geneWeights_BMI_DBM_LH.csv % % Auto-generated by MATLAB on 07-Jun-2022 13:21:21 %% Setup the Import Options and import the data opts = delimitedTextImportOptions("NumVa...
a6f61c731ce2a1fb7bc45d8a06e39f778334a32b10d81356759a1bc6e0f25214
MATLAB
1,529
74
function [RLmodel,opt_fx_out_detail] = sx_fx_findoptim_alpha_nonoverfit(fittedpars,maxalpha) %%%% this function stops the optimization process when it starts to diverge %%%% to unreasanoble values (of weights and predictions errors in %%%% particular), and hence, will lead to overfitting. In short, this %%%% func...
44d7c445fc5d0054cb3268b0a8c740dc8282cb89ef1b82015f09b90b791c44cf
MATLAB
1,532
45
function [DB,V,xy,chanmap,homedir]=setmeup() %(independent of your naming of directories) disp("Set Up Workspace"); homedir=pwd; addpath(genpath(homedir));% add the path of all folders here % cd('..'); cd('C:\Users\as822\Box\collab-Sinai\project-selectEPs\EEG-dataSumm\eegdata_mean'); meandir=pwd; cd(homedir); ...
d7c0521b0652f79af3a2af77ca51ae4824d0442c0e918b53259184eb9481a56f
MATLAB
1,532
44
function scrapFineAlignment(subjectPath) % This function clears all fine alignment for sections of subject. % After reslicing OCT, fine alignment needs to be recomputed from scatch. % This script make sure fine alignments are cleared. % INPUTS: % subjectPath / slidePaths - can be a string containing path to subj...
947d11c1abb007ad3a78ddaac5ace4c4ed199cc7dccd38b86bbeaed8e4641fde
MATLAB
1,534
36
function [allCountList, allAngList, trackCountList, trackAngList] = AccumulateTrackAngles(tracks, angRange, angStepSize) if strcmp(angRange, '90') == 1 allCountList = zeros(1, length(0:angStepSize:90) - 1); trackCountList = zeros(1, length(0:angStepSize:90) - 1); elseif strcmp(angRange, '360') == 1 allCount...
a6bb7ff8ed48602a1dc465bcc7821511d4a3e9f4f466f49f101d9c8d33c87d30
MATLAB
1,534
40
function FigureB_NoParams(fileExportFolder, numA, imageAshow, vxMatShowA, vyMatShowA, relMatShowA) imageBmasks = cell(1); xIdxB = cell(1); yIdxB = cell(1); for i = 1:numA h = figure; dispImage = mean(imageAshow{i}, 3); dispImage = RenormalizeImage(dispImage, .1); dispImage(dispImage(:) == 0) = mean(disp...
2103f5299ba93660eb41421b970f71e1a343c467fb60965b23cc5874a2d63c13
MATLAB
1,536
44
% Wm = vsh_modified_out(theta,phi,l,m) % % Vector spherical harmonic funtion modified from Hill's function % W_lm for quantum numbers l and m. Angles theta and phi should be % given in radians. % function Wm = vsh_modified_out(theta,phi,l,m) % Copyright (c) 2016, Elekta Oy % --------------------------------------- % ...
5bd42051ab499dc1d9f207b29d39be0c09a646bc93c4fd57ccd196d10c10a8c2
MATLAB
1,536
51
function stats = get_zones_stats(x, y, dff_synchronized, video_freq_Hz, frame0, zones, debug_mode) n_zones = max(size(zones)); n_pos = length(x); in_zones = nan(n_pos,n_zones); stats = []; for i_zone=1:n_zones xz = zones{i_zone}.x; yz = zones{i_zone}.y; in_zones(:,...
94d9c2c48b9e9b77d9e3d01186e101c18de90b59e75c13847fd4edb35358779e
MATLAB
1,536
56
function TrackFlowClusters(exportFolder, clusterTrackParams, diffImage, enhImage, optFlow) %% Create folder trackFolder = [exportFolder, 'TrackFigure', filesep]; if ~exist(trackFolder, 'dir') mkdir(trackFolder); end %% Import params pxPerMicron = clusterTrackParams.pxPerMicron; clusterFil = clusterTrackParams.clus...
3c782eebe9541b24f418d411a221614695fc6c91ac69e45a76f99ff542989cd6
MATLAB
1,537
36
function decoding_out = passdata_test(labels_test,data_test,cfg,model) % This function pretty much does nothing. % It serves for the case in which you only want measures about the data, % e.g. get the number of voxels ("dimension") of the searchlight/ROI or % the covariance matrix or the like. % % Also set % ...
4e6f2c9e5b2bdd99f6882ca27f9c0323be163c50011ef1897ad3177dc6b4deb1
MATLAB
1,537
57
function S = EPGX_BM_shift_matrices(Nmax) % Generates shift matrices up to order Nmax for 6 component 2 pool Bloch % McConnell case % Layout of state vector is [F0A F0*A Z0A F0B F0*B Z0B F1A F-1A Z1A F1B F-1B Z1B ... etc] % i.e. 6 states per n-value % % Shaihan Malik 2017-07-19 N = (Nmax+1) * 6; S = zeros([N N]); ...
96cfc0a804646b82d1286daa716f8d1e94e0e02927f74fab7f9ccfe45c480790
MATLAB
1,537
59
function p = awsModifyPathForCompetability (p,isAWS_CLI) %This function excepts path and output AWS compatible path. %If p is not AWS path will modify it to be compatible with windows %INPUTS: % p - path % isAWS_CLI - will this path be used with AWS CLI? if so, spaces are % defined slightly differently. If...
ff4658de11302fd221e085a1eb648b2c9738d160f49d241183bd3b7be9cf441c
MATLAB
1,537
54
% This script updates QA metric %% Inputs % Set subject path an slide/section programaticaly lib = 'LG'; subjectPath = s3SubjectPath('01',lib); % Get latest subject path sectionName = 'Slide01_Section01'; % Set to true to override selection above and let user select subject using % a dialog box if true ...
0ba4966df89ca3bc9765cbf3c9bf2fa1672bda84e3717c392b1196dfc1910839
MATLAB
1,538
71
function S = LoadSpikes(tfilelist) % S = LoadSpikes(tfilelist) % inp: tfilelist is a cellarray of strings, each of which is a % tfile to open. Note: this is incompatible with version unix3.1. % out: Returns a cell array such that each cell contains a ts % object (timestamps which correspond to times at which the c...
eef8ce7f6dce1b8a5cebe1756e538ea5bd321474d17b0d86e194fba6d438c2af
MATLAB
1,538
37
function [regFrame,dv0,cx] = return_offsets_phasecorr(frame,ops) % Do phase correlation registration (sub-pixel with kriging) on a single % frame using pre-calculated registration variables (ops) % use with setup_registration_phasecorr.m % e.g: % [ops] = setup_registration_phasecorr(refImg) % [dv0,cx] = return_offsets...
18719e2ecb7478b9322c2f97de9faeb3fb668af37c715192875945e6061c0efe
MATLAB
1,540
58
% Classifier unit test % % Classifier: multiclass_lda rng(42) tol = 10e-10; mf = mfilename; %% for two classes, multiclass_lda should give the same result as lda X = randn(1000,10); clabel = randi(2, size(X,1),1); % Get classifier params for multiclass LDA and binary LDA param = mv_get_hyperparameter('multiclass_ld...
e0a000490457d1a6aeae62dfd631f546cf6f47466b7a8f3b3e86ee139badea9a
MATLAB
1,540
63
function [S,shank,cellIx] = LoadSpikeData(fbasename,varargin) % Load spikes times from a clu and res file % % USAGE: % [S,groups,cellIx] = LoadSpikeData(fbasename) % % INPUT: % fbasename: session file basename % % OUTPUT: % S: a tsdArray of spike trains % groups: a vector giving electrode group for each n...
71e3eb831b9017b819699ff335b1cf7c15b969b78c7e11726a255466e0539684
MATLAB
1,542
61
function [actives] = and_bool_selectors(subj,selnames) % Takes in multiple boolean selectors and ANDs them % % [ACTIVES] = AND_BOOL_SELECTORS(SUBJ,SELNAMES) % % Returns another boolean vector of the same size. % % If SELNAMES is just a string, treats it as a cell array % of length 1 % License: %======================...
4cc16dc596f490e0bfcfafab4abeac9e00a8e9e0bfac9df78028f0a388a815fa
MATLAB
1,543
46
% Vm = vsh_modified_in(theta,phi,l,m) % % Vector spherical harmonic funtion modified from Hill's function % V_lm for quantum numbers l and m. Angles theta and phi should be % given in radians. % function Vm = vsh_modified_in(theta,phi,l,m) % Copyright (c) 2016, Elekta Oy % --------------------------------------- % %...
8273916266b64154a042ef0c1b3d758b15a3d30dedafaaedb04349d94f0be6b3
MATLAB
1,544
32
function gamma_fit_arr = consolidateGammaFits(x_reps_uf1, eps_ind_trace, eta_ind_trace) gamma_fit_arr = cell(length(x_reps_uf1)+1, length(eps_ind_trace)); for i_xra = 1:length(x_reps_uf1)+1 for jj = 1:length(eta_ind_trace) if i_xra > length(x_reps_uf1) g_fit = x_reps_f1.all_gamma_pfit{eps_ind_t...
6bfc78b6dfe01857733265548794c73129da91a6ca9b244833d79b2078de942f
MATLAB
1,545
61
function [trajectory] = generate_trajecotry(behav,tsdata,Lap,Cam0,Cam1) %GENERATE_TRAJECOTRY % produce time-dependent coordinates of animals movement data1 = tsdata.data; ts0 = data1(data1(:,1)==Cam0,:); ts1 = data1(data1(:,1)==Cam1,:); ts0(1,3) = 1; ts1(1,3) = 1; m = size(ts0,1); % m1 = size(ts1,1)...
97f50b63554907a5bfe11edaed8e8a091dc788cfecb21dcb601658425d7b4c4a
MATLAB
1,545
53
function st = loadStatusReportByLibrary(libraryNames) % Loads status report generated for each library (from nightly blild) and % loads it to one st. see generateStatusReportByLibrary for full information % % INPUTS: % libraryNames - can be a string or a cell containing library names. % Examples: 'LA' or...
7edd0f1599bdee6e9e0422a63f64069921d4fa9f16bcb9e12be1719f418c9405
MATLAB
1,547
58
% makegaussfir for 1D smoothing % % gwin = makegaussfir( sd, Fs ) % % sd Gaussian SD [sec] % Fs sampling rate [Hz] % 26-dec-12 ES function gwin = makegaussfir( sd, Fs, support ) n = 2 * floor( sd * Fs / 2 ) + 1; % make odd if ~exist( 'support', 'var' ) support = 6; end switch length( sd )...
da474cb8c61dfdb1881f8494f6418b3c7b59b0ce6ddd54c4096b6760a8c5ee92
MATLAB
1,550
46
function stdshade(amatrix,alpha,type,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 used x axis (default...
437e41ee451833416403ce99e9f14161f649abdb64408ae7c70ea6ec2dbf45f1
MATLAB
1,551
48
function Image4_WholeImageWithOutlines(imageExportFolder, fileParams, flowFigureImageParams, imageA, xIdx, yIdx, numMicrons) %% Check exist fileName = 'WholeImage_WithOutlines.png'; %% Import parameters % File Params pxPerMicron = fileParams.pxPerMicron; % Flow Figure Params frameNum = flowFigureImageParams.frameNum...
d76bf58fa4ca4f1f7f30976074a0e9e2104a768d41d17289679770f3353de5ee
MATLAB
1,551
44
function [sequence, mask, correct_flow] = read_yosemite % [SEQUENCE, MASK, CORRECT_FLOW] = READ_YOSEMITE % % Read 15 frames from the Yosemite sequence. These are originally % numbered yos2--yos16, with the correct flow being known for the middle % frame yos9. % % SEQUENCE - 252x316x15 array with gray values. % MASK...
1b188e09c0d26911dc8d2890a4bbd380df74e52873298e8654fc628397c04680
MATLAB
1,553
40
function [t,x,ie] = simInterneuron(K,params,x_0,T,dt,shift,sigma_noise) %SIMINTERNEURON K, params, x_0, T, dt, shift, sigma_noise % Simulates coupled populations of N interneuron models. % K coupling matrix (N x N non-negative matrix) % params model parameters (structure) % x_0 initi...
f676b8812aa62908b73c1e6403fc7369da5f950df9f9390fa5a28f947cdcb168
MATLAB
1,553
37
function R = getRegularization(B, I) % ************ Eye fit: first to get scaling for kPE (kEP*kPE = PF)********** R = struct; R.reg_weights_eye = [I.scale_EH*(1:nnz(B.bEH_maskE)).^I.reg_exp ... I.scale_EP*(1:nnz(B.bEP_maskE)).^I.reg_exp_EP]; % Get mask where coeffients switch from one filter to another n_eye = le...
089262b80959fd37f43b99cb051061a40d1eeff8258c6a62551cd91d768a6c58
MATLAB
1,555
54
function [acts scratch] = test_svm(testpats,testtargs,scratch) % Testing function for SVM % % [ACTS SCRATCH] = TEST_SVM(TESTPATS,TESTTARGS,SCRATCH) % % This is the testing function that fits with TRAIN_SVM. See that % for more info % % License: %===================================================================== % %...
3003cbbddec762f590fef03b09c0d6da3d0db3c89c7339470210aae31a4f0a4a
MATLAB
1,555
60
%% Plotting Example Neurons FEF and FEF traces %% FEF Traces load('V4_FR_egNeurons_select_dat.mat') load('V4_FEF_egNeurons/V4_quad.mat') bins{1} = 1:31; bins{2} = 36:48; % units = [1, 21]; qid = input('quadrant: '); if qid == 1 units = 1; elseif qid == 3 units = 21; end cnt=1; for iWindow = ...
cd0a825495b173c1288b787f643a272a840be5d39ec5726692f957d17200f7e0
MATLAB
1,556
55
ndip = 20; snr = 0.9;%[0.6 0.5]; snr2 = 0.9;%[0.5 0.8]; amp = [0.4 0.5 0.6];%[0 0.2 0.3 0.4 0.5 0.6 0.7 0.8]; phs = 2.*pi.*[0 1/17 2/17 4/17 8/17]; patchsigma = 0; N = [50 150];%100; state = rng(1,'twister'); %state = output.state; %list = reshape(1:100,[10 10])'; list = reshape(1:100,[5 20])'; for i0 = 1:si...
799ae71caba81a08e3348bf65b3285faa90fddb657e59790eeeefc725431a073
MATLAB
1,557
46
function [RP] = rp_plot(data, delay, dE) % RP_PLOT Generates a recurrence plot (RP) from time series data. % % [RP] = rp_plot(data, delay, dE) calculates the recurrence plot for the given % time series data using specified delay and embedding dimension. % % Inputs: % data - A vector of time series da...
c71ec289490bd7488f6abc2401ed63c98040cae88c7372671b16560288175835
MATLAB
1,559
39
function Movie1and2_WholeImageWithFlow_and_WithFlowColoredByDirection(v, g1, g2, intIm, vxMat, vyMat, intGamma, barSize, secPerFrame, varargin) numFrames = size(intIm, 3) - 1; for frameNum = 1:numFrames %% Create dispImage dispImage = intIm(:, :, frameNum); dispImage(dispImage(:) == 0) = mean(dispImage(disp...
f668d8f3aa6682cebde70b9870f3acd0fb36c44bdd8cc114b2ec38cd2a113991
MATLAB
1,560
56
function [g, gdata, gprior] = gbayes(net, gdata) %GBAYES Evaluate gradient of Bayesian error function for network. % % Description % G = GBAYES(NET, GDATA) takes a network data structure NET together % the data contribution to the error gradient for a set of inputs and % targets. It returns the regularised error gradie...
b00843ad1a2d08d1377c82bb879cd809f3e65ef2e595e6353a76bb4d255bb1d6
MATLAB
1,562
71
function [pval,Factual,Fdist] = randanova1(m,group,num) % function [pval,val,dist] = randANOVA1(m,group,num,mode) % % Estimate p-value for one-way ANOVA using permutation. % For further information on using permutation to calculate signficance % tests see Anderson (doi:10.1139/cjfas-58-3-626). % % <m> is a vector to b...
b690e000662d4139c49d0f8e4dd730e8fbf6b7678a2b2392194fe04e4a51bd98
MATLAB
1,562
34
function f = antigradient(g, mu, n) % ANTIGRADIENT Reconstruction from gradients in 2D and 3D. % % f = antigradient(g) computes the function f which has a gradient % as close as possible to g. The vector field g must either be an % MxNx2 array or an MxNxPx3 array. % % f = antigradient(g, mu) does the same thing ...
52d0d899c3f748687386afdc990075668daa87abb8f13692e788190afbd64814
MATLAB
1,563
41
% [SN_new,sss_indices] = basis_condition_adjustment(SN,dim_in,cond_threshold) % % Improve the condition number of the SSS basis by dropping unnecessary % vectors from the basis. Input argument SN is the original normalized SSS % basis, Lin is the order number of the internal basis, and cond_threshold % is the acceptabl...
42538528c76b9b09ffb2b10afd03f42ea8f450fbb804963e148d372bc0e750be
MATLAB
1,564
53
function model = lvl1_estimate(sub_id, p) % function model = lvl1_estimate(sub_id, p) % % Performs 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 for this analysis % step (w...
02242f7e8eaa97b994640a1415f8b650a62ee06e94d25a1d023c92d1d7fb8b3b
MATLAB
1,565
40
function plot_time_comp_210511(spon_areas_table_ff,stim_areas_table_ff,spon_areas_table_fb,stim_areas_table_fb,subregion) [pre_ff,post_ff]=pre_post_time_comp_210511(spon_areas_table_ff,stim_areas_table_ff); [pre_fb,post_fb]=pre_post_time_comp_210511(spon_areas_table_fb,stim_areas_table_fb); figure hold on x_pre_post=c...
08e55aba3f9fb376fbf2283dc1000e2fb0bb07e87a044c7b1ceb737ffef45cf4
MATLAB
1,565
59
function BEH_parafit(dir,fin,model,options,outfix) % S - VP structure % fn - filename for data % model - case name for model % options - specifying environmental and fitting parameters if ~exist('outfix','var') outfix = ''; end %% information on model infopt.type = options.type; infopt.nstarts = options.nstarts; ...
87da7826771cbb039731a515e220f49a23bbe9ea93b105bef0198949d94cb252
MATLAB
1,566
57
function stats=deriveCM_pvals(svm_class,teLabels,nC) % function stats=deriveCM_pvals(svm_class,test_lbs,nClass) % FWS 13/9/2011 Centre for Brain & Mind, UWO % if you use this code for analysis - please cite Smith & Muckli 2010 PNAS % Non-stimulated early visual areas carry information about surrounding context % PNAS,...
7983eee8e5a2e31754832e8d55fc4ad4e947a346a2a279e9d2f5f2add9626f09
MATLAB
1,567
54
function decoding_gui % This is a simple graphical user interface using the Matlabbatch system of % SPM. At the moment, it allows only running very simple decodings as % specified by decoding_example. % % 2015/02/11 Martin Hebart %% first check if path of TDT in toolbox path exists cfg = decoding_defaults;...
dff9acfb283f7ed49add9a3b26a7b2c34b69d606b140a2bbb227e54877339235
MATLAB
1,569
46
function Process_RemoveOptoArtifacts(datName,nchannels,optoTimes,maxT) % Process_RemoveOptoArtifacts % % USAGE % % Process_RemoveOptoArtifacts(datName,nchannels,optoTimes) % % datName file base name of the dat file (e.g. 'datName' for datName.dat). % nchannels number of channels % optoTimes ...
e65a56d08eebd02d13f7416a8d9e404c691f853aa1c9793ce15b7b9a0a685249
MATLAB
1,569
43
function sig_diff = pairwise_CI(data1,data2,num_boots,sig_alpha,min_duration) [trials_nb_1,time_nb] = size(data1); [trials_nb_2,~] = size(data2); observed_difference = mean(data1,1)-mean(data2,1); if trials_nb_1>2 && trials_nb_2>2 data_boots = zeros(num_boots, time_nb); CI = zeros(2,time_nb); for b=...
f8d51366d648bd4b4b73f4ac9aed74c1398ab52ef30acd44774bb92435e27609
MATLAB
1,569
57
% build test pattern movement record output_file_a = fopen('test_data_angles.cpp','w'); output_file_s = fopen('test_data_speeds.cpp','w'); output_file_x = fopen('test_data_x.csv','w'); output_file_y = fopen('test_data_y.csv','w'); x=0;y=0; speed = 5; timebin = 20; % each move command lasts this long onemovems = 1000/(...
4e4082ed98049b1200cfbef1bb3b105c117d962c7e82bc4d586fcc672acf057b
MATLAB
1,570
65
function [CellDif] = specify_cell(NeuronSL,explap,Lap) %SPECIFY_LAP ´Ë´¦ÏÔʾÓйش˺¯ÊýµÄÕªÒª % ´Ë´¦ÏÔʾÏêϸ˵Ã÷ [n,m] = size(NeuronSL); % neuronBinLapS = binActivity.neuronBinLapS; % laps_theta_post = binActivity.laps_theta_post; % [n,nbin, lapnum] = size(neuronBinLapS); explap1 = explap.explap1; explap...
8b684f15ab21ad38fbeb8ee57371b8f698aec4e4ebf55cabf3e73fbe1d797c2c
MATLAB
1,570
33
function [u,v,h] = transformToOctSlide(... histologyToOCTT,new2OriginalAffineTransform,topLeftCornerXmm,topLeftCornerZmm,octScale_umperpix, planeDistanceFromOrigin_mm) % Using 2 transformation, what is the single plane fit of the slide % INPUTS: % histologyToOCTT - 2D Transformation matrix % new2OriginalAf...
652263b8230df20e8b064eb5e72bf71fe061a834bbcc2f343112f234051f8616
MATLAB
1,571
42
% generate gridscore from rate map plot % note: set use_hopper and hopper_run in high_res_traj.m if wanting to use hopper data % while running locally. % reference: https://www.mathworks.com/matlabcentral/answers/456241-how-to-apply-command-line-arguments-in-matlab % run_on_hopper: run from hopper's system % use_hopp...
8301020f0eef09f9c49c5149cdf5ade4fe69cd76a6bad02d95d1212df093affc
MATLAB
1,576
51
function [y, sigsq] = gpfwd(net, x, cninv) %GPFWD Forward propagation through Gaussian Process. % % Description % Y = GPFWD(NET, X) takes a Gaussian Process data structure NET % together with a matrix X of input vectors, and forward propagates % the inputs through the model to generate a matrix Y of output % vectors. ...
a68ec2644c898500f464002adfe98967643fd012ccf03046ebf131ccc990f5a7
MATLAB
1,577
37
% Gets a list of strings specifying paths of elements in inputFolder that % match pattern. function filePathsOfInterest=getElementPaths(inputFolder,pattern,varargin) if isempty(varargin) typeOfElement='file'; elseif length(varargin)==1 typeOfElement=varargin{1}; end elements_...
3f4ee04bec23c6e2017d04c62d49086b9c66370b50f379e2b4a3f4ee3a16bf00
MATLAB
1,578
47
function test_suite = test_bids_query_nirs %#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_bids_query_nirs_basic() % ...
d149ac3fb3aac5634f1e7382dcb7ce74cd7bb0128bc0852e87c305fd243ba32b
MATLAB
1,578
60
function [y] = cellsubselect(x, boolvec, dim) % [Y] = CELLSUBSELECT(X, BOOLVEC, DIM) outputs a cell-arry Y with the same dimension as X % but from each input cell a subset of rows or columns are kept according % to boolvec (which assumes the input data to be concatenated across cells) % % X should be a linear cell-ar...
96f4256594e1a8e43dc966a67f900c9d8b2db04ce8b44817c2164d480076ee05
MATLAB
1,579
35
function reconstructed_links=reconstruct_links(mutual_position_based_links,max_gap_closing_mutual_distance) if ~isempty(mutual_position_based_links) links_backup=mutual_position_based_links; ex_indices = find(mutual_position_based_links(:,3)>max_gap_closing_mutual_distance); mutual_position_based_link...
fcf0a87082aa32b55536a2058607275a7322339ee8afd0c9856317beb585c7b2
MATLAB
1,581
41
% Determine trials for each condition % 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=1:length(subject_list) subject = subject_list...
9f71c507ffbcd683bd1ec776293248d6a86f3e093af9acf24f2735cbdbc18a64
MATLAB
1,582
59
clear,clc %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % This script is used to perform CCA for brain-behavior analysis % % Jin % 7/25/2022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% set the file path current_path = pwd; working_path = current_p...
44f9ae9331cc1df6d3b1c0ac1de8cb8e78ec7622074979b8ccc64909c95103d4
MATLAB
1,585
69
function [] = test_mem2() % [] = test_mem2() % % This is just like test_mem, except that this is more akin to how % init_object works. Either way, the conclusions are the % same. Matlab only duplicates the particular cell in the cell % array whose contents you changed. disp('Clearing and packing'); clear all pack su...
b85a1f8caed3632d000863db61c66221174a85fe95d924ca0c19c1e58a25f247
MATLAB
1,586
53
%% Plot V4 MI Firing Rate d' and bias split at cued and cue-opposite locations (histogram) %% Code loc = ["cued","opp"]; loc_flag = 1;%input('neural data at cued location or cue-opposite location: 1-cued, 2-opp: '); % loc_flag = 1 for Fig 4C-D % cue epoch win_start = 500; win_end = 2500; win_str = num2str(win_start)+...
9d3cb321891b1bed3708489002aab75b8e2062edc3b3f6388ef6edb6b5c4d5b2
MATLAB
1,587
54
% @title Associate xy coordinates to neurons % @file XY_placement.m % @author Romain Beaubois % @date 06 Aug 2021 % @copyright % SPDX-FileCopyrightText: © 2020 Romain Beaubois <refbeaubois@yahoo.com> % SPDX-License-Identifier: GPL-3.0-or-later % % @details % > **20 Apr 2020** : file creation (RB) ...
0fbf31a860c8f63d623a56dff7a58f99057b64a009a48340b5cfca7767091f73
MATLAB
1,590
40
function msBatchSegment(dirName) %MSBATCHSEGMENT Summary of this function goes here % Detailed explanation goes here dataFolders = msBatchFindDataFolders(dirName,[]); parfor folderNum = 1:length(dataFolders) currentFolder = dataFolders{folderNum}; temp = load([currentFolder '\ms.mat']); ...
6b68004dfad6647a29f77174178819de3a02e0741a99d41dc8ea960d2a2dd681
MATLAB
1,590
48
function [allregion_unit_matched]=directory_peak_train_assembly_220103(well_folder,time_idx,direction) cd(well_folder) current_folder=dir; folders=current_folder([current_folder.isdir]); folders=folders(3:end); %removes relative pathing recordings=string({folders.name}); for rec=1:length(recordings) cd(strca...
337803ed9df60751f4e045aa07f083f0bb993c5f64826e83987ab563a999d4ec
MATLAB
1,592
39
%% Indexing V4-FEF pairs to take only pairs belonging to FEF units that have (fMI (cued), fMI(opp) ) lying in a particular quadrant % Code for rank sum test - All Units %% Code cols = [0.3010, 0.7450, 0.9330;0.4660, 0.6740, 0.1880;0.4940, 0.1840, 0.5560;0.6350, 0.0780, 0.1840]; load('V4_FR_full_500_to_250...
40a7ee83361b062fda9c759aaefd017b351f7b211040a5f7f44350fe8dc10433
MATLAB
1,592
82
clear [task_info,supPath,~,task_DB_path] = loadDBAndSpecifyDataPaths('Vermis'); EPOCH = 'cue'; PLOT_CELL = false; req_params = reqParamsEffectSize("both"); lines = findLinesInDB (task_info, req_params); cells = findPathsToCells (supPath,task_info,lines); cellType = cell(length(cells),1); for ii = 1:length(cells) ...
f0452208c7efc04f8759f4f6a1ea60b49f290dbb4b22205932fcf3eb5998516a
MATLAB
1,592
45
function vbl = draw_grating(Experiment, tilt, phase, fixcolor, flip, flipTime) % requires 'tilt' and accepts 'phase' as additional argument. If 'phase' is % not passed, it is set to 0 by default % takes flipTime as additional argument to specify exact time of flip % (script waits until time is reached) Display = Expe...
fafe84c14caca7aacc07aaaacc87989a56b50d89b9bff1ed91deaaa641cc11c5
MATLAB
1,592
47
function [Tortuosity, Pathlength] = Tortuosity_AnyTraj(Traj) numTraj = size(Traj,1); if numTraj == 0 Pathlength = []; Tortuosity = []; else % for each trajectory, take start and end position and calculate the distance for i = 1:numTraj e...
701fe8ba91885df281bfda79d9f26b418e928be50903cf56a158594dd894b811
MATLAB
1,593
53
function vmr = bv_readvmr(fname) % vmr = bv_readvmr(fname) % % :description % % Reads in a version 0, 1 or 2 (BrainVoyager 2000, QX) VMR file. % Does not read in the positioning data added to the end of the file % in QX (version 2) % % :inputs % % fname file to read, e.g. 'myproj.vmr' % % :outputs % % vmr ...
91c0907a05811f53c2a207b9a7c4fbf601d4afe766972884c445ac994b21530b
MATLAB
1,594
41
function [subjects, dirs, subj_date] = PDbb2_SETUP() % Setup PDbb2 in MATLAB % % Vinding, M. C., Eriksson, A., Low, C. M. T., Waldthaler, J., Ferreira, D., Ingvar, M., Svenningsson, P., & Lundqvist, D. (2021). Different features of the cortical sensorimotor rhythms are uniquely linked to the severity of specific sympto...
b7ee8269b4b1c2289d229a06475b4e989f2895fe6c2905ae2a7f40b6f21fcd6b
MATLAB
1,596
41
function SmoothImages(exportFolder, smoothParams, image) %% Params smoothSig = smoothParams.smoothSig; smoothOneSidedNumSig = smoothParams.smoothOneSidedNumSig; smoothPadSize = smoothParams.smoothPadSize; smoothMeanFac = smoothParams.smoothMeanFac; smoothSigFac = smoothParams.smoothSigFac; %% Smooth Image % Pad Image ...