sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
959e17ae256cfc99951531348f3f23dd75388964e0b227951688d00f38038645
MATLAB
2,819
82
% UNIQUEF: Given a matrix containing group labels, returns a vector containing % a list of unique group labels, in the sequence found, and a % vector of corresponding frequencies of each group. % Optionally sorts the indices into ascending sequence. % % Note: it might be necessary to...
05855b0ce681b26e625bb9fe4dd4520849c35065f4e9c83c620bd201f2e70048
MATLAB
2,820
71
function x = RemoveJumpsAndSmooth(x, max_allowed_flips, jitter_threshold, smooth_std,filter_def) % Removes large jumps in data, smoothes the removed regions % ARGUMENTS % x a vector of something. NaNs may be used in place of % known bad samples % max_allowed_fl...
609aa12e1def13a08e9d10ff60cd97f6a5e313fdc4ad2b8876a5da30db99f076
MATLAB
2,820
70
function java_dnd(jObj, dropFcn) % Set Matlab dropFcn for java object, like JavaFrame or JTextField. % 170421 Xiangrui Li adapted from dndcontrol class by Maarten van der Seijs: % https://www.mathworks.com/matlabcentral/fileexchange/53511 % Required: MLDropTarget.class under the same folder if ~exist('MLDrop...
ea44666cc7d42f95b33e371f40b81e2e626783ff9ef83cf7f541a163f8a5776a
MATLAB
2,820
85
% eeg_retrieve() - Retrieve an EEG dataset from the variable % containing all datasets (standard: ALLEEG). % % Usage: >> EEG = eeg_retrieve( ALLEEG, index ); % % Inputs: % ALLEEG - variable containing all datasets % index - index of the dataset to retrieve % % Outputs: % EEG - out...
254193fe9610fb53ea98be6ec00ffee3f8a3dde5a47b73829d3edb8425fba84e
MATLAB
2,824
110
function[N,B,E] = isi(data,T,err,Nbins,plt) % Calculate the inter-spike-interval histogram % Usage: [N,B,E] = isi(data,T,err,Nbins,plt) % % Input: % Note that all times have to be consistent. % % data - structure array of spike tim...
29e202019f87f25ae85f095ba2181e9590aeb887fdbb4b91c89cefcd2cb8ccb2
MATLAB
2,824
94
function updateExpFolder(inputFolder, outputFolder) % Update experiment folder from Recording computer to Analysis computer % % USAGE % updateExpFolder(inputFolder, outputFoder) % % INPUT % inputFolder Experiment folder in recording computer, can be % multiple folders % outputFolder ...
a57a2d795a340ec24c127b4bd6164c385c5826deeefb6999254e6ed5fb09ab45
MATLAB
2,824
63
function index_changes = CBIG_gwMRF_save_index_trans_btwn2versions(new_dir) % index_changes = CBIG_gwMRF_save_index_trans_btwn2versions(new_dir) % % This function generates a cell array to save the index changes for all % Schaefer2018 parcellations. % % Input: % -new_dir: % Path of the new parcellation fol...
0adf9ef3ea8732a7043d50e125219a2b18c3b2a80849413751cdafd977c0c443
MATLAB
2,825
79
function setTightInset(ax, targetWH, anchorXY) % Set axis Position so its full footprint matches a target size. % % This function adjusts ax.Position so that the *total footprint* occupied by % the axes INCLUDING tick labels, axis labels, and title matches a specified % width/height. It uses ax.TightInset (the extra sp...
0f62728d99a04ff8ab2a42bbfe180131524fab526100b1dcb0f3aa2e77d07cf0
MATLAB
2,825
73
function [all_erp_all_midi] = Trinh_MiniTrialMaker(data,midi_names,code_corresponding_to_midi,n_offsets,prestim) % % midi_names = cell with strings containing the names of the files of % interest % code_corresponding_to_midi = trigger codes, present in the FieldTrip % data structure, associated to the midi_names (...
1b2776210db7aaec8db757ad0ed190b24a58cff1123d829ba81c57984dcdfa42
MATLAB
2,825
54
function obj = set_layout_options( obj , varargin ) % set_layout_options Change figure layout options % % 'name',value pairs: % 'position': specify the position of the gramm plot in the figure, using % normalized coordinates (between 0 and 1) [left bottom width height] % Defaul...
f7bf4a1b02798f81507ce3c1af4690e2e9843a100083eabda7a64cf9d31af269
MATLAB
2,825
92
function [occupancy, xdim, ydim, pos_locs] = sOccupancy(self, xdim, ydim, mergeepochs, dim) % Spatially scaled occupancy map % % Returns occupancy matrix of time spent in bins of dimension 3x3cm^2 be % default. occupancy = root.Occupancy(xdim, ydim) where will return a matrix of % dimensions xdim by ydim(:,2) % % Remem...
796cb02826bdfc4024102ad21a9bb41923b9ee414510487f2f775a54096b31f4
MATLAB
2,827
87
function AUC = ea_logit_regression(Ihat_train, Ihat, Improvement, training, test) % Fit logit model, compute ROC and find the optimal threshold. % Compute confustion matrix for the test set (can be the same as training) % if Ihat_train was not provided, then we have in-sample analysis if Ihat_train == 0 Ihat_trai...
ffbd8cd52d15c8523f88c177ec4d59d46dd01242ab29cf4081a8a55420924223
MATLAB
2,827
86
function c = ea_colorlover(n,plot) % Version 2.0 % c = colorlover(palette_number,plot); % c is a matrix with 5 colors in matlab color codes % e.g. plot(x,y,'color',c(1,:)) will plot in color 1 from the matrix % if n is empty a random palette will be chosen if ~exist('plot','var') plot = 0; end if ~exist('n','var...
32f7e39802323bcc73dea69cda60f937b16b06e08854271153acbdc05c692023
MATLAB
2,828
103
function [rescaled_mat, rescale_range] = G_Rescale( mat, rescale_range, varargin) % Re-scale a mtrix to a new range % % Input % mat, matrix to rescale % rescale_range, [lo_boundary, hi_boundary] range the input will be re-scaled to % varargin{1}, margin in percentage [0, 0.5) % % modified from http://stackoverf...
7bf251a1bc7497e717b3496f89537241775107256613ff63167401e66ba1d816
MATLAB
2,828
68
function obj=facet_grid(obj,row,col,varargin) % facet_grid Create subplots according to factors for rows and columns % % Example syntax (default arguments): gramm_object.facet_grid(row_variable_column_variable,'scale','fixed') % This function has two mandatory arguments: the variable used % to separate data by rows of ...
b19c1c90ed3ffda7a42c3e93cefab665f7a351481cd229990839fa33e37218ce
MATLAB
2,828
77
function [node,elem,face]=cgals2m(v,f,opt,maxvol,varargin) % % [node,elem,face]=cgals2m(v,f,opt,maxvol) % % wrapper for CGAL 3D mesher (CGAL 3.5 and newer) % convert a triangular surface to tetrahedral mesh % % http://www.cgal.org/Manual/3.5/doc_html/cgal_manual/Mesh_3/Chapter_main.html % % author: Qianqian Fang (fangq...
e88073367924c7dbd02350e933d61867de00b05ef9081cbde85570f6e2e36cc1
MATLAB
2,828
83
function [mask,Xdiff]=plotsigdiff(X1,X1err,X2,X2err,plt,t,f) % Function to plot significant differences between two time-frequency arrays X1 and X2 % given errors X1err, X2err. % Usage: mask=plotsigdiff(X1,X1err,X2,X2err,plt,t,f) % % X1 err and X2err contain upper and lower confidence intervals for X1 and X2 % The plo...
ad729a905cdcc812998235f8c89bcf7c284515abbf863eb297b45f2bd4981db3
MATLAB
2,829
82
function [concentrations, factor] = calcConcentrations(T,data_counts,BMD,intervene_matrix,numReplicates,keep_species) % This file is a part of the MDSINE program. % % MDSINE: Microbial Dynamical Systems INference Engine % Infers dynamical systems models from microbiome time-series datasets, and % predicts biologic...
6fd4bbde9d9c413a6bb622ccf71d52cd21e244cc58adbe4ae08ec38840369f50
MATLAB
2,831
91
function [a,succ] = palm_nextperm(a) % Given a sequence of integers "a", returns the next lexicographic % permutation of this sequence. If "a" is already the last possible % permutation, returns a vector of zeros of size(a). % Note that to shuffle vectors, they must be supplied as % column vectors (N by 1). % % Usage:...
7470b701aec88d2ef504d203505d61b410dc7bfa01a385204d4ae1731e9d97b5
MATLAB
2,834
59
function Obj = SOFAaddVariable(Obj,Name,Dim,Value) %SOFAaddVariable % Obj = SOFAaddVariable(Obj,Name,Dim,Value) adds a user-defined variable % to the SOFA structure OBJ. NAME must be a string with the variable name % ('API', 'PRIVATE', or 'GLOBAL' are not allowed). DIM is a string % describing the dimens...
b2aefcfd7331f9c0848236feb3d23673fec2dfafa755f8ec3b59038cf0b4742b
MATLAB
2,834
74
% std_precomp_worker() - allow dispatching ERSP to be computed in parallel % on a given cluster. % Usage: % >> feature = std_precomp_worker(filename, varargin); % % Inputs: % filename - STUDY file name % % Optional inputs: % Optional inputs are the same as for the std_precomp function. No...
f6844ecc3c24fc33374131093bcf00485d9afa0c161ff206b51386b6b08245c1
MATLAB
2,835
120
function testspecgram(data) %cd 'C:\Documents and Settings\Admin\Desktop\'; %data=wavread('bird109_26519_on_Aug_19_16_33.wav'); params.tapers = [3 5]; params.fpass = [100 20000]; params.Fs = 44100; params.pad = 2; max_time =10; % seconds per run max_tapers = 150; increment = 1.5; profile on nsamples = 1000; if 1 s...
788415c5357cd8296b49124e500ecdb5625eeafdca3a5cf31c998b09fc8e6448
MATLAB
2,836
70
% Simplified version of flirtmat2worldmat removing the various dependencies % to SPM. Instead using PaCER's Nifti Classes which in turn rely on the % Nifti Toolbox. Thus it works with .nii.gz files too and has a lot less % dependencies in general. % 2017 Andreas Husch. % % Based on flirtmat2worldmat by Ged Rigway. See...
b35b59385eee1c89956ac7d65f22179980e05081b153184bef77dd96138e4ca9
MATLAB
2,836
80
function enigma_scatter(ax, x, y, varargin) % Usage: enigma_scatter(ax, x, y, varargin) % % REQUIRED INPUTS % ax = figure axis % x, y = two maps (ndarray) % % OPTIONAL INPUTS % scatter_color = color of data in scatter plot, default is black % linear_fit = add linear fit on top of scatter, ...
2bee7c4d0fe284055dd26ea6c99a9b589a335d63885258f5703a034c4263c76a
MATLAB
2,838
70
function analyzeCalciumExperiment(headpath,fileexpnum,imskip,expskip,correction,fluor,copy,savemode) %give this function the experimental path you want to start in %and the filename and experiment number (ie vt019532_f3e4) %correction if the motion correction needs to be done, fluor if the dff %hasn't been extracte...
f5e54f54951fa32ab0622a3e750a4f30fd76e37ab1d810fb730589b24d44fc93
MATLAB
2,840
89
function PlotCSD(csd,varargin) %PlotCSD - Plot current source density. % % USAGE % % PlotCSD(csd,<options>) % % csd current source density (see <a href="matlab:help CSD">CSD</a>) % <options> optional list of property-value pairs (see table below) % % =======================================...
27a970d2722cf9a25054eaf0063880195bbad5bd9fce83942d8538b0cb3ef250
MATLAB
2,842
76
% std_selsubject() - Helper function for std_erpplot(), std_specplot() % and std_erspplot() to select specific subject when % plotting channel data. % Usage: % >> data = std_selsubject( data, subject, setinds, allsubjects); % % Inputs: % data - [cell array] mean data for each ...
adbc48259c771f532090e3df8f7c7184067397e0503fa9377437bd9ea0c81958
MATLAB
2,842
86
function mov=videoread(fname,varargin) %VIDEOREAD Read an video file in a mannter compatible with Matlab's % built-in AVIREAD function, but using a videoReader object to do % the work instead. % % MOV=VIDEOREAD(FNAME) % Read the video file FNAME into the Matlab movie structure MOV. MOV ...
bbaf0ec6604c036dee1a8ac764d3f113cf5613023c02df4c07510d737ab0210c
MATLAB
2,844
88
function header = constructNPYheader(dataType, shape, varargin) if ~isempty(varargin) fortranOrder = varargin{1}; % must be true/false littleEndian = varargin{2}; % must be true/false else fortranOrder = true; littleEndian = true; end dtypesMatlab = {'uint8','uint16','uint32','uint64','int8','int16'...
df067ae677c0273dcd1fc6b56923f89f9cada86b745d8b0afe76c9ea87780682
MATLAB
2,846
120
function y = geo_mean( x, dim, w ) narginchk(1,3); %GEO_MEAN Internal cvx version. % % Size check % try if nargin < 2, dim = []; end [ x, sx, sy, zx, zy, nx, nv, perm ] = cvx_reduce_size( x, dim ); %#ok catch exc rethrow( exc ) end % % Third argument check % if nargin < 3 || isempty( w ), w =...
fffd842ead6405d8f39f50735906f4812ad2c8914fe5956946e30cc704ac694e
MATLAB
2,846
59
function [param, qMetric, fractionRPVs_allTauR] = loadSavedMetrics(savePath, saveTSV) % JF, Load saved quality metrics % ------ % Inputs % ------ % % ------ % Outputs % ------ qMetric = parquetread(fullfile(savePath, 'templates._bc_qMetrics.parquet')); fractionRPVs_allTauR = parquetread([fullfile(savePath, 'templates....
c566fee00e9cf55b1e18de6f400c38caedc883fc9715157aa739b7e2b4866f56
MATLAB
2,848
84
function [img, v2smap]=surf2vol(node,face,xi,yi,zi,varargin) % % [img, v2smap]=surf2vol(node,face,xi,yi,zi,'options',values,...) % % convert a triangular surface to a shell of voxels in a 3D image % % author: Qianqian Fang (fangq <at> nmr.mgh.harvard.edu) % % input: % node: node list of the triangular surface, 3 colum...
f00154440a15af736b7f9e130f38413da99a0554f4075264c6063af0b1b93985
MATLAB
2,848
77
% pop_compareerps() - Compare the (ERP) averages of two datasets. % % Usage: % >> pop_compareerps( ALLEEG, datasetlist, chansubset, title); % Inputs: % ALLEEG - array of datasets % datasetlist - list of datasets % chansubset - vector of channel subset % title - plot title % % Author: Arnaud De...
11896dbaa7de65ef2aa4c9e2785fb1117a2884e485b70f9501534a967a11da45
MATLAB
2,850
70
% Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions % %========================================================================= % % Copyright (c) 2008 Thomas Yeo and Mert Sabuncu % All rights reserved. % %Redistribution and use in source and binary forms, with or without %modification, a...
4e475a3030c240c55377c8fb212b3e019f95913d985a1f19485c7b58e0fe8d00
MATLAB
2,850
95
function y = vsmooth(x,frame,mode) %VSMOOTH Smooth a vector using mathematical functions % % Y = IOSR.DSP.VSMOOTH(X,FRAME) smooths the input vector X by calculating % the running RMS over a series of frames. FRAME specifies the frame % characteristics; it can be set to: % % a scalar - this will be used ...
749c42800fb5a623a7d83dfdb1e777a0b4a7ab71b3c90a6a8be49c5158bd1351
MATLAB
2,850
77
% getipsph() - Compute "in place" (m by n) sphering or quasi-sphering matrix for an (n by t) % input data matrix. Quasi-sphering reduces dimensionality of the data, while % maintaining approximately the "original" positions of the axes. That is, % quasi-sphering "rotates back" a...
21e0673d706a8e7482d374365df6bfb1cd92175d87b0add8637ad3265524f8b8
MATLAB
2,851
111
function S = ea_cleartune_generateSfile(rightsets,leftsets,S,volcur) % rightsets - [amplitude;k1, k2, k3,...], e.g. [2.0; 0.0,-100.0,0.0,0.0] % -cathodic 2 mA stimulation via the second contact % % volcur - 1 for voltage-controlled, 2 for current-controlled rightsets(isnan(rightsets)) = 0; leftsets(isnan(leftsets)) ...
33d58d31d1336a7f93f94733a26c48c43ab36e911736ed1ad799f6ab593e8fdb
MATLAB
2,851
67
function [hM,meta,stimPar]=SOFAconvertSOFA2ARI(Obj) % OBJ=SOFAconvertSOFA2ARI(hM,meta,stimPar) converts the HRTFs described in hM, meta, and % stimPar (see ARI HRTF format) to a SOFA object. % % Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences; % Licensed under the EUPL, Versi...
990bd24565263a619df328f14f5dbcd9ac57b3175a3150ff93ced856d816d050
MATLAB
2,851
114
function Y=ea_detect_edges_3d(varargin) %% function detect_edges_3d for Nii-Images % Andreas Horn, 2014 % in: X (image matrix), alpha (threshold), useimgtoolbox (use image toolbox % or replacement function). X=varargin{1}; alpha=varargin{2}; if nargin==3 useimgtbx=varargin{3}; else useimgtbx=0; end Y=X; dime...
b35dc1d713ceb30aed272a11414bd1d31e2e2ebbd42ffcadfda189e202afc1f8
MATLAB
2,851
112
function y = prod( x, dim ) % Disciplined geometric programming information for PROD: % PROD(X) and PROD(X,DIM) are vectorized versions of multiplication % so in most cases it would be incompatible with DCPs. Therefore it % has not been implemented to support DCPs. DGPs however support % pr...
19f9d8d898a6f649f4c0e8bbd5ac3859c8f743a79262e9f681abb2b81f3a51d9
MATLAB
2,853
86
function topo = get_adj_mat(V, C) % GET_ADJ_MAT Build the full topology (adjacency) description of the % vertex model tissue from its vertices and cell-vertex lists. % % topo = GET_ADJ_MAT(V, C) computes the vertex-vertex, vertex-edge, % cell-vertex, and cell-edge adjacency matrices, plus the edge list, % from t...
b707d333ef01883a0bbb10dbcd4ce7c199d6e929ab30cfdc3494606e53bf2c08
MATLAB
2,853
99
function [y,ii]=stkProj(stk,range,dim,type) % Usage ... [y,ii]=stkProj(stk,range,dim,type) % % Range is the start-end indeces for the desired % dim dimension to take the projection of % default is max in all directions. select option only works % in 1 direction % % Ex. zMax=stkProj(data,[14 70],3,'max'); or zMax=stkPro...
19be9811fa90ae9886ba92ad373535f48b1a588ef1f58591b801103d23e847d5
MATLAB
2,854
84
function outputfile = inflate_file(inputfile) % INFLATE_FILE helper function to uncompress a compressed file of arbitrary % compression type. Returns the full path to the extracted file or % directory, which will be located in a temporary location. % Copyright (C) 2012 Eelke Spaak % % This file is part of FieldTrip, ...
d7374201c319ea7251c312e69131d5d46e404f1b201b698b50a8d7f2640f8c01
MATLAB
2,854
61
% This script is only valid because I confirmed that the red and green % channels are equally affected by the optic flow stimulus when the gain is % equal across both channels. Moving forward I will endeavor to keep the % gains the same so that I don't have to do this bs [fs,frs,fds] = combineFluordata('67A04_aug05...
d2a29fd2663d4d7489edf1a491972acde437aca0b3ae81d2935bf9a752cb91c5
MATLAB
2,855
110
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % demo script for surface smoothing %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% preparation % user must add the path of iso2mesh to matlab path list % addpath('../'); % user need to add the full path to .../...
cd1d19710e440a470914c831f649c191e2b641bf5a24793a76ea52d823d4cdd8
MATLAB
2,856
69
function [y, m] = std(varargin) %STD Standard deviation. % For vectors, Y = STD(X) returns the standard deviation. For matrices, % Y is a row vector containing the standard deviation of each column. For % N-D arrays, STD operates along the first non-singleton dimension of X. % % STD normalizes Y by N-1 if N>1...
5215d1ad7f993bd1922bd81e880fad78ca0ca9578546889df8a99d0b25783bcc
MATLAB
2,859
134
% Figure 6.2: Penalty function approximation % Section 6.1.2 % Boyd & Vandenberghe "Convex Optimization" % Original by Lieven Vandenberghe % Adapted for CVX Argyris Zymnis - 10/2005 % % Comparison of the ell1, ell2, deadzone-linear and log-barrier % penalty functions for the approximation problem: % minimize phi(...
c81e9ba4766143c5e78aa21de40c3ef4f714ebabe83a832aba0517f2a0046fbc
MATLAB
2,859
85
function varargout = tsvread( varargin ) %[data, header, raw] = tsvread( file ) reads in text file with tab-seperated variables. default value for data is nan. %alternative input/output option is suppluying header strings %[col1, col2, col3, ..., header, raw] = tsvread( file, header1, header2, header3, ... ) %header is...
ad98c1b5ddfec39ca8ded69d509941587bcaf3662f82308b76dc62ea82c7690e
MATLAB
2,860
76
function [ ] = calc_simulation( cfg ) % This file is a part of the MDSINE program. % % MDSINE: Microbial Dynamical Systems INference Engine % Infers dynamical systems models from microbiome time-series datasets, and % predicts biologically relevant behaviors of the ecosystems. % Copyright (C) 2015 Vanni Bucci, Georg G...
092b0651e1270d56c124428c3cae795dbdbe7aafccbfd46a195144bd80d1444c
MATLAB
2,861
91
function derivative = bz_Diff(samples,timestamps,varargin) %Diff - Differentiate. % % USAGE % % derivative = Diff(samples,<options>) % % samples data to differentiate % measured in number of samples (default = no smoothing) % <options> optional list of property-value pairs (see ...
1664f4b63e346ccbaec8b7d7a5b1e59ef4b479a184f8eb38bd278f82ea68fc73
MATLAB
2,861
112
% Figures 6.8-6.10: Quadratic smoothing % Section 6.3.3 % Boyd & Vandenberghe "Convex Optimization" % Original by Lieven Vandenberghe % Adapted for CVX Argyris Zymnis - 10/2005 % % Suppose we have a signal x, which does not vary too rapidly % and that x is corrupted by some small, rapidly varying noise v, % ie. x_cor =...
fac5921b7b2a1ca080602b07f355b5e1275d6058e836c385f1dfcc406cfc2180
MATLAB
2,861
112
function PipeRaster(cellin, varargin) % Scatters the time course of a single element on ydim with the pipe '|' % character. Existing plot must be 'held' % PipeRaster(cellarr_in, ['color'], 3xN matrix of color values, ['ys'], % N array of y indeces for each row, ['ydim'], num) % ARGUMENTS: % cellin is the only requir...
2a7107b1af8c383ba38c511d895f52cd608d4acbfa65486e22047e60ac2715be
MATLAB
2,862
64
%%PEAK AMPLITUDE %Vessel Diameter (rr1a) tstart=1; tstop=2; rr1a_percentmeansC=[]; rr1a_percentmeans=[]; rr1a_percentmeansSM=[]; rr1a_percentsemC=[]; rr1a_percentsem=[]; rr1a_percentsemSM=[]; %Capillary(StimCombined.m, stimAllTrials.mat) rr1a_percentmeans=nanmean(all_rr1a_percent(tt>=tstart&tt<...
bace761eba51d2e48b7aff1748c7b11df617f1c431cec79e939eae6c97ba80fa
MATLAB
2,863
71
%% Step 2 Tiny Dancers: Epoching and artefact rejection clear all clc addpath 'C:\Users\tnguyen\OneDrive - Fondazione Istituto Italiano Tecnologia\Documenti\MATLAB\functions' addpath(genpath( 'C:\Users\tnguyen\OneDrive - Fondazione Istituto Italiano Tecnologia\Documenti\MATLAB\toolboxes/Giac_ToolBox/')) addpat...
b8cf9f465011d54eeb5cd23184fae1f588eabb2ad307862d59d9a8e4b597e727
MATLAB
2,865
90
% fast_t1 - Computes a 2D matrix of one sample/repeated measures t-tests % relatively quickly. % % Usage: % [p_values, t_scores, mn, stder]=fast_t1(data,tail,verblevel); % % Inputs: % data - 2D matrix of data % % Optional Inputs: % tail - [1 | 0 | -1] If tail=1, the alternative hypothesis is that ...
c74ed28b20dacc9f1c6512886a32ce2f3e61563b9cfa96a38f3aa2d9296f742a
MATLAB
2,866
63
% Example 6.3: Optimal input design % Section 6.3.2, Figure 6.6 % Boyd & Vandenberghe "Convex Optimization" % Original by Lieven Vandenberghe % Adapted for CVX by Joelle Skaf - 09/26/05 % % Consider a dynamical system with scalar input sequence u(0),u(1),...,u(N) % and scalar output sequence y(0),y(1),...,y(N) related ...
6d0e19344f1fddc896b70e4c033dcd0ca2a4e310fd6fff37003fa204470c2b1c
MATLAB
2,867
107
clear; close all; clc; addpath(genpath('../functions/')); SUBINFO_FILE = '../../subInfo/rid_sex_mDoB_yDoB_mExam_yExam_ageExam_dx_icv_bl.csv'; GMICV_FILE = '../../vbm_810bl/gmVolAndICV/rid_gmVol_icv_bl.csv'; % !!!!!! % '_memRegEF' for regressing out each other; '' for not tail = ''; %% MMSE baseline cd('../jointGLM...
62b1f5fa3345f65445b85a082444ce8e254b265c2fbcc6eb7c9e901c08a751cb
MATLAB
2,868
63
function plotbox(ax, data, axloc, color, alpha, bxw, lw, msize, plotY) % Makes a boxplot hold(ax, 'on'); % Get values md = median(data); qtls = quantile(data, [0.25 0.75]); iqrange = iqr(data); outmx = qtls(2) + 1.5*iqrange; outmn = qtls(1) - 1.5*iqrange; outinds = data > outmx | data < outmn; outs = data(outinds); mx...
b9530ae891b240ce4827b1485671bbd52c19bd7b3e09d364c17406162d6bd393
MATLAB
2,869
86
function ext = palm_checkprogs % Test whether some external programs or toolboxes % are available, namely, FSL, FreeSurfer, SPM and % Jimmy Shen's NIFTI toolbox. % % ext = checkprogs % % 'ext' is a struct containing one field for each % of these applications, each being containing % a 0 (false) or 1 (true) depending o...
2729ba0687f798d18222495d58e750fb796282dff0c50446afe866b25c82bb4c
MATLAB
2,870
72
function [Cxy, F] = cmtm(X,Y,NW,Fs) %CMTM Coherence function estimate using the multitaper method. % Cxy = CMTM(X,Y) estimates the coherence between two equal length % vectors vectors X and Y using Thomson's multitaper method. The % coherence is a complex function of frequency, with magnitude betwee...
cf1af0fa9c53064869c83533f50e2fb2a146bbedf736f374d61d380d5a692e0b
MATLAB
2,870
82
function [fig, varargout] = draw_surface_bluewhitered(surface_to_plot, data_to_plot, hemisphere, medial_wall, with_medial) % draw_surface_bluewhitered.m % % Draw data on surface using blue-white-red colormap for % negative-zero-positive values % % Inputs: surface_to_plot : surface structure with fields % ...
d26f6ce040173722e274bad95579cc2219e279b330bc7dabd2bc1ccc52778d4b
MATLAB
2,871
101
function newmap = bluewhitered(m) %BLUEWHITERED Blue, white, and red color map. % BLUEWHITERED(M) returns an M-by-3 matrix containing a blue to white % to red colormap, with white corresponding to the CAXIS value closest % to zero. This colormap is most useful for images and surface plots % with positiv...
1b45779f23c1cb2483db77fc9a68bf51fc6fc6d65d5a2b8f621e4aeb82e09cde
MATLAB
2,875
83
function [dat, lo, hi] = maskToSignificant(stat_vec, sig) % maskToSignificant Prepare a statistic vector so a range threshold keeps only % the significant voxels. % % [dat, lo, hi] = maskToSignificant(stat_vec, sig) % % Returns stat_vec with the NON-significant voxels moved to a sentinel value % below lo, togeth...
87947b204bc899866136601a0abdda9874de9b8d5220dec866b80910f32a66e9
MATLAB
2,875
68
% Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions % %========================================================================= % % Copyright (c) 2008 Thomas Yeo and Mert Sabuncu % All rights reserved. % %Redistribution and use in source and binary forms, with or without %modification, a...
754110c5745d5841c20e7541416f32424abdb632833915bd5a636f9eac92dda7
MATLAB
2,876
101
function [y, se] = predict(varargin) % Interpolate a fit produced by locfit(). % % predict(fit) produces the fitted values at locfit's selected points. % predict(fit,x) interpolates the fits to points specified by x. % % Input arguments: % fit The locfit() fit. % x Points to interpolate at. May be a matr...
e71c15adad2a4567b04664d84432a5c16abeadacb1296ad17656e852d74219b1
MATLAB
2,876
114
% windows() - Returns handle to window function or window % % Usage: % >> h = windows(t); % >> h = windows(t, m); % >> h = windows(t, m, a); % % Inputs: % t - char array 'rectangular', 'bartlett', 'hann', 'hamming', % 'blackman', 'blackmanharris', or 'kaiser' % % Optional inputs: % m - scalar window len...
31133c163ff0781cb98ee880dfb2a9363a5de618552735b74db9a3155be228ba
MATLAB
2,877
83
function [status, version] = bfCheckJavaPath(varargin) % bfCheckJavaPath check Bio-Formats is included in the Java class path % % SYNOPSIS bfCheckJavaPath() % status = bfCheckJavaPath(autoloadBioFormats) % [status, version] = bfCheckJavaPath() % % Input % % autoloadBioFormats - Optional. A boole...
e1ee7c9e7fba9788a39fda5955f410f310c7a88c25d0ea7a164e9e94d8d1f1dc
MATLAB
2,878
62
function [coords_mm,trajectory,markers] = ea_runpacer(options) [tmat,ctnii] = ea_getrawct2preniimat(options); niiCTSPM = NiftiModSPM(ctnii); % load nifti using SPM instead of PaCER default Nifti Toolbox if ~isfile(options.subj.recon.rawCTMask) ea_genctmask(options); end switch options.prefs.reco.mancoruse cas...
da779237b78071b2595fb927be3a6b2654ee3614942d600de25b78c7e158f2cd
MATLAB
2,881
94
classdef ( Hidden ) Node < dynamicprops %uix.Node Node % % n = uix.Node(o) creates a node for the handle o. % % Node is a helper class for managing trees of objects and associated % listeners. % Copyright 2009-2015 The MathWorks, Inc. % $Revision: 1165 $ $Date: 2015-12-06 03:0...
3560b001cf14c092db88126570fc47549e03051564e99571d2ee18728ee53c29
MATLAB
2,884
69
function CBIG_ASDf_plotConjunctionUniqueMaps_wrapper(output_dir) % CBIG_ASDf_plotConjunctionUniqueMaps_wrapper(output_dir) % % Wrapper function to plot conjunction and unique maps for RSFC factors % % Input: % - output_dir: % Absolute path to directory where output results will be saved % % Example: % ...
3a537e3c38131e35d6928f515a553a2d273d9e18265111da60792c9a5771cb2b
MATLAB
2,884
110
function [nameStr, errStr]= get_unique_str(entriesCell, defaultStr, nameGenFlag, strucFlag, forceDialogFlag) %function [nameStr, errStr]= get_unique_str(entriesCell, defaultStr, nameGenFlag, strucFlag, forceDialogFlag) % % % Bjoern W. Kreher % 03/04 % % UNIX % Set default flags if ~exist('defaultStr') || isempty(def...
ba102e7d545a21aebe7f35139fd21f5fc3d3652ccc871a624e3548d4c0585a2d
MATLAB
2,884
86
function varargout = sort_dicm(srcDir) % Sort dicom files for different subjects into subject folders. % % subjects = SORT_DICM(dicmFolder); % The optional input is the top folder containing dicom file and/or subfodlers % which may contain dicom files and/or subfolders. % % Optionally, it returns subfolder na...
d7d656c4cc927cfa21b2bcd07d80a9af28cdfcf0656471224e232a56e3f88296
MATLAB
2,884
80
function [outputImg,outputImgArray] = convCoord2Img(coord, imageSize, imageType, bgType) % CONVCORD2IMG convert x-,y- positions to a 2D image % % SYNOPSIS: outputImages = convCoord2Img(coord, imageSize, imageType, bgType) % % INPUT: coord : (matrix) x-,y-positions, with x in 1st col, y in 2nd col % % imageSi...
fbe9ceace51e1bb5532c8dbc66001ec7e77eed7e3c6fcf0fd48abf260286e733
MATLAB
2,886
83
function surf = SurfStatWriteSurf1_nonorm( filename, surf, ab ); %Writes coordinates and triangles to a single .obj or FreeSurfer file. % % Usage: surf = SurfStatWriteSurf1( filename, surf [,ab] ); % % filename = .obj or FS file name. If extension=.obj, writes a .obj file % (ASCII or binary), els...
3e9b732b175e9a35925e858eeeccf2bc5cf4877eb1d5cd3de7e824c7c98a2179
MATLAB
2,888
113
%CompareRecordingPC1.m datafolder = '/Users/dlevenstein/Dropbox/Research/Datasets/BWData/'; figfolder = '/Users/dlevenstein/Code Library/SleepScoreDevelopment/StateScoreFigures/'; %Make List of all Recordings in data folder recordings = dir(datafolder); recordings(strncmpi('.',{recordings.name},1)) = []; %Remove en...
ddd48d5ed70e13ecb18d7b7d22be8336da9038dab50fa88f2dfc8f068c522683
MATLAB
2,888
66
function r = cvx_remap( varargin ) %CVX_REMAP CVX expression type map generator. % This is an internal function used to help filter CVX expressions by type. % Classifications: % 1 - negative constant % 2 - zero % 3 - positive constant % 4 - complex constant % 5 - concave % 6 - real affine % 7 -...
f75d89e74f068c38e3a519128693954859b53da66d8b1bc1d7be3f4743c1a086
MATLAB
2,889
111
function [n, nm, nl, ts, names, m] = nex_marker(filename, varname) % nex_marker(filename, varname): Read a marker variable from a .nex file % % [n, nm, nl, ts, names, m] = nex_marker(filename, varname) % % INPUT: % filename - if empty string, will use File Open dialog % varname - variable name % % ...
4d428af9976f706501f778f193673c4116c0757f90a820e09e71dcfcbe911bc1
MATLAB
2,890
68
function Obj = SOFAgetConventions(sofaconventions,flags) %SOFAgetConventions % % List = SOFAgetConventions() returns a list with supported conventions. % % Obj = SOFAgetConventions(sofaconvention) returns a SOFA object % with all metadata and data for the corresponding sofaconvention. Obj % will be ...
eb61d77db69f4269ccc993a527813b1fd2a5f6c5fb6192da86da058065018874
MATLAB
2,890
60
function [crp, crpH] = rel_phase_cont(data1,data2,samprate) % RELPHASE - calculates the relative phase between two segments, joint % angles, coordinates, etc. It is calculated using the atan2 function in % order to preserve the quadrant in the phase portrait. The sign of the % relative phase is determined from segmen...
c428a18dd26f2715f7ce27356a7ec79bd536131354583497757d2b14aee26f45
MATLAB
2,892
69
function sigma = nonst_stat(data,A,sumV,params) % Nonstationarity test - continuous process % % Usage: % % sigma=nonst_test(data,A,sumV,params) % Input: % Note units have to be consistent. See chronux.m for more information. % data (1d array in samples) -- required % A quadratic coefficient matrix - (Co...
6b5cdc4daf61e02810447336ef5bf91ac9905e677dff23a284c5ec264d7584b6
MATLAB
2,893
81
function [R,Rperm,Rnaned,Rpermnaned,h]=ea_partialRmap(varargin) % creates a correlation nifti file given a set of images and a % regressor ("R map" in Horn 2017 AoN) % ea_Rmap(fis,regressor,outputname,mask,sk,corrtype,covariate) % sk can be 'k','s','sk' % for smoothing and normalization options. Mask only necessary if...
9c4bc16b00ada85063c8afdb2cb99957d328d5589329db8199966335efddd5dd
MATLAB
2,894
73
function out = LaBGAScore_combat_apply(dat, batch, est) % Apply ComBat parameters fitted on a training set to held-out data % % :Usage: % :: % out = LaBGAScore_combat_apply(dat, batch, est) % % :Inputs: % **dat:** p x n data matrix (features x subjects) to harmonize % **batch:** n x 1 batch/site labels for ...
c20bc28a208f34dfa5cae61ef17fdd92160b58718441bd1096237b79fe440d55
MATLAB
2,894
86
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %This scipt is for cleaning 60, 120, 180Hz noise from LFP1000 downsampled signal. %Inputs: animal ID, numchans of your probe %Output: add a LFPvoltage_notch to LFP1000 files together with original LFPvoltage %Writen by SF, 8/1/2021 %%%%%%%%%%%%%%%%%...
ced47ef4b2f840f3cbc80faffc8a82a628a2596921912e58ec3cb944949c7051
MATLAB
2,894
119
function k=ea_concavehull(XYZ,thresh) % This function tries to convert the convexhull generated by Qhull into a % concave hull. Equally, output is in format k [n x 3] which defines n % triangles as rows in XYZ. If the function finds a triangle that has 2 % sides whose midpoints are further away than thresh from another...
b448cd623d7f1ac1dd837e9b495732e2b5a05bc4757c719a663de45e6f80d14b
MATLAB
2,895
81
% eeg_dipselect() - select componet dipoles from an EEG dataset with % reisdual variance (rv) less than a selected threshold % and equivalent dipole location inside the brain volume. % Usage: % >> selctedComponents = eeg_dipselect(EEG, rvThreshold, selectionType, depthThreshold) ...
5f14c528dc09d58fd585beb3809b7e99761529c79fcd9340d1700a41cc321b02
MATLAB
2,897
76
% pop_fileiodir() - import directory into EEGLAB using FileIO % % Usage: % >> OUTEEG = pop_fileiodir; % pop up window % >> OUTEEG = pop_fileiodir( folder ); % % Inputs: % folder - [string] folder name % % Optional inputs: % 'channels' - [integer array] list of channel indices % 'samples' - [min max] sam...
7b35344e39fbe0af6637f2cceae3db6550e927be71c46e9973087d42d8a13de3
MATLAB
2,897
80
function output = SOFAdefinitions(varargin) % SOFAdefinitions % % SOFAdefinitions returns a struct containing definitions like the time % format used in the API. % % SOFAdefinitions('dateFormat') returns the date format % % SOFAdefinitions('APIName') returns the APIName % % SOFAdefinitions('dimensio...
c95e472126e1808eb9f995dbc8823822e4a5001b905ba0acd898fe41ea0aea08
MATLAB
2,897
87
function [ydata,D] = tsne(X, labels, no_dims, initial_dims, perplexity) %TSNE Performs symmetric t-SNE on dataset X % % mappedX = tsne(X, labels, no_dims, initial_dims, perplexity) % mappedX = tsne(X, labels, initial_solution, perplexity) % % The function performs symmetric t-SNE on the NxD dataset X to reduce its ...
86ed4a3e91ba13d7318c1d27ac523e764d8d561895f84a318f3fe0d84cb78814
MATLAB
2,898
86
% readegilocs() - look up locations for EGI EEG dataset. % % Usage: % >> EEG = readegilocs(EEG); % >> EEG = readegilocs(EEG, fileloc); % % Inputs: % EEG - EEGLAB data structure % % Optional input: % fileloc - EGI channel location file % % Outputs: % EEG - EEGLAB data structure with channel lo...
8c6739359f3c0d8823ac8aff5f531ba9c017af82afbe579755152e0302d81248
MATLAB
2,898
91
function Store(variable,name,varargin) %Store - Store variable in memory to avoid redundant computations. % % This function is useful in the following scenario. When processing data % in batches, a function is called repeatedly with different parameters. % Because not all parameters change every time, some computat...
1c3eb3df32ff993f5d7e0dd38161796e4e30775c99b91a53e364844f238178a4
MATLAB
2,899
71
function ea_save_fixed_weights(stimfolder, opt_weights, fixed_weights_values, slider_name, pos_and_neg) % save weights that should not be changed during optimization (fixed weights) % opt_weights - adjustable weights or 0 (all fixed) % fixed_weights_values - from the sliders in ClearTune % slider_name - corresponds t...
c90c15a51302b6a70e37c618914da7697715bcd0ecb357ff99823dd2b4798012
MATLAB
2,901
92
function DBAddVariable(v,eid,name,parameters,comments,mfiles) %DBAddVariable - Save variable in current database. % % Save variable and code used to compute it. % % USAGE % % DBAddVariable(v,eid,name,parameters,comments,mfiles) % % v variable % eid experiment ID (identifier string) % ...
62c256aa2aa35628138e15dfbda50afe4c524f09eede77370857b43364dc62a9
MATLAB
2,903
111
function [V,t,Err] = evoked(data,Fs,win,width,plt,err) % Function to calculate the evoked response given continuous data in the % form time x channels % Usage [V,t,Err] = evoked(data,Fs,win,width,plt,err) % % Inputs % Note that all times can be in arbitrary units. But the units have to be % consistent. So...
d607a50231a43bf04d05838ee41eb8ea99f3d4113223ac3b1b01e4148a7a8359
MATLAB
2,903
95
function splitNSx(splitCount) % splitNSx % % Opens and splits an NSx file in smaller pieces, timewise. % % Use splitNSx(splitCount) % % All input arguments are optional. Input arguments can be in any order. % % splitCount: Defines the number of splits. % DEFAULT: Splits the file in 2 pieces. % % ...
f83ef287ba64b857311e936db8e93490ab0983edd2e111f61e3cc1ba663133b4
MATLAB
2,904
106
function [ probs ] = AssociationLDA2( WP , BETA , W1 ) %% Function WriteTopics % % works on single samples as well as multiple samples if iscell( WP ) % we are dealing with multiple Gibbs samples. Need to average % predictions over these samples. Note that the WP samples do not have % to contain the ...
5c99b966779a9a5f6841f8d61d8666ec6650fd0f52e8624c26f58d9147c12f73
MATLAB
2,905
73
% [kcMap,A0Map] = getLocalDcorr(im,tileSize,tileOverlap,r,Ng,figID) % --------------------------------------- % % Estimate the image local cut-off frequency based on decorrelation analysis % % Inputs: % im 2D image to be analyzed % tileSize Size of a tile in pixels % tileOverlap Spatial overlap between tw...
45f1fbfe6cf3f55fb199ef35a634f851dee4e6079f0c9bc82de93109e1627870
MATLAB
2,906
99
function VisualizeDocs( DP , ALPHA , S , NCHARS , MAXLINES ); %% Function VisualizeDocs %% % Visualize documents in a 2D map %% % |visualizedocuments( DP,ALPHA,S,NCHARS,MAXLINES )| takes the document % strings in |S| and the document-topic count matrix |DP| where |DP(i,j)| % contains the number of times a word i...
9a1147f6fe71968afa3ad38db58018484ab59d11b6955b7ca68e16506be620d0
MATLAB
2,906
81
function [ xi, R ] = cvx_orthog_structure( xi, clean ) %CVX_ORTHOG_STRUCTURE Constructs an orthogonal structure matrix. % CVX_ORTHOG_STRUCTURE(X), where X is an M x N matrix from CVX's % matrix structure facility, determines an orthogonal structure: that % is, a matrix Z of size (N-rank(X)) x N such that X ...
be19df993a852239a867e9581125e63008b83e74288a569903599f1d02327384
MATLAB
2,906
106
function [ probs ] = AssociationLDA3( WP , BETA , W1 ) %% Function WriteTopics % % works on single samples as well as multiple samples if iscell( WP ) % we are dealing with multiple Gibbs samples. Need to average % predictions over these samples. Note that the WP samples do not have % to contain the ...
8049c531328625a34083216b24f8a7a5c953f897a625819dd320e249bfb3c9d1
MATLAB
2,910
93
function cvx_optpnt = semidefinite( sz, iscplx ) %#ok %SEMIDEFINITE Real symmetric positive semidefinite matrices. % SEMIDEFINITE(N), where N is an integer, creates a symmetric matrix % variable of size [N,N] and constrains it to be positive semidefinite. % Therefore, given the declaration % variable ...