sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
dd4d373856450ea3807067ed618d768922624dfcdbaeb91a45d17d471cfd198e
MATLAB
5,070
130
function [xf, yf, sumres, ysine]=gradFreqPlot(t,y,Fs,axlabel) % function [xf, yf, sumres, ysine]=gradFreqPlot(t,y,Fs,axlabel) % take output from getDSV (t, y, Fs) to plot and % output the freq samples: xf, % fft of y normalised to total input length (numel(t)./Fs): yf % sums of yf^2 in the acoustic resonance bands: s...
20cf95348642e3cea694d99ad53d05b36c36e5f1003783dcc3e419789576fa1d
MATLAB
5,071
159
function [spk wire ampl] = DetectSpikes(data, thr, varargin) % 8/5/2016 M. Farries % USAGE % This function assumes that data are from just one tetrode/stereotrode % REQUIRED INPUTS: % data - 2-D array, (# channels) X (# time samples) % thr - spike detection threshold--should always be >0 (see below) % OUTPUTS: ...
5b57dfba92552915ea1452eff21d4ff50b2e855d8170ac19f0b051d7e4f98a31
MATLAB
5,071
142
function filePathConf = EditConf(workingDir,CircosConf) % FORMAT filePathConf = EditConf(workingDir,flag,offsetPixel) % Set .conf configuration file, parameters % Input: % working_dir - working directory that generate scripts and Circos figure % CircosConf.flag - string contains specific command character % '...
6e5f2deb7e7abf818d614f879f6bca47b45f195ac348d05858b501a46fd2efed
MATLAB
5,072
143
%% Bayesian infernece for simple linear regression with known noise variance % The goal is to reproduce fig 3.7 from Bishop's book % We fit the linear model f(x,w) = w0 + w1 x and plot the posterior over w. %% % This file is from pmtk3.googlecode.com function bayesLinRegDemo2d() setSeed(1); % seed 0 reproduces Bishop...
584178d016785068b20d9bd6e3f105f9b29d2046f1bec8d9c6832ca7b6c73829
MATLAB
5,076
158
fprintf('Generating Full Export Stack...') ExportStack=zeros(stackSizeX,stackSizeY,NumSlices,NumChannels,1,'uint16'); for c=1:NumChannels for z=1:NumSlices TempImage=Channel(c).RawData_Filtered(:,:,z); %%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%% TempImage=imrotate(TempIm...
950f2604b06ad64b7248cc2ae90b611f365f59c7f31efd8058e701a4fdc3b575
MATLAB
5,076
157
% create 4D map (cluster_map, xtime, xtrial) mkdir([DIRresults, '/sorted']); word_tasks = (find(task_data(:,2)<3)); noise_tasks = (find(task_data(:,2)>2)); for q=1:(size(task_data,1)) clear cluster_map_single_trial for chan=1:1024 cluster_map_single_trial(:,mod_elecX(chan), mod_elecY(chan)) = trials_al...
c11a5121858c4d15501f8b6e4b8ac669968c06d9350641d1693e291a4f281d05
MATLAB
5,078
168
function opt = ft_checkopt(opt, key, allowedtype, allowedval) % FT_CHECKOPT does a validity test on the types and values of a configuration % structure or cell-array with key-value pairs. % % Use as % opt = ft_checkopt(opt, key) % opt = ft_checkopt(opt, key, allowedtype) % opt = ft_checkopt(opt, key, allowedtype...
4d03ff3b14021ba8e3bfabb121d11c93c104a01ea3de6ef5944118c560005ae4
MATLAB
5,084
160
function [stats,st] = lme_fit_EM(X,Zcols,y,ni,e) % [stats,st] = lme_fit_EM(X,Zcols,y,ni,e) % % Linear mixed-effects estimation by expectation maximization. % % Input % X: Ordered design Matrix (according to time for each subject). % Zcols: Vector with the indices of the colums of X that will be considered % as random e...
6d6c36e2f92a7ecac48c1d47ab080758f67e04a51c7866e8efb8e09172f71071
MATLAB
5,084
152
%% initialize settings % A short script to open an image and calculate the position of a fruit fly % against a light background. Output graph is a sanity check for the path % of the fly. Written by Jeff Stafford. Some code and ideas from Dan % Valente's FTrack suite were used, as well as the 'Division' layer mode % fo...
5dcd9dd5bd9c37306241ad2806a8c231114558215c681ab552ef5796a93bf34f
MATLAB
5,086
177
function [hres,hres2] = displayResults(posterior,out,y,x,x0,theta,phi,alpha,sigma) % compares VB posteriors with simulated parameters and hidden states if isempty(posterior) return end hres = figure; pos = get(hres,'position'); set(hres,'name','Simulation results','position',[pos(1),pos(2)-pos(4),pos(3),2*pos(4)]...
a4a19ad3e64e67f2161d6d588aecde59f18dd55ae3160c4973e6decb7897978b
MATLAB
5,086
194
function result = WriteYaml(filename, data, flowstyle) import yaml.*; if ~exist('flowstyle','var') flowstyle = 0; end; if ~ismember(flowstyle, [0,1]) error('Flowstyle must be 0,1 or empty.'); end; result = []; [pth,~,~] = fileparts(mfilename('fullpath')); try import('org....
e41b85df38d6ee53442f344df47197ff6fcd083edc676248bf2a21d1a96cc500
MATLAB
5,086
141
function I = imwrite2( I, mulFlag, imagei, path, ... name, ext, nDigits, nSplits, spliti, varargin ) % Similar to imwrite, except follows a strict naming convention. % % Wrapper for imwrite that writes file to the filename: % fName = [path name int2str2(i,nDigits) '.' ext]; % Using imwrite: % imwrite( I, fName, wri...
227c7cc34dd8fad1901810cec4ef75f528fc79283801f0cd1865e7158d0acca0
MATLAB
5,087
132
<<<<<<< HEAD % function [power_SUM_FMFR, power_DIFF_FMFR, fm_depth]= get_fmfr_power(file2use, FM_carrier, FMrate) % Assumes function [power_SUM_FMFR, power_DIFF_FMFR, fm_depth]= get_fmfr_power(fmfr_filename, FM_carrier, FMrate, doSaveMAT) %% Important parameters mat_filename= ['DataOut' filesep fmfr_filename '_PowerVa...
5dea3d06c12329e7bfb190b0948d77eaa6d60d7d068dea841dd164c4f627d271
MATLAB
5,087
115
function [ titleStr, settings, results ] = createLabelsFromFeatures( dataview, settings ) % This function stores feature information for all datapoints within % the current selection in one or several new labels. % % Ids -- specified as a matlab expression, e.g. Ids='1' or Ids='1:10' % % ...
5fa48de54662dc1e27ebb33b2aee2a26671724e1552d9362b658cb18fc8f4714
MATLAB
5,087
153
function [basis,gradbasis]=legs(x,dir,n,scale) % usage: [basis,gradbasis]=legs(x,dir,n,scale) % % only singular at origin % returns the values and directional derivatives of (n+1)^2-1 basis functions % constructed from spherical harmonics at locations given in x and, for the % gradients, for (in general non-normaliz...
d312ae92b95b3048ac427a07ba79cb1354e7233dc75aee570891378350652124
MATLAB
5,089
181
function [out1,out2,out3] = myginput(arg1) % almost the same as matlab's ginput, but does not change the mouse pointer out1 = []; out2 = []; out3 = []; y = []; c = computer; if ~strcmp(c(1:2),'PC') tp = get(0,'TerminalProtocol'); else tp = 'micro'; end if ~strcmp(tp,'none') & ~strcmp(tp,'x') & ~strcmp(tp,'micr...
fd7af197de9fd1222609f002dcf1c9ca99a93a44c5db72a4a11f94574d00b478
MATLAB
5,089
130
% Clear workspace and command window clear; clc; % Define the file names file1 = 'scopus_2019-2020.csv'; file2 = 'scopus_2021-2022.csv'; file3 = 'scopus_2023-2024.csv'; file4 = 'PubMed_2019-2024.csv'; % Read each CSV file into a table data1 = readtable(file1); data2 = readtable(file2); data3 = readtable(...
d42bc68fde40e2f24868022be7f5907ef5f02a4d3f9c5b3d65130d79bdf05ace
MATLAB
5,091
125
function sta = calculateGratingFlickerSTA(stimmat, runningspikes, stimorder) [Nt, Nstimuli] = size(stimorder); Ncells = size(runningspikes, 1); [Nyx, Nbase] = size(stimmat); % use GPU in a smart way: break in chunks of different pixels!!! %-----------------------------------------------------------------...
fbcf5794b2a21f4523239144499a02f7b4d619cee9f6d68271570aef62c54538
MATLAB
5,092
156
function matrix2latex(matrix, filename, varargin) % function: matrix2latex(...) % Author: M. Koehler % Contact: koehler@in.tum.de % Version: 1.1 % Date: May 09, 2004 % This software is published under the GNU GPL, by the free software % foundation. For further reading see: http://www.gnu.org/licenses/licenses...
3093e94e7b484adc3da82e72ec9519a6919f09a0a41456f15acc36e3b60cd956
MATLAB
5,093
177
function [lambda,x,flag,its,x0,trace] = eig_sshopmc(A,varargin) %EIG_SSHOPMC Shifted power method for real/complex eigenpair of tensor. % % [LAMBDA,X]=EIG_SSHOPMC(A) finds an eigenvalue (LAMBDA) and eigenvector (X) % for the real tensor A such that Ax^{m-1} = lambda*x. % % [LAMBDA,X]=EIG_SSHOPMC(A,parameter,value...
471419b7fc0df29fbe27fbc006a23184d87caf8d4c09831e246ce30308b0356f
MATLAB
5,095
128
function [OutputBins UnSortedEntries,ComboMatchingInfo]=CustomComboBinning(InputVals,BinEdges) %Use Bin Edge of NaN to automatically include or Inf to include anyting %that is not 0 % InputVals=Grouped_Measurements.Verified_Quantifications.BoutonSorted(BoutonCount).All_Binned_Data.All_STORM_Bins(STORM_...
7e9464e1e0b306c2d5d780d7f1340de940963ba0db356ac3654d3a2b35dab6ae
MATLAB
5,095
173
function BVpoint2txt(puntos,np,fiduciales,filename,elec_name,del_elec) % <*LAN)<] % v.0.9.1 % % BVpoint2txt write to NAME_XYZ.txt % _coorsystem.json % _electrodes.tsv files % BVpoint2txt(cfg) % BVpoint2txt(puntos,np,fiduciales,filename,elec_name) % % cfg. % ...
5c523e625908938857838d7b420e10ae7d4e14930c12e60d3b8e3146ecf5a090
MATLAB
5,097
207
function [limit, LAN] = search_lim(LAN, therhold, finn) % search time limit for lost % of the dates, and graphic % Pablo Billeke 15.4.2009 % limit = time limit (in seconds), % % therhold = therhold in porcentege eg. 80 o [90 80] % % fin = axe "x" of grafic % % if nargin < 3 finn = []; end % crea latencias % ...
a489f111f5c1aadab98c53bf040c3e67b4d5448d93286af7256dfd1b106b76e5
MATLAB
5,097
148
function avw_write(avw, fileprefix, IMGorient, machine, verbose) % avw_write - write Analyze files (*.img & *.hdr) % % This function is a wrapper for % avw_hdr_write and avw_img_write. % % avw_write(avw,fileprefix,[IMGorient],[machine],[verbose]) % % where the input avw is a struct (see avw_read): % % avw.hdr -...
1e5a16e90f2cb9e629172f34188e1e3479fd506db2ae4754975666bffa563ce8
MATLAB
5,098
145
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This script generates the parcellation sets based on Seitzman (2020). % % It is necessary to generate set 1 before making set 2. % % % % Author: ana.tr...
5cd377f4b08deaaae7dd51a9dd0558582763ad6e82d46da98bb6ef61ad24c05b
MATLAB
5,098
147
function M = symfixedrankYYcomplexfactory(n, k) % Manifold of n x n complex Hermitian pos. semidefinite matrices of rank k. % % function M = symfixedrankYYcomplexfactory(n, k) % % Manifold of n-by-n complex Hermitian positive semidefinite matrices of % fixed rank k. This follows the quotient geometry described ...
435709b33fdd566e636bb929447cf00dca9e57b07292d6896ede42b6f2fc7bc2
MATLAB
5,099
111
function model = adaBoostTrain( X0, X1, varargin ) % Train boosted decision tree classifier. % % Heavily optimized code for training Discrete or Real AdaBoost where the % weak classifiers are decision trees. With multi-core support enabled (see % binaryTreeTrain.m), boosting 256 depth-2 trees over 5,000 features and % ...
6dda730bc8f05f6a35803af4c4af93ef4712968da47eb6798a18e491bfde098c
MATLAB
5,099
113
function scored_replay = replay_scoring(data,analysis_type) %scores replay events using several measures- line fitting, weighted %correlation, "pac-man" path finding, and spearman correlation coefficient. %modify_decoding.m subroutine is run to zero probability if no spikes from %good place fields occur during time bi...
2c22b75fe18b7da537bbbfed4023ff87814c027d85dc7f635840b4fad750da8f
MATLAB
5,100
164
%CCG - Compute multiple cross- and auto-correlograms % % USAGE % % [ccg,t] = CCG(times,groups,<options>) % % times times of all events % NOTE: spiketimes in SECONDS. % groups group IDs for each event in time list (should be % integers 1:nGroups) % % alter...
8adb67eb6af7d34acee86e8a0f71da95ca6726288bf563906656b1d5dcfa577c
MATLAB
5,101
190
function [] = violinPlotsStats(data,opts) % violinPlotsStats significant box of violins :) % % Inputs: % data: A matrix of data. Each row is an observation. each column is a % variable. % opts: a structure of options with potential fields: % yl: y-limit (e.g. [ymin ymax]) % sigLevel: significan...
9838a377e5240fdcccd5f2514cb75e5cac62cfe904ddadc1eaffa2e71f7229f7
MATLAB
5,102
193
function [E, D] = multivariate_decomp(C,x,y,method,realflag,thr) % MULTIVARIATE_DECOMP does a linear decomposition of multivariate time series, % based on the covariance matrix. % % Use as: % [E, D] = multivariate_decomp(C,x,y,method) % % Input arguments: % C = covariance matrix (or csd) between input time series ...
97bea670c3c7bb959b29c055479c6707cd7a5ae77453d58b9d3a8fa69398ceeb
MATLAB
5,103
149
function data = analyze_AB_coloc(params,roi,AB_chs) %calculates correlation and volume overlap between different AB channels folder = params.parentfolder; %Extract parameters xystep = params.xystep; zstep = params.zstep; nchannels = length(AB_chs); for im1 = 1:nchannels %nested loops because we are looking at coloca...
ec6a1dfdec2c51d6580cfc0bc219541d99925254837b6a460f63e456bf2ca4bd
MATLAB
5,104
157
%% (Predict-Spike Plotters: Plot) Error-Rates Stateordered % %Draw accumulating L0, L1, L2 prediction errors State-wise to evaluate %trends. Post-spike states distributions are sorted by x0 State. % % Because yyaxis elements are not handled well in inkscape, if saving plots % as SVGs, save the left and right axe...
ed000f2974ea0b2b4217ac31175b878ccd1316807a8da7b13ed87e2f9cc4430a
MATLAB
5,106
113
function [TempContrastedImage,TempContrastedImageColor,cMap_Contrasted]=... Adjust_Contrast_and_Color(Temp,TempContrastLow,TempContrastHigh,ColorCode,ColorScalar) WarningStatus=warning; if isempty(ColorScalar) ColorScalar=1; end if ColorScalar==1&&(TempContrastHigh-TempContrast...
9f475cd8c835c055e885962c17b24739b84ade3380cadfcf65bcb2592a7836bf
MATLAB
5,107
132
function [A, strucCorr_score, B, U, V, R, Rp, pVal, Ncca] = CBIG_ASDf_CCA_factorBehavior(ind_scores,... id_keep, reg, PAPset, path_subInfo, path_behav_scores, path_factorLoading, factor_order,... factor_idx) % [A, strucCorr_score, B, U, V, R, Rp, pVal, Ncca] = % CBIG_ASDf_CCA_factorBehavior(ind_scores, id_keep,...
7bf07e4eb24aa3c2f34055847cb58fffbd65ccefd3e187b24d1d3e3d47fe4a2f
MATLAB
5,109
129
clear all; clc %% data = dir('/DATAPOOL/ERRORMONITORING/SEM_mri_data/P*'); vois_dir = '/DATAPOOL/ERRORMONITORING/group_level_analysis/ROIs/Atlas/AAL3 and Brainnetome/'; dACC_voi = [vois_dir, 'ACC/dACC/A32p_BN.nii']; AI_voi = [vois_dir, 'bilateral_AI/bilateral_AI_BN.nii']; put_voi = [vois_dir, 'putamen/bilateral_puta...
ff73278d3e873cb2f0732adb1741a00341e7cf08947b085d97ee494532924ecb
MATLAB
5,109
148
% First-kind integral equation on the unit cube, Laplace single-layer. % % This is basically the 3D analogue of IE_SQUARE1. % % Inputs (defaults are used if not provided or set empty): % % - N: number of discretization points in each dimension (default: N = 32) % - OCC: tree occupancy parameter (default: OCC = 512)...
7affb7def8a274ef4a24f1cb1266c0bec884cb3624f44e9cbd50c0c56b6f30ee
MATLAB
5,110
215
function [omckk,Tckk,Rckk] = compute_extrinsic_init(x_kk,X_kk,fc,cc,kc,alpha_c), %compute_extrinsic % %[omckk,Tckk,Rckk] = compute_extrinsic_init(x_kk,X_kk,fc,cc,kc,alpha_c) % %Computes the extrinsic parameters attached to a 3D structure X_kk given its projection %on the image plane x_kk and the intrinsic camera param...
f9a663dd0ddb596a4220161d4aa75f07a0f63b2e62f6460ba06815ad8e46657b
MATLAB
5,110
205
outDir = '/nrs/branson/mayank/janOut/'; trkDir = '/nrs/branson/mayank/janTracks/'; dd = dir(fullfile(outDir,'*.mat')); %% params = singleViewTrackingDefaultParams; parfor ndx = 1:numel(dd) curIn = fullfile(outDir,dd(ndx).name); curOut = fullfile(trkDir,dd(ndx).name); if ~exist(curOut,'file') trackSingleView...
b0a6d6c42b514e912d5afdde6526f503052d717ee0319f3c51c4bef25db19347
MATLAB
5,111
160
%% Load features found for the FIXED and MOVING images loadExperimentParams; loadandCrop; %------------------------------Load Descriptors -------------------------% %Load all descriptors for the MOVING channel descriptor_output_dir_moving = fullfile(params.OUTPUTDIR,sprintf('%sround%d_%s/',params.SAMPLE_NAME, ... ...
0314fa7d556bf87e2550f34a7de738ee19e7802b92f71b96fd19fb1897bfa449
MATLAB
5,112
187
%init_intrinsic_param % %Initialization of the intrinsic parameters. %Runs as a script. % %INPUT: x_1,x_2,x_3,...: Feature locations on the images % X_1,X_2,X_3,...: Corresponding grid coordinates % %OUTPUT: fc: Camera focal length % cc: Principal point coordinates % kc: Distortion coefficients % ...
5afccb0f3c04a6c20288353c09775481dbfcf88aea7427f92de4f825ef294219
MATLAB
5,113
152
function output = SeparateSubVolumes(telem,tnode) % Assuming multiple material regions are delineated in 'telem', this routines % returns: % tags : list of nodes inside _every_ subvolume (one node per subvolume) % tags{:,1} = coordiantes % tags{:,2} = region ID % % extelem : indices to the elements that ...
c04111208deb18686d4d7705afb40998cce0c6793eff95fe43479922cf8e9587
MATLAB
5,113
175
% MF_DIAG Extract diagonal using multifrontral factorization via matrix % unfolding. % % This algorithm exploits the fact that only a small subset of all matrix % entries need to be reconstructed from the top-level skeletons in order to % compute the diagonal. % % Typical complexity: same as MF. %...
d1098dd3115ae91484cfd1029c8f7eddc677fbfb1561c89826ae94ed708a1758
MATLAB
5,113
146
% Five-point stencil on the unit square, Poisson equation. % % This example solves the Poisson equation on the unit square with Dirichlet % boundary conditions. The system is discretized using the standard five-point % stencil; the resulting matrix is square, real, and positive definite. % % This demo does the followin...
4850608b4c959155ea6ada71d5344e6d41b2cfd958753be0336407a3a85743c4
MATLAB
5,115
158
function [processedImagePair] = imageRegistrationWorkflow(imPair) % Imoving and Istatic are either matrices containing images or full paths % to images intended to be read % processedImagePair is a structure with all relevant results from operations in % this function % ImgMoving.mask is the same size as ImgMoving.w...
600f84f37465c50ce716a8da4bf5476f0a7a62861f912ee7f4da85862ae504a9
MATLAB
5,115
132
%% empirical_var_to_smvgc % % Calculate sampling distribution for conditional frequency-domain MVGC from % generated time series data for a specified VAR model % % <matlab:open('empirical_var_to_smvgc.m') code> % %% Syntax % % fE = empirical_var_to_smvgc(A,SIG,m,N,x,y,fres,H0,nsamps,mtrunc,decayfac,regmode,acmaxlag...
e83d2a62851750c827320efc202065e9b96cda03cd9f65533ce4a193de632896
MATLAB
5,116
144
function ret = w_spm_ov_movie(varargin) % Movie tool - plugin for spm_orthviews % % This plugin allows an automatic "fly-through" through all displayed % volumes. Apart from pre-defined trajectories along the x-, y- and z-axis, % resp., it is possible to define custom start and end points (in mm) for % oblique trajecto...
f2bdf0e64c5e2b827bfc009ae68ca032965337c91d4c3a59bc26e5b2b1b77b75
MATLAB
5,116
158
function solidmesh2nirfast(fn,saveloc,type,sdfile) % solidmesh2nirfast(fn,saveloc,type) % % converts solid/tetrahedral meshes that are generated in outside % applications to nirfast mesh format. % % fn is the location of the .ele file or a structure % saveloc is the location to save the nirfast mesh % type is the mesh...
5b6a3689de91e58adeaed427a7e6b572fecc30698b41905dc6326ad9027d1395
MATLAB
5,120
128
function [X, HMM, features, Kernel, err] = simulate_statemeans(datadir, hmmdir, HMM_name, n_subj, betwgroup_diff) % [X, HMM, feat, Kernel, err] = simulate_statemeans(HMM_name, n_subj, betwgroup_diff) % % simulate timecourses for two groups where the group difference lies in % the mean vector of one HMM state, then ...
85a5a0533b3e56e14e1693b41e6726ef7aee4a09a254a2e22d7a0d884c4e2c5d
MATLAB
5,121
236
% 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,...
dcbd7bd86f94a19e301ab6883c464773b8432eaf53149ad8ab5221b3bf15809c
MATLAB
5,122
113
function [TempContrastedImage,TempContrastedImageColor,cMap_Contrasted]=... Adjust_Contrast_and_Color_Single(Temp,TempContrastLow,TempContrastHigh,ColorCode,ColorScalar) WarningStatus=warning; if isempty(ColorScalar) ColorScalar=1; end if ColorScalar==1&&(TempContrastHigh-TempC...
0ebc4ab0c43dcc8a1fa304c355823b8de51d5471448fb970bd475851e11880fc
MATLAB
5,123
152
function pairsOut=View_Clear_Brain_ROI_Corr_fc(Anat,IM,M,dataOut,fc,Pmax,params) % % This function draws ROIs on the brain and connecting rods colored by sign % of correlation values in C. This can be the fc correlation itself if that % is passed, or it can be the correlation of brain fc with behavior if that % ...
d5729329a4b30e18c9462519e9e009462637ffebc204a5267131741721025c5f
MATLAB
5,124
185
function result = ReadYamlRaw(filename, verbose, nosuchfileaction, treatasdata) import yaml.*; if ~exist('verbose','var') verbose = 0; end; if ~exist('nosuchfileaction','var') nosuchfileaction = 0; end; if ~ismember(nosuchfileaction,[0,1]) error('nosuchfileexception parameter must be 0,1 or missing.'); end; i...
d052d682b0c3fcdf2b7697d65fb94c9ff45a5bd100584da99aebe0baf82708df
MATLAB
5,125
173
%% MVGC non-stationarity demo % % Demonstrates usage of the MVGC toolbox for non-stationary time series by % "vertical" (windowed) regression on multi-trial data, for a minimal 2-variable % VAR with linear trend and sinusoidally varying causal coefficient. Data is % generated using the <var_to_tsdata_nonstat.html |var_...
06dc64e2e48a0434ca62e8362bb1651c0214cca9b42f475732e4e6249bbb386e
MATLAB
5,127
150
clear close all basePath = 'D:\InVivo\S1-Baclofen\2022-04-07_Baclofen\4-baseline_220407_141157\'; load([basePath 'Grid-LFP-DS.mat']) load([basePath 'Grid-TimeAligned-LFP-Gamma-DS.mat']) load([basePath 'Grid-TimeAligned-LFP-Beta-DS.mat']) load([basePath 'Grid-TimeAligned-LFP-Theta-DS.mat']) % load('D:\InVivo\Ba...
3df43e5d9f6f2379fb7586e88611f879c673b163ffe3063ed9dd16fe20a19ad8
MATLAB
5,127
183
function [hfigs,savenames,errprctilespts] = PlotOverlayedErrorPrctiles(varargin) [freezeInfo,lpos,... errprctilespts,gtdata,nets,legendnames,prccolors,exptype,... conddata,labeltypes,datatypes,... prcs,... hfigs,figpos,savedir,savenames,dosavefig] = myparse(varargin,... 'freezeInfo',[],'lpos',[],... 'errpr...
c783e8712c883c0914dc78839dde360c7537860a2909c466c4846aa863cdb075
MATLAB
5,127
104
function linfields = calculate_linfields(opS, modelParam, varargin) % calculate_linfields.m % % Calculate linear place fields, based on Jadhav lab methods. % Adapted from ReplayNet code, with assumption of simulating a single % trajectory for a single epoch. % % Inputs: % - opS: logical spike matrix, opS(ithCell,ithT...
1161c02a40f8701ee3d5d0a6949732d2c46f2c6ebc046f74ba4b22ded23aa88a
MATLAB
5,128
132
%% OBSOLETE SEE HPOptim.m %% td = load('f:\aptStephenCPRInvestigate20180327\trnData20180503.mat'); %% TTFILES = { ... 'trntrk_sh_trn4523_gt080618_made20180627_cacheddata_hpo_outer3_easy_fold01_tblTrn_hpo_outer3_easy_fold01_tblTst_prm0_20180713_20180716T150605.mat' 'trntrk_sh_trn4523_gt080618_made20180627_cacheddata_hp...
738c4703340b8020d8d81e51af65623e70137c0e882ed797654d3f12fa116754
MATLAB
5,129
188
function [dat] = read_combined_ds(dirname, hdr, begsample, endsample, chanindx) % READ_COMBINED_DS reads electrophysiological data from a collection % of files that are located in one directory, where each of the files % should contain one channel and should have the same sampling frequency % and number of samples as ...
30f5750294694b0547b6003f1330e13d107e345e1992f08ade7d049d6fd9187e
MATLAB
5,130
192
matfiles= {'/home/mayank/temp/romainOut/side1/bias_video_cam_0_date_2016_06_22_time_11_02_02_v001.avi.mat',... '/home/mayank/temp/romainOut/side2/bias_video_cam_1_date_2016_06_22_time_11_02_13_v001.avi.mat',... '/home/mayank/temp/romainOut/bottom/bias_video_cam_2_date_2016_06_22_time_11_02_28_v001.avi.mat'}; calibf...
b2e286c7a5d6f8cb77a44b025378cb03322d79f701c76a64e668eb244edc4fbe
MATLAB
5,130
193
% SplitDepAngleByRT load('TrioEEGBehAnalysis.mat','vars') [nPP,nConds,nDr,nTr] = size(vars.srt); %% plot rew eff for depangle for slow/fast RTs % only distr trials depAngle = vars.depAngle(:,[3 4],:,:); srt = exp(vars.srt(:,[3 4],:,:)); % medianRT = nanmedian(x, [4 3 2]); % rtCutOffs = [medianRT, medianRT]; rtCutOff...
6e6cc3406f4ade93e698451c37ff85a31169cd3daffc3baf2021113dc2c3428f
MATLAB
5,131
220
%% Clustering [NCell,NRace] = size(SCE.Race); [IDX2,sCl,M,S] = kmeansopt(SCE.Race,100,'var'); % M = CovarM(SCE.Race); % IDX2 = kmedoids(M,NCl); NCl = max(IDX2); [~,x2] = sort(IDX2); MSort = M(x2,x2); %SCE.Race clusters R = cell(0); CellScore = zeros(NCell,NCl); CellScoreN = zeros(NCell,NCl); for i = 1:NCl R{i} = ...
bd6b8b4696950b0a14ec9cfa7ed3a5558e9d6b6f4258137b63fc6f17232e6e12
MATLAB
5,131
159
% This script is an adaptation of Dr. J. Fortin's original source code. % The original source code can be found at https://github.com/Jfortin1/ComBatHarmonization/tree/master/Matlab % % brief demo % data = randn(1000,10); % batch = [1 1 1 1 1 2 2 2 2 2]; % mod = [1 2 1 2 1 2 1 2 1 2]'; % p=10000; % n=10; ...
94dbb9907f593386db208daa082ac2ea7041dbcb2b5d7672e3e15909eb9455a8
MATLAB
5,133
215
function [omckk,Tckk,Rckk] = compute_extrinsic_init_fisheye(x_kk,X_kk,fc,cc,kc,alpha_c) %compute_extrinsic % %[omckk,Tckk,Rckk] = compute_extrinsic_init_fisheye(x_kk,X_kk,fc,cc,kc,alpha_c) % %Computes the extrinsic parameters attached to a 3D structure X_kk given its projection %on the image plane x_kk and the intrins...
a9aa283a3ce45be94901de7b06fd82c9920fbd378aea58511c1b35dc2d31447d
MATLAB
5,136
175
% % 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 classdef Coder < handle methods(Static) function out=NumMatLab(name...
2c6061a2223c1bb53d523f3d3350c4ae9a4439456524a8719cd4a705311de88c
MATLAB
5,139
107
%% Description % In this example, we showcase the use of custom phase functions (i.e., % other phase functions than Henyey-Greenstein). % % We will use the farField output array to see the angular distribution of % scattered light, so we set model.MC.farFieldRes = 21. Our light source % will be a pencil beam, going str...
45fb27a1d4797d5c8b1b3d6e0fc266132f7b5a69583b0f6c03e5fa1182964512
MATLAB
5,141
173
function [best_score, A, flag, best_perm] = score(A,B,varargin) %SCORE Checks if two ktensors match except for permutation. % % SCORE(A,B) returns the score of the match between A and B where % A is trying to be matched against B. % % We define matching as follows. If A and B are single component ktensors %...
45164dd124dbb48a784039e47ae2b271e9adceb02f849cab4eb841390dabce32
MATLAB
5,142
132
function [timelock] = ft_appendtimelock(cfg, varargin) % FT_APPENDTIMELOCK concatenates multiple timelock (ERP/ERF) data structures that % have been processed separately. If the input data structures contain different % channels, it will be concatenated along the channel direction. If the channels are % identical in t...
482d01b36065164e5cd79b6858882d8b1db134323475684d7c765589ed1c2bad
MATLAB
5,144
201
function Raster(unit, evt, tRange, varargin) % Optional arguments % 'fig', figure number for plotting over and existing figure % default values for optional arguments fig = []; task = 'RL'; % only RL works for now trials = {'xx'}; showEvents = false; colors = {'r','b', 'g','c','m','y'}; tickWidth = 1.5; tickS...
d3287777098dd26631b16a8357676dd3494fdc09779569f840a5de034410448b
MATLAB
5,145
178
% :Usage: % :: % % [y, pI, S, I] = hpfilter(y, TR, HP, spersess, varargin) % % :Inputs: % % **y:** % data to be filtered % % **TR:** % TR in seconds % % **HP:** % Highpass filter cutoff in seconds % % **spersess:** % scans per sessions; vector with length = # of sessions % % :Opt...
fc5fb9ce5b63064f0576752125e85c5e2e036f6444e735a39aa24871f82b83d0
MATLAB
5,145
153
function skel = Skeleton3D(skel,spare) % SKELETON3D Calculate the 3D skeleton of an arbitrary binary volume using parallel medial axis thinning. % % skel = SKELETON3D(img) returns the skeleton of the binary volume 'img' % skel = SKELETON3D(img,mask) preserves foreground voxels in 'mask' % % MATLAB vectorized implementa...
6e4e1710760add7cc84f5b9a9a16c0a2ffc749bb4dece9ae873692c3e78d3b03
MATLAB
5,147
98
function f = PlotSegmentedHand(ChannelMap, grid_tags, pbt_regions, palm_seg_idx, dbt_regions, dors_seg_idx, text_size) if nargin < 7 text_size = 0; end % Load and scale ref images [a,~,~] = fileparts(mfilename('fullpath')); orig_size = [1200, 1050]; % Palmar [palm_ref_img, ~, palm_r...
7a43ece05191b0e15be0b16a29243c9d0e8b3441a3e2a4462f71981233314310
MATLAB
5,149
136
% GonzalezPereyra_etal_Fig_04 2024 function GonzalezPereyra_etal_Fig_04 load ([pwd '/Data_GonzalezPereyra_etal_Fig_04.mat'])%#ok<*LOAD> [SortedMatrixBehav,maxIndexBehavShort]=SortThisMatrix_Mean(ZscoresShort,2000,3000,[]); %#ok<*ASGLU> clim([-1 3]) hold on plot([3000 3000],[0 size(ZscoresLong,1)],'w--') pa...
331176708768d04e5567263afff1d894833d029ba8813f845f62fdcd4b97ece9
MATLAB
5,151
142
function [lfp, spike, stm, bhv] = spass2fieldtrip(dirname, varargin) % SPASS2FIELDTRIP reads data from a set of SPASS data files and converts % the contents into data structures that FieldTrip understands. Note that % dependent on the SPASS data it might be required to change some % hard-coded parameters inside this f...
dd8a713365be4f12de3f966d52738a6dab973cb3a11e7c653223aa11a6a3a53c
MATLAB
5,151
145
function [responseData, runLabels] = sl_responseDiscrimData(respTime, ... trialCount,respSecs,refreshRate, blockLength, keyCodes, response, ... order, runNum, itiSeq, jitSeq, jitter) % use like this: % load('taDetect7','order'); % load block order from stimFile % load('20141028T144433_taDetect5.m...
678843456ab7a190ab07da56da0d03aa4ab98e679210cb7d2817a5b877f477c5
MATLAB
5,153
118
function h_executeGroupCalcRoi3(handles) global h_img3 [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); set(handles.pauseGroupCalc,'Enable','on'); if ~isfield(currentStruct, 'activeGroup') || isempty(currentStruct.activeGroup.groupFiles) disp('No active group!') ...
780e2545f7afe2c12105a5e741ba893a4071b7610d391eba23386f9970769bf9
MATLAB
5,154
162
function voldata = iimg_reconstruct_3dvol(dat, volInfo, varargin) % Reconstruct a 3-D volume from a dat index list % % :Usage: % :: % % voldata = iimg_reconstruct_3dvol(dat, volInfo, [optional args]) % % :Optional Inputs: if entered, will write .img file to disk % % **'outname':** % followed by output name...
0aaac19171719c23ec282c17bc75c310dff9b40de44923b356a16c1baefa6b67
MATLAB
5,158
129
function handles = plot_arrow( x1,y1,x2,y2,varargin ) % % plot_arrow - plots an arrow to the current plot % % format: handles = plot_arrow( x1,y1,x2,y2 [,options...] ) % % input: x1,y1 - starting point % x2,y2 - end point % options - come as pairs of "property","value" as defined for "line"...
1202c373289b6c94251df2bcc16a5ced1eb478c934dfe0b5689cbbb01fd425d4
MATLAB
5,158
158
function write_gdf(filename, hdr, data) % WRITE_GDF(filename, header, data) % % Writes a GDF file from the given header (only label, Fs, nChans are of interest) % and the data (unmodified). Digital and physical limits are derived from the data % via min and max operators. The GDF file will contain N records of 1 sampl...
ce25abc4118a6cf28adbf86dd2b192074bcd866664d4ebe1e7ae76de7c4693fa
MATLAB
5,160
129
function [X, A] = PCA_stochastic(A, k) % Example of stochastic gradient algorithm in Manopt on a PCA problem. % % PCA (principal component analysis) on a dataset A of size nxd consists % in solving % % minimize_X f(X) = -.5*norm(A*X, 'fro')^2 / n, % % where X is a matrix of dimension dxk with orthonormal ...
5e3c0e83bbb7f2f02cf30f0e29ab9503ebbb1638cfcb2374fd346b062e247359
MATLAB
5,162
183
function D = pdist2( X, Y, metric ) % Calculates the distance between sets of vectors. % % Let X be an m-by-p matrix representing m points in p-dimensional space % and Y be an n-by-p matrix representing another set of points in the same % space. This function computes the m-by-n distance matrix D where D(i,j) % is the ...
02501b2a6b4b6df9cdc197206be96be23b8ea151c0d13e019f141d904f91188f
MATLAB
5,163
146
%% parameters setting clear; hemi={'lh';'rh'}; hm=1;%editme 1-L 2-R %surf_tpe='inflated'; %edit me surf_tpe='sphere'; dataDir = '/home/xianchige/DXH/data/zhuyashuo/data/locating/GLManalysis'; %% load data ssname='sub_zhuyashuo'; interptype = 'linear'; % what type of interpolation? surfsuffix='orig'; [numlh, numrh] =...
223cac52df5a99c8e2e9d6bf06edf79d4ad9971f7362dc11448292b04301f012
MATLAB
5,163
148
function [data] = ft_denoise_synthetic(cfg, data) % FT_DENOISE_SYNTHETIC computes CTF higher-order synthetic gradients for % preprocessed data and for the corresponding gradiometer definition. % % Use as % [data] = ft_denoise_synthetic(cfg, data) % where data should come from FT_PREPROCESSING and the configuration s...
b57dc6205a479e3c7925dd2615ff2e802d23894026de21e49215c972b47c6b72
MATLAB
5,163
101
%% 共空间模式 | common spatial patterns (CSP) 不可在main中调用,仅可单独使用 %% one vs rest Multiclass or two-classes 目标函数法 % how:N个类别得到N个投影矩阵,对每个投影矩阵取最佳的2m个方向(前后各m个),特征矩阵为2m*N维 % 优点:N类需要计算N个投影矩阵,即使N很大,计算量也不会很大 % 缺点:由于rest类别是混合类别,内部特征并不统一,因此很难找出最优的投影方向,即结果可能并不是最优的 % Inputs % EEG_train: 训练集各类别的所有trials: % EEG_train.x: E...
b5f75812b4d180d01e2c37e571d1e1ff762c127fe9aad573b8227aa2d281a8ae
MATLAB
5,163
220
%%% 2024-10-01: Example T1 map script, working on phantom data %%% Note that this data was acquired using a purposely lowered voltage for %%% the inversion pulse, to create a situation with incomplete inversion %%% Author: Shaihan Malik, King's College London %% T1 map reconstruction addpath('lib'); %%% flag for whic...
fa65c023301475c81a592bc3a505c7d41bcd9969f0e9b94dd80c6776bb31864f
MATLAB
5,163
68
clear;clc;close all ROOTPATH = strcat(NoveltySU.utils.getRootDirPath(mfilename("fullpath"), 4), "Data\Processed Data\"); cd(NoveltySU.utils.getRootDirPath(mfilename("fullpath"), 2)) protStr = "Active duration"; temp = NoveltySU.utils.dirItem(strcat(ROOTPATH, protStr), "spkData.mat"); popRes = cell2mat(cellfun(@(x)...
17a641bf0bc9332024ee4c0aa930426dbd7eef21c68448599f15d1ea67a784d8
MATLAB
5,164
186
function [model, loglikHist] = mixGaussDiscreteMissingFitEm(data, K, types, varargin) %% Class-conditional is product of Gaussians and multinoullis % p(x|z=k) = prod_{j in C} N(x_j|mu_{jk},sigma_{jk}) * ... % prod_{j in D} discrete(x_j | beta_{jk}) % This file is from pmtk3.googlecode.com % Parameter of m...
84c0764a4c15c86072f577ee9c52f2edcf0678102092ff4f67c3cc7f11f330eb
MATLAB
5,164
142
%% GCCA_tsdata_to_smvgc % % Calculate _unconditional_ frequency-domain MVGC (spectral multivariate % Granger causality) from time series data by "traditional" method (as e.g. % in GCCA toolbox) % % <matlab:open('GCCA_tsdata_to_smvgc.m') code> % %% Syntax % % f = GCCA_tsdata_to_smvgc(U,x,y,p,fres,regmode) % %% Argum...
9b6b5e2521ed3e441f450820e9ec286611d1774ea6852d31a6c805cae549a9b3
MATLAB
5,164
150
function [dictmatchidx,minEditDist] = shaharTieUniqueGene(transcript,confidence,dictionary,labels,confThresh,numDrops,editScoreMax) %Note there is a hardcoded delimiter as a temporary hack DELIMITER = char(9); %Pass in the cropped transcript and confidences, ie excluding primer rounds L = length(transcript); %First,...
b0450830c7e2fc06ed2281d716e0d3d4ace72d014b997cd82ed94c467120d727
MATLAB
5,164
156
function [posterior, out] = demo_noiseAR1 () % // VBA toolbox ////////////////////////////////////////////////////////// % % [posterior, out] = demo_noiseAR1 () % Demo for linear system with auto-regressive AR(1) state noise % % The class of generative models that the toolbox can deal with is actually % more general th...
13786347aca5761161c5393b08d6994a269971afa2428bc39e80ed9fae3ccc56
MATLAB
5,166
146
function [collect] = channelcombination_lan(channelcmb, datachannel) % CHANNELCOMBINATION creates a cell-array with combinations of EEG/MEG % channels for subsequent cross-spectral-density and coherence analysis % % You should specify channel combinations as a two-column cell array, % cfg.channelcmb = { 'EMG' 'MLF3...
62976db2794b9babdf392f3ec06dd8d76e664125bb81de83512e6a4205cbfdcb
MATLAB
5,166
135
function SlidingTimeDecode(AllTrialData,Labels,DecodeLabels,TimeWindow,TimeStep,StepSize,OutDir,Tag,varargin) % Plots confusion matrix (decode analysis) for decoding each (relevant) % condition. % [~,PThresh] = Utilities.ProcVarargin(varargin,'PThresh',0.001); [~,PThresh] = Utilities.ProcVarargin(varargin,'PThr...
9dad3feff7704a221a6e35187f0420673994c0074bf3d608aba92407753c03cb
MATLAB
5,166
141
function UnitIDs = FindSignificantUnits(TaskLabel,varargin) %FindSignificantUnits Returns list of significant units, by pval % if only mirror units desired, include the following in the varargin in % the function call % ('Mirror','AllTrialData',AllTrialData); [varargin,PThresh]=Utilities.ProcVarargin(var...
d39ff3eb07c745119b24e052c08bb128025cec1f506e36cb5603bfeba70fb6d8
MATLAB
5,166
149
function [data] = ft_denoise_synthetic(cfg, data) % FT_DENOISE_SYNTHETIC computes CTF higher-order synthetic gradients for % preprocessed data and for the corresponding gradiometer definition. % % Use as % [data] = ft_denoise_synthetic(cfg, data); % % where data should come from FT_PREPROCESSING and the configuratio...
124cdc1979feb408adc1cb71211bf0b5ff68b86b4d5c890b43d497b4e279614b
MATLAB
5,168
154
function draw_figureS1AB(p,decRes) % % This code is for drawing figure S1AB % % %% settings % score index dimIdx = 1:14; catIdx = 15:48; emoIdx = 1:48; % get roi Idx indivIdx = ismember(p.roiDescrip,{'VC','TPJ','IPL','PC','STS','TE','MTC','Insula','DLPFC','DMPFC','VMPFC','ACC','OFC'}); subIdx = ismember(p.roiDescrip,{...
80a45b1137600a5d60c094a4b7293ce3350045ca55dde93c9e17fa6d0cf42197
MATLAB
5,169
157
classdef ParameterVisualizationTgtCropRadiusID < ParameterVisualization % Visualizes the crop used for identity linking: a labeled animal, % aligned head-up when head/tail landmarks are specified, with the % link_id_cropsz_height/width rectangle overlaid. properties % If true, a prop for this pvObj is curr...
272d9702ed09453574616c07f87f7f8d37f18462812c6f7f63264f350300f690
MATLAB
5,174
122
function varargout = DPABISurf_Utilities(varargin) % DPABISURF_UTILITIES MATLAB code for DPABISurf_Utilities.fig % DPABISURF_UTILITIES, by itself, creates a new DPABISURF_UTILITIES or raises the existing % singleton*. % % H = DPABISURF_UTILITIES returns the handle to a new DPABISURF_UTILITIES or the hand...
96e5071df3ec34835f7fcb094bc6e75acbce5b602be3f5b57b6d5ff688b3abe4
MATLAB
5,174
165
% Read data within a mask (described by maskInfo) for 3-D or 4-D image data % See examples below. % % :Usage: % :: % % [dat, maskInfo] = iimg_get_data(mask, imageNames, varargin) % % :Inputs: % % 3 input options for mask: % 1) a filename string, e.g., 'mask.img' % 2) volInfo structure (from iimg_read_im...
046630d7b28940c3c6895390bf34f8ee8e868d7364cae912797fcf7f9b3fd60b
MATLAB
5,175
161
% To plot PSD estimated using DPSS sequences. % function [Pxx_dB,freq, ax]=plot_dpss_psd(data_in, fs, optional) % --------------------------------------------------------------------------- % Example: [Pxx_dB,freq, ax]=plot_welch_psd(data_in, fs, 'NW', NW, 'nfft', nfft, ... % 'plot', true, 'plotconf', true, 'xscale', ...
2ae01a4678eb04edd398aa34f6759251e45ecca9646930bc2e5c05bb25bd1402
MATLAB
5,176
149
% Five-point stencil on the unit square, constant-coefficient Helmholtz % equation, Dirichlet boundary conditions. % % This is basically the same as FD_SQUARE1 but for the Helmholtz equation. The % resulting matrix is square, real, and symmetric (at general frequency). % % Inputs (defaults are used if not provided or s...