sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
3530c091d7f756ac5d0ff4ce21c143e3e50861066d3c7b8f66d2e9ecc948db75
MATLAB
2,087
45
function Neighborhood = CBIG_hMRF_update_whole_brain_neighborhood(Neighborhood_lh, Neighborhood_rh,... Neighborhood_lh_rh, c, d) % Neighborhood = CBIG_hMRF_update_whole_brain_neighborhood(Neighborhood_lh, Neighborhood_rh,... % Neighborhood_lh_rh, c, d) % % This function constructs a sparse matrix with parameters c...
48f44cd1bbe415545a1fb965e5ac3d5b1c9ae0806342fb58dc3f4fb9fac03ccf
MATLAB
2,087
76
function [newnode,newelem]=mergemesh(node,elem,varargin) % % [newnode,newelem]=mergemesh(node,elem,varargin) % % concatenate two or more tetrahedral meshes or triangular surfaces % % author: Qianqian Fang <fangq at nmr.mgh.harvard.edu> % % input: % node: node coordinates, dimension (nn,3) % elem: tetrahedra...
6f6a551f984f64c9f60cd4adb85869f800a1d35fc63c00cdb5bb665cfb2fce13
MATLAB
2,087
59
function [PSTH, trig, sweeps, timeAxis] =... getPSTH(discreteStack, timeLapse, kIdx, binSz, fs) %GETPSTH returns a peri-stimulus triggered histogram given a triggered % aligned stack in the form MxNxT, where M is the number of channels to % align, N is the number of samples (time) and T is the number of aligning % ...
25264e2f49f93cdf2d8a9a408d0e0c1d94913e99218652a863d8be7234b7bbdd
MATLAB
2,088
57
function [] = ADP_Motion_Correction5D(inFolder, outFolder, rigid) if(nargin<3) rigid = true; end fprintf('\nFolder %s\n',inFolder); % outFolder = strrep(inFolder,'RawData','MotionCorrected'); fprintf('\nLoading...'); [Y, Yred] = makeStacks5D(inFolder, 10); fprintf('...
7b9c6c8bceebf8fb1cf6f9191bf80c36ed5f359ea785ebbad0ffeeff5d846b6f
MATLAB
2,088
65
function shifted = CircularShift(m,s) %CircularShift - Shift matrix rows or columns circularly. % % Shift each matrix row (or column) circularly by a different amount. % % USAGE % % shifted = CircularShift(m,s) % % m matrix to rotate % s shift amount for each row (horizontal vector...
185a4d8d4a1ba53420fd5a40aba0ffd278413702838da89625b4d370aef85682
MATLAB
2,089
69
function [arrayShape, dataType, fortranOrder, littleEndian, totalHeaderLength, npyVersion] = readNPYheader(filename) % function [arrayShape, dataType, fortranOrder, littleEndian, ... % totalHeaderLength, npyVersion] = readNPYheader(filename) % % parse the header of a .npy file and return all the info contained ...
e3fd02c0ddb762056433942e88c37e221d15c4ba99db4fa30a2f6efaf9991cb6
MATLAB
2,089
95
function h = plot_phases(data, color) % Produces a polar plot of phase angles. Input data must be in radians. % Requires circStats package % %% % Authors: Dan Denis % Date: 2021-07-14 %% if iscell(data) for i = 1:length(data) % Remove any NaN data{i}(isnan(data{i})) = []; ...
ff5091271c636cc5f584f9e6f799f031eb93cdd6a24e68ee34cd2737d98c259a
MATLAB
2,089
79
function t = circ_confmean(alpha, xi, w, d, dim) % % t = circ_mean(alpha, xi, w, d, dim) % Computes the confidence limits on the mean for circular data. % % Input: % alpha sample of angles in radians % [xi (1-xi)-confidence limits are computed, default 0.05] % [w number of incidences in case ...
360e6f93d923e93c8af3dd29085c30686f1f5779a30e64507a6b5f27dbb8697b
MATLAB
2,091
46
% 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...
d8e2ba580717cd90cdf671c0fb3ac60000a722de7d4e34758f507a97b5b330dc
MATLAB
2,091
72
%isdvector - Test if parameter is a vector of doubles satisfying an optional list of tests. % % USAGE % % test = isdvector(x,test1,test2,...) % % x parameter to test % test1... optional list of additional tests (see examples below) % % EXAMPLES % % % Test if x is a vector of doubles % ...
b1e9fb75b5cb49818b470ed92c36f7cce1cf89c79a7063a41014ebaf89b73f20
MATLAB
2,092
59
%% A TabPanel Example % This example shows how to use tabs within a layout. It also shows how to % use the TabPanel Callback property to update other GUI elements when the % visible tab is changed. % % Copyright 2009-2013 The MathWorks, Inc. %% Open the window % Open a new figure window and remove the toolbar and menu...
9ddb2afe28058ddce4daa42277604a6774717268ebe4efed0baffe0a8c230607
MATLAB
2,093
75
function res = runOptimization(proc, scenario_fun, k, opts) % Run multi-start parameter estimation % % res fields: % res.est_params - best scaled parameters, in interval [0,1] % res.p - best unscaled parameter vector, in interval [lb,ub] % res.par - parameter struct % res.fval ...
a48acdd4c26230dc20f533bcc71892dc29f2df858bee5e40532ca1caafebcf00
MATLAB
2,093
76
function palm_dpxwrite(varargin) % Write a curvature file (DPV or DPF), in ASCII format. % % palm_dpxwrite(filename,dpx) % palm_dpxwrite(filename,dpx,crd,idx) % % - fname is the file name to be created % - dpx contains the values for each vertex or face % - crd contains the vertex coordinates or face indices % - idx co...
55648a10b612ff04968911e664828d8151c4ae3e04d5382e599b06be863c6450
MATLAB
2,094
40
fprintf(1,'Executing %s at %s:\n',mfilename(),datestr(now)); ver, try, if isempty(which('spm')), throw(MException('SPMCheck:NotFound', 'SPM not in matlab path')); end [name, version] = spm('ver'); fprintf('SPM version: %s Release: %s\n',name, version); fprintf('SPM p...
f8699d0d80d71da4cd54798fe8ab6c494df75a9ce56f69c6a31d99561b6d861c
MATLAB
2,094
70
% Detecting a small subset of infeasible linear inequalities % Section 5.8, Boyd & Vandenberghe "Convex Optimization" % Written for CVX by Almir Mutapcic - 02/18/06 % % We consider a set of linear inequalities A*x <= b which are % infeasible. Here A is a matrix in R^(m-by-n) and b belongs % to R^m. We apply a l1-norm h...
74814f0eb90a1f0843321b2978ce03604baf22708b8019a568d47b748db92a6a
MATLAB
2,095
63
classdef Panel < matlab.ui.container.Panel & uix.mixin.Panel %uix.Panel Standard panel % % b = uix.Panel(p1,v1,p2,v2,...) constructs a standard panel and sets % parameter p1 to value v1, etc. % % A card panel is a standard panel (uipanel) that shows one its % contents and hides the othe...
ea3332b4f2cf0384cca6d0c70add1a8bab8c8167d3f93e445887aef99bd71eea
MATLAB
2,095
53
fn = fieldnames(rightall{1}); reverse = {'five','four','three','two','one','ten','nine','eight'... ,'seven','six','eleven'};%'fifteen','fourteen','thirteen','twelve','eleven'}; reverse=reverse'; flippedR = orderfields(rightmeans,reverse); figure; %set(gcf,'Position',[10 100 1350 600]); set(gcf,'Position',[400...
1c87da6542100cf3a8a6c28b1f19dc14a27af2e02f1729153c883c57d9177df3
MATLAB
2,096
67
function palm_msetwrite(varargin) % Write a .mset file, i.e. an ASCII file % containing multiple matrices (2D arrays). % % palm_msetwrite(filename,Mset) % palm_msetwrite(filename,M1,M2,M3,...) % % filename : File name to be created. % Mset : Cell array with the arrays. % M1, ... : Contrasts as individual arrays. %...
7f1ed4d8c8b1469a49835ee781a1ceea82803e26ce60e50470eab836f0354d03
MATLAB
2,096
59
function varargout = window(wname,N,varargin) %WINDOW Window function gateway. % WINDOW(@WNAME,N) returns an N-point window of type specified % by the function handle @WNAME in a column vector. @WNAME can % be any valid window function name, for example: % % @bartlett - Bartlett window. % @barthannwin ...
9f6ced22fb619068c12383ab405fda6fb35812b0ae21cbb0f6dca1946cf68fc6
MATLAB
2,096
65
function ea_save_settings(tractset,save_as) % Saves the relevant settings of the tractset object to a mat file % Properties can't be saved as variables :( % Or with the struct flag because tractset is % a class and not a struct :( % Convert to variables first and then save calcthreshold = ...
1ba4b0c43788bc51ca004a1fc62e474cd0f57e17b95c3887f21d7e4c5daaa5d2
MATLAB
2,097
44
% 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...
25252158ce603e32fd0f8a5276463ebc0352f62d4ef6f65ad6339e340968d785
MATLAB
2,097
63
function [lambda_opt, lambda_vals, err_fit_vals, err_pen_vals, x_grid] = lcurve_lambda( ... obj_builder, lambda_vals, x0, lb, ub, fmin_opts) %LCURVE_LAMBDA Pick λ via L-curve corner using perpendicular distance. % % [lambda_opt, lambda_vals, err_fit, err_pen, x_grid] = lcurve_lambda(obj_builder, lambda_vals, ...
7ca332a491efcdfa430ae4ef1b9c1c89dcf822e900cf317a07c17f2fe1402de6
MATLAB
2,097
65
function [p_left,p_right,c] = ExampleSurfacePlotFunction(surface,vertex_id,data,cmap,data_label) % This is just a example for how to plot the medial and lateral sides of a % surface in the same plot % Inputs: % % surface = a structure with two fields: vertices (the vertices making up % the surface) and faces (the fa...
5442a90b798655aa9cda27d40c0438dde2fb23a140614dc8aa4d6f8b5bbdbc5e
MATLAB
2,098
60
% % KDTREE Find closest points using a k-D tree. % % CP = KDTREE( REFERENCE, MODEL ) finds the closest points in % REFERENCE for each point in MODEL. The search is performed in an % efficient manner by building a k-D tree from the datapoints in % REFERENCE, and querying the tree for each datapoint in % MODEL. % ...
29ae369e04c7dc3cc38850ee5a859e19b3ca80ee80221832a7910e1dd28a4c7d
MATLAB
2,100
66
function r = urn(varargin) %URN Generate random number sequence without duplicates % % IOSR.GENERAL.URN(N) returns an N-by-N matrix containing a random % sequence of integers in the interval 1:N without duplicates. The % integers are unique down each column. % % IOSR.GENERAL.URN(M,N) and IOSR.GENERAL.URN([M,N...
191cc26d6745b7940a3ba43605e0d557f0df3bdd36b6633b44315e2882c5811b
MATLAB
2,101
90
function result = cvmrelnet(object, lambda, x, y, weights, offset, foldid, ... type, grouped, keep) if nargin < 10 || isempty(keep) keep = false; end typenames = struct('deviance','Mean-Squared Error','mse','Mean-Squared Error',... 'mae','Mean Absolute Error'); if strcmp(type,'default') type = 'mse';...
4cfbcaa31cfb025bdf6c2dfe9e8e8b22f94c613e6f95bfa69548ed3aa9fa6048
MATLAB
2,101
86
function [n, ts_left, ts_right] = nex_int(filename, varname) % nex_int(filename, varname): Read interval variable from a .nex file % % [n, ts_left, ts_right] = nex_int(filename, varname) % % INPUT: % filename - if empty string, will use File Open dialog % varname - variable name % OUTPUT: % n - number of...
eb0562a1a7e05c525efc1763b29cbc889b3b863b62bbf178924bcad74ad3d7de
MATLAB
2,102
49
function ftr = ea_warp_fibers_MNI2native(pt_folder, MNI_connectome, transform, anchor_img) % Warp normative connectome to the native space % By Butenko, konstantinmgtu@gmail.com arguments pt_folder % full path to the patient in Lead-DBS dataset MNI_connectome % full pat...
148b228645e65182b559e270768f7129e5abab893e4f230007c90a584a5369b7
MATLAB
2,103
67
function ea_write(options) % check if sides is specified correctly for visualization if isfield(options, 'subj') options=ea_detsides(options); end if options.d2.write || options.d3.write if strcmp(options.atlasset,'Segment patient anatomy') ea_subcorticalsegmentation(options); if ~options.native %...
6c1be378f1959aa7524a22f86e8ddbc941e301304f5f99712975010153a246cb
MATLAB
2,103
64
function codeKeeper = syncPatternDetectNEV(NEVStruct) % syncPatternDetectNEV % % Finds the code for the SYNC pattern on the SYNC output of Blackrock % Microsystems Neural Signal Processor (NSP) recorded by analog input % channel 16 and thresholded as extracted spikes and saved in the NEV file. % % INPUT % % NEVSt...
0dd3549deb6a037bfda0e571db81f091ebe2ef70dad9a6706a035bd84e95ef60
MATLAB
2,105
57
% Floor planning % Section 8.8.1/2, Example 8.7, Boyd & Vandenberghe "Convex Optimization" % Original by Lieven Vandenberghe % Adapted for CVX by Joelle Skaf - 11/13/05 % (a figure is generated) % % Rectangles aligned with the axies need to be place in the smallest % possible bounding box. No overlap is allowed. Each r...
25542c8940dc6999c23d979e01f7a883fa4ec3c15373da7868f4d4edae034ab9
MATLAB
2,105
67
% std_comppol() - inverse component polarity in a component cluster % % Usage: [compout pol] = std_comppol(compin); % % Inputs: % compin - component scalp maps, one per column. % % Outputs: % compout - component scalp maps some of them with inverted % polarities, one per column. % pol - logic...
bcfeb31b7a74939f4889f5dbf394d4872143d30792c10760ed43be22e5077749
MATLAB
2,105
54
function [handles] = callgaussfilt_master(handles, dataID, fps, w1, w2) if nargin<2 dataID = 1; end handles = loadtrace(handles, dataID); if ~isempty(handles.spineROI) spID = handles.spine_title; spineROI = handles.spineROI; trace_stamp = handles.spine_dff; [tc2, finalBaseline_out] = F_Preprocess_v...
9975acd5b33d62e45d36836c9c32e27ca09bd79ed7797217e5a55bb8305f5aaf
MATLAB
2,106
62
function num_pVals = CBIG_ASDf_fitGLM_hypoTest(k, X, y, numReg, output_name) % num_pVals = CBIG_ASDf_fitGLM_hypoTest(k, X, y, numReg, output_name) % % This function fits GLM and performs hypothesis test for the GLM, and % plots the results. If output_name is specified, the plot will be saved. % % Input: % - k: % ...
431f9e26185168fdf02856f69aa0d05a7ba3eb402f33a38e5b115bdd4ad7a5c3
MATLAB
2,108
63
function [sROI, matROIs] = ReadJImageROI(cstrFilename, shape) % ReadJImageROI - FUNCTION Read an ImageJ ROI into a matlab structure % % Usage: [sROI, matROIs] = ReadJImageROI(strFilename, shape) % % if(numel(cstrFilename)>1) % sROI = []; % matROIs = []; % fprintf(2,...
4d6b2535cdbe8f6cec2c31403d9f8a160ed9bf469157b6c5e6d8c2096a1451d1
MATLAB
2,108
55
function clustergroup = readTSV(filename) %IMPORTFILE Import numeric data from a text file as a matrix. % CLUSTERGROUP = IMPORTFILE(FILENAME) Reads data from text file FILENAME % for the default selection. % % CLUSTERGROUP = IMPORTFILE(FILENAME, STARTROW, ENDROW) Reads data from % rows STARTROW through ENDROW o...
a744b9e0d693413c5d789e8105d119c9f3dba483410d51e19fb947ffbf6c3875
MATLAB
2,108
42
function Obj=SOFAconvertLISTEN2SOFA(LISTEN, subjectID) % Obj=SOFAconvertLISTEN2SOFA(LISTEN, subjectID) converts the HRTFs described in LISTEN % (see LISTEN HRTF format) to a SOFA object. % % Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences; % Licensed under the EUPL, Version 1...
b7a5669d2ca1a9092fd009d73da200ee7b69edc64ed8cb2fb87f02db1cc6925f
MATLAB
2,108
63
function fig = draw_volume_bluewhitered_gallery(volume_to_plot, data_to_plot, camera_view, markersize) % draw_volume_bluewhitered_gallery.m % % Draw multiple data on 3D volume using blue-white-red colormap for % negative-zero-positive values % % Inputs: volume_to_plot : volume of mask in nifti format (3D array) % ...
5ce20547fb8738340249dbbab48bae732902b3984cd4494c12e7197386faa690
MATLAB
2,109
72
function [n, ts, sv] = plx_event_ts(filename, channel) % plx_event_ts(filename, channel): read event timestamps from a .plx or .pl2 file % % [n, ts, sv] = plx_event_ts(filename, channel) % % INPUT: % filename - if empty string, will use File Open dialog % channel - 1-based external channel number or channel ...
cc171f95ab4e4924099e8c9ffb2f0d2f6e69eb67e5cb284bcb0a410d73a9c8f2
MATLAB
2,109
70
function stats = CBIG_fitLME_4t(subInfoFile, GMICVFile, q) % stats = CBIG_fitLME_4t(subInfoFile, GMICVFile, q) % What is the subtype order? % Offset by 1, the RID column % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md SUB_COL = 1+2; FRO_COL = 1+3; PAR_COL = 1+1; fpri...
8d34d7a938128b74fd160e0e91ff9f575bb6fbd41962bb0ec0e687f00fe05c66
MATLAB
2,112
63
function [in_order, avg_corr] = CBIG_MMLDA_hungarian_match_factors(ref_dir, in_dir, ref_order) % [in_order, avg_corr] = CBIG_MMLDA_hungarian_match_factors(ref_dir, in_dir, ref_order) % % Do a hungarian matching between reference betas and input betas and return the order and correlation of input betas. % % Input: % -...
a468e4072ff2e581030476e9e37fea43c7010bed5da4b47a68d6d4f1ff1f380c
MATLAB
2,112
65
function [eigvals,fss,alpha_1,Beta_1]=... linstability_get_steadystates_and_eigenvalues(profile, Beta, alpha) % 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 rele...
2589113cfd664aab2c5699ebc17fea0377a4ec7ef03ac8ff8281ebb118a82b82
MATLAB
2,114
82
function z = newdual( prob, name, reps ) narginchk(2,3); % % Check problem % if ~isa( prob, 'cvxprob' ), error( 'First argument must be a cvxprob object.' ); end global cvx___ p = prob.index_; vars = cvx___.problems( p ).duals; % % Check name % if isempty( name ), error( 'Anonymous dual variables are not al...
0d7aa508f1ebab1d3099ba0168af2c722f8c90a9d5b307ac09b770b0216f209e
MATLAB
2,115
67
function p = PlotSpikeWaveforms(W,varargin) %PlotSpikeWaveforms - Plot spike waveforms. % % USAGE % % p = PlotSpikeWaveforms(W,<options>,<options2>) % % W waveforms obtained using <a href="matlab:help GetSpikeWaveforms">GetSpikeWaveforms</a> % <options> optional list of property-value pairs...
8d0cd4426ef506cea0c231fb38e90d47f6d14638b4ea6ce5376d4934a580cac3
MATLAB
2,115
67
function [ params ] = readconfig( fname ) % 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, Geor...
4f4a2b7180fa82463c756715d790b17b3c7d8969723fce1cc3a71f6fc12da53f
MATLAB
2,117
69
% SET_NESTED_FIELD set a value somewhere in a struct % % SET_NESTED_FIELD(obj, indx, val) sets the location denoted by `indx` % (a pointer sequence into `obj`) in `obj` equal to `val`, and returns % a modified copy of `obj`. % % See also GET_NESTED_FIELD function obj = set_nested_field(obj, indx, val) if len...
a5f54c540d0e77cf85f0ee05ea65d1f035f83f2625006b1fa0c63c1bd7441a45
MATLAB
2,117
73
function [ratemap, ang_hd, mr, peak] = plot_polar_rate_map(self, cel, params, MaxRho) % root.plot_polar_rate_map(cel); % root.plot_polar_rate_map(cel, params, MaxRho); % % params is optional - [title, u2 score] (default [1 1]) % MaxRho is optional - positive number, upper bound of Rho % % andrew 3 april 2010 if ~exist...
399ca7d3944e1795c0a541499ceac77e4c31c9b7ce6e743c71bf94bbdb2e9f49
MATLAB
2,120
55
% ==================================== %% Help % ==================================== % % CBIG_train_MSHBM_Epilepsy_submit % % Submits CBIG_train_MSHBM_Epilepsy.m as a single PBS job to the headnode. % Run this script from the compiler node. It resolves all environment % variables on the compiler node (where they are s...
54c3fdd5c57540d753181d70fb454882bd2dcce69edb407731eaac52c6bc05b0
MATLAB
2,120
63
% rsc = linmap(val,valMin,valMax,mapMin,mapMax) % --------------------------------------- % % Performs a linear mapping of val from the range [valMin,valMax] to the range [mapMin,mapMax] % % Inputs: % val Input value % valMin Minimum value of the range of val % valMax Maximum value of the range of val % m...
ca325c20887613d1aa63b40dacdbf99a57a0de3211a9448f41a3dd2121159cd8
MATLAB
2,120
57
function [f_fd,f_fd_deriv,intervene_matrix_fd,perturbations_fd] = estForwardDiffDeriv(T,data,keep_species,intervene_matrix,perturbations) % 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 %...
d0479550969307db7e9ba219c5a1c92566d6e51c9472b7904d656ef1b63c4dd4
MATLAB
2,120
74
function [] = u3d_in_latex(fname, media9_or_movie15) %U3D_IN_LATEX LaTeX code which includes a U3D file. % % usage % U3D_IN_LATEX(fname, media9_or_movie15) % % input % fname = LaTeX file name (a '_small.tex' will be appended) % media9_or_movie15 = LaTeX package to use for including the 3D file % % out...
dcc09179d9ee352a1880c4fc1d36c6f33febc5ccea5e6a7e5c65694ca622d110
MATLAB
2,120
59
function [loadmovieflag, Mem_max, w, handles] = loadbin_init(handles) if isempty(handles.RegPara) RegPara = []; variableinfo = who('-file', fullfile(handles.filepath, handles.filename)); if ismember('RegPara', variableinfo) load(fullfile(handles.filepath, handles.filename), 'RegPara') ...
3f45778c823a309200851b09d331ec8bed430904ee2f2c7c8aab10c5e73c0587
MATLAB
2,121
78
function [vertex_coords, faces] = read_surf(fname) % % [vertex_coords, faces] = read_surf(fname) % reads a the vertex coordinates and face lists from a surface file % note that reading the faces from a quad file can take a very long % time due to the goofy format that they are stored in. If the faces % output variable ...
cd018055b42f2acb3abe02896d5f71c17f3cfc80239be45728dc2b372f8abc65
MATLAB
2,122
59
function [A_global_L2] = benchmarkCdiffDataL2Opt(cfg, T,BMD,keep_species,data_counts) % 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 e...
43b38cbe804d54a5ed366abe029fedfb939fe7aed77bb8d546777e0f4ed5d32d
MATLAB
2,123
64
function z = conv(x,y) %Disciplined convex programming information for CONV: % Convolutions are a combination of both multiplications and additions. % Therefore, to insure that the no-product rule is satisfied, CONV(X,Y) % requires that either X or Y be constant. Further conditions may also % apply depending o...
5a0427577e3c1b27fc2cb96dd7856ff527defc7621e5f1f45117aeb132bff154
MATLAB
2,124
57
function tf = CBIG_Yeo2011_check_example_results(output_dir) % result = CBIG_Yeo2011_check_example_results(output_dir) % % This function compares the example results saved in <output_dir> with the % reference results. % % Input: % - output_dir: % The output directory where example results are saved. % % Outp...
7c18421a11fbeb91c08cc368e9e224c3128baca1c286735ab36de6a9f5290d40
MATLAB
2,124
65
function [betas, stats] = CBIG_fitGLM_3t(subInfoFile, GMICVFile, q) % [betas, stats] = CBIG_fitGLM_3t(subInfoFile, GMICVFile, q) % What is the subtype order? % Offset by 1, the RID column % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md SUB_COL = 1+3; COR_COL = 1+1; f...
b82c9708147a96ea34e04a854cb567e8441379b1e7577da58589eac6069f0a60
MATLAB
2,124
69
function plot_four_tapers(w1,w2,w3,w4) % Plots four different taper desings on a single graph. % Inputs: % [w1 w2 w3 w4]: an array of taper widths % % Original code written by Lieven Vandenberghe. % Updated by Almir Mutapcic 12/2005 n = size(w1,1); colormap(gray); width = zeros(2*n,4); width([1:2:2*n-1],:) = [w1...
075ecc8523f2fb50a281105b1f920868cb3999c6e9a3031bc8ce7bd980921bee
MATLAB
2,127
90
function [pval med P] = circ_cmtest(varargin) % % [pval, med, P] = circ_cmtest(alpha, idx) % [pval, med, P] = circ_cmtest(alpha1, alpha2) % Non parametric multi-sample test for equal medians. Similar to a % Kruskal-Wallis test for linear data. % % H0: the s populations have equal medians % HA: the s pop...
51caec223cc21af240c27bbbeddcc051e78a9926518fb1c57c709ef4d0edf117
MATLAB
2,127
78
function [vertex_coords, faces] = read_surf(fname) % % [vertex_coords, faces] = read_surf(fname) % reads a the vertex coordinates and face lists from a surface file % note that reading the faces from a quad file can take a very long % time due to the goofy format that they are stored in. If the faces % output variable ...
85a094ff104f40ec06eff8985a7b5bdde3c93e4b35e175785a72a41761403930
MATLAB
2,127
61
function plotOneBorderOnMapCCF(dorsalMaps, allROIs, metricField, randomBorder, smoothSD, cmapInfo) % Plots one random border over a metric map, with the cell positions % associated to that border % Figure allenMapSMc(dorsalMaps, [-3.6, 0, -2, 3]) % Creates figure by itself % Plot params msz = 8; xLimits = [-4 0]; yLi...
923b5c381d62d5c68f3879f0c1336c37db7b92a5e7fb6f3a159c0649295cd894
MATLAB
2,127
73
function z = psdjmul(x,y, K) % z = psdmul(x,y, K) % % PSDMUL for full x,y. Computes (XY+YX)/2 % % ********** INTERNAL FUNCTION OF SEDUMI ********** % % See also sedumi % This file is part of SeDuMi 1.3 by Imre Polik % Copyright (C) 2005 McMaster University, Hamilton, CANADA (since 1.1) % % Copyright (C) 2001 Jos F....
3ad78e4825ad736a356376836ce16365b4dc4078c49c93968e0c79d18d7eb90a
MATLAB
2,128
73
% Demonstration of estimating covariance between paired measures of meta-d' % (e.g. two tasks from the same individuals) % % SF 2019 clear all Ntrials = 400; Nsub = 100; c = 0; c1 = [-1.5 -1 -0.5]; c2 = [0.5 1 1.5]; group_d = 2; group_mratio = 0.8; type1_sigma = 0.2; rho = 0.6; type2_sigma = 0.5; for i = 1:Nsub ...
2ebc6a1e05b92a9708692d1ce4c26b5cc49163b7a992ce7d5b5e05f58bcff475
MATLAB
2,129
83
% Optimal doping profile optimization with current gain constraint. % Boyd, Kim, Vandenberghe, and Hassibi, "A tutorial on geometric programming" % Joshi, Boyd, and Dutton, "Optimal doping profiles via geometric programming" % Written for CVX by Almir Mutapcic 02/08/06 % (a figure is generated) % % Determines the optim...
f3390df1d3c9b90075bcd8fc6e68ebed0c1dddc065b8fe9d4a77ae13bdce6397
MATLAB
2,129
54
function ea_plan_revision(directory,sourceels,revs) options = ea_getptopts(directory); backupRecon = strrep(options.subj.recon.recon, '.mat', '_backup.mat'); if isfile(backupRecon) copyfile(backupRecon, options.subj.recon.recon); end load(options.subj.recon.recon); save(backupRecon, 'reco'); for rev=1:length(revs...
fe77b261bc4e64d228afe34f17063d3bd6c78941a5acb7485a7297eab83bd586
MATLAB
2,129
60
function Serr=specerr(S,J,err,trialave,numsp) % Function to compute lower and upper confidence intervals on the spectrum % Usage: Serr=specerr(S,J,err,trialave,numsp) % Outputs: Serr (Serr(1,...) - lower confidence level, Serr(2,...) upper confidence level) % % Inputs: % S - spectrum % J - tapered fourier trans...
2ebae0f310df216b2ed7f93f42fced5bd004ff181ea7ef26c97de1b252be5e50
MATLAB
2,130
43
% 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...
8f3f15d8e89134d9bcba837d0057363feccbb9d34c817b5f37c8e6713dac0300
MATLAB
2,130
69
% Section 4.5.4: Design of a cantilever beam: recursive formulation (GP) % Boyd & Vandenberghe "Convex Optimization" % (a figure is generated) % Almir Mutapcic 02/08/06 % % We have a segmented cantilever beam with N segments. Each segment % has a unit length and variable width and height (rectangular profile). % The go...
77b9052b78ed7a7739ee7311db14fee3928882f584409543ff59c58e724377e3
MATLAB
2,132
71
% This function is only used to save Analyze or NIfTI header that is % ended with .hdr and loaded by load_untouch_header_only.m. If you % have NIfTI file that is ended with .nii and you want to change its % header only, you can use load_untouch_nii / save_untouch_nii pair. % % Usage: save_untouch_header_only(hd...
9734ea622204ff6cb81e0f5bb0270873dfdcbe97df3dceb6a4231af6e2256831
MATLAB
2,133
68
% MEANS: Means, standard errors and variances. For column vectors, means(x) % returns the mean value. For matrices or row vectors, means(x) is a % row vector containing the mean value of each column. The basic % difference from the Matlab functions mean() and var() is for a row vector, %...
c71b35cc67bb62b938c17f0e876f1f4df3bc65881d7b4810c9e88059db353086
MATLAB
2,134
75
%isivector - Test if parameter is a vector of integers satisfying an optional list of tests. % % USAGE % % test = isivector(x,test1,test2,...) % % x parameter to test % test1... optional list of additional tests (see examples below) % % EXAMPLES % % % Test if x is a vector of doubles % ...
d6c407d545fa5e75b8218403f4fcee8f767a65ccc7de101ac4e1d5e4cb22b858
MATLAB
2,136
58
function [corr, avg_corr_sorted, I] = CBIG_ASDf_computeCorrBetweenRuns(inputDir, k) % [corr, avg_corr_sorted, I] = CBIG_ASDf_computeCorrBetweenRuns(inputDir, k) % % This function computes pair-wise correlation between each run (random % initialization). In addition, for reach run, it computes the average correlation % ...
648b1869c376efaebd564d8f7395d36d516bd6aa5bba05776a203da795f937e4
MATLAB
2,137
74
function dx = distanceMatrix( dims , lx , cyclic_type ) %% some useful numbers to access nodes at each resolution level d = prod(dims,2); N = sum(d); dx = zeros(N,N); Nmaps = size(dims,1); offsets = zeros(Nmaps,1); for i=2:Nmaps offsets(i) = d(i-1) + offsets(i-1); end sd = {}; for i=1:Nmaps ...
c0c28ba36478310596d615538e99ed96965435988bd3cc81867cff552d281afc
MATLAB
2,137
75
% firfiltdcpadded() - Pad data with DC constant and filter % % Usage: % >> data = firfiltdcpadded(data, b, causal); % % Inputs: % data - raw data % b - vector of filter coefficients % causal - boolean perform causal filtering {default 0} % % Outputs: % data - smoothed data % % Note: % f...
8fd52dab422e2f6c13cb31ea17505e6ec538084542fcd8f5e284631218883803
MATLAB
2,138
75
%isivector - Test if parameter is a vector of integers satisfying an optional list of tests. % % USAGE % % test = isivector(x,test1,test2,...) % % x parameter to test % test1... optional list of additional tests (see examples below) % % EXAMPLES % % % Test if x is a vector of doubles % ...
a3378b5fec7115057e3aa29bf34a84be605dbbb8b955f2b04ceb898c647b30e1
MATLAB
2,138
70
% get holdout set for lasso contrasts, 2nd-level batch scripts % hard-coded options % 'fivefold_leave_whole_subject_out' : 5-fold cross-validation, leaving % whole subject out (all images from subject across all conditions) % 'leave_one_subject_out' : leave one whole subject out holdout_set_type = 'fivefold_leave_who...
439d01aae367e1e4444c17b51d75364399611171352c39d2fb35788d072b834c
MATLAB
2,139
73
% Minimum volume ellipsoid covering union of ellipsoids % Section 8.4.1, Boyd & Vandenberghe "Convex Optimization" % Original version by Lieven Vandenberghe % Updated for CVX by Almir Mutapcic - Jan 2006 % (a figure is generated) % % We find a smallest ellipsoid containing m ellipsoids % { x'*A_i*x + 2*b_i'*x + c < 0 }...
abb42010661c6eada6fd8c0ebbf54fbe196bdb28dee5dcaff5cfcb9e6e7c0665
MATLAB
2,139
94
function [adfreq, n, ts, nf, w] = nex_wf(filename, varname) % nex_wf(filename, varname): Read waveform variable from a .nex file % % [adfreq, n, ts, nf, w] = nex_wf(filename, varname) % % INPUT: % filename - if empty string, will use File Open dialog % varname - variable name % % % OUTPUT: % n - number...
cd5452f81e7f611a6aca9e112da662c9f890f1a849d71cdee115252c2a095f31
MATLAB
2,140
48
% 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...
f6f5985508c3920dcbc92b120b60c605ab95cb70e77036e503c42b95cfad8fea
MATLAB
2,140
79
clc clear all close all set(0,'defaultfigurecolor',[1 1 1]);% set figure background color % compare laminar profile of perfusion signals and cell body density %% set parameters % basic parameters NumROIs = 360; Numlayers = 15; AnalysisDir = ['/Users/guofanhua/Desktop/gfh/work/StandardBrainTemplateAndAtlas/BigBrain_Lam...
2cbadcecf53ae176a111cc9cf19b6012b882edd0c590f423444fc3a00793cf9b
MATLAB
2,141
73
% Exercise 4.27: Matrix fractional minimization using second-order cone programming % From Boyd & Vandenberghe, "Convex Optimization" % Joëlle Skaf - 09/26/05 % % Shows the equivalence of the following formulations: % 1) minimize (Ax + b)'*inv(I + B*diag(x)*B')*(Ax + b) % s.t. x >= 0 % 2) ...
39e9c4952cd8ed699568c0ee8418c73313381b51fbd47475a2cee73bc0da4941
MATLAB
2,141
51
function installRes = plugin_askinstall(pluginName, pluginFunc, forceInstall) if nargin < 3, forceInstall = false; end; if nargin < 2 || ~exist(pluginFunc) if ~forceInstall db = dbstack; if length(db) > 2 && ~strcmpi(db(end).name, 'checkouteeglab.m'); error([ 'Cannot find ' plugin...
bd66f896d1f210b57bf2587ddfe9ed553ec2a9423fc6c3f3e5eb92d303b456c2
MATLAB
2,141
71
function [coords,goodz]=ea_reconstruct_coords(trajectory,trajvector,options) [cimat,reldist]=ea_sample_cuboid(trajectory,options); vizz=0; switch options.subj.postopModality case 'MRI' headtemp=ea_load_nii(fullfile(ea_getearoot,'templates',filesep,'electrode_contacts','mr','template.nii')); case 'CT'...
776bd61b36c45fa9fc6df8d4d9509821ec20d32f17f8ba673379954f53b387fa
MATLAB
2,142
70
function y = berhu( x, M, t ) %BERHU Reverse Huber penalty function. % BERHU(X) computes the reverse Huber penalty function % % BERHU(X) = ABS(X) if ABS(X)<=1, % (ABS(X).^2+1)./2 if ABS(X)>=1. % % BERHU(X,M) computes the reverse Huber penalty function with halfwidth M, % M.*B...
3e3b321768494065113a044b6689c1e7954c97be3c0dab7879af1240fe5cfff4
MATLAB
2,143
94
function [res, errStr]= ftrstruct_init(typeStr) % function [res, errStr]= ftrstruct_init(typeStr) % % Creates a valid and empty ftrStruct or fiberStruct % % typeStr: {'ftrStruct' | 'fiberStruct'} % default is 'ftrStruct' % % return values % res: the empty ftrStruct or fiberStruct % errStr: If ...
92b083cafc2eb91fa27128a8c18eed4626eda648c6020f623dcabf686f108bab
MATLAB
2,143
57
function [tf,reason,where] = SOFAcompare(Obj1, Obj2, varargin) %SOFASOFAcompare % TF = SOFAcompare(A, B) compares A and B and % returns logical 1 (true) if they are identical. % % [TF,REASON,WHERE] = SOFAcompare(A, B) provides the REASON % and shows WHERE the difference arose. % % ... = SOFAcompare(...
ae7ed5e1bc22a0540595352791567495057e8fe21bf5e131c90019727ac17a67
MATLAB
2,143
78
%%*********************************************************** %% etp: Education testing problem. %% %% (dual problem) maximize e'*d %% subject to B - diag(d) >= 0 %% d >= 0 %% %% (primal problem) minimize Tr B*X %% subject to X >= 0 %% ...
04981f2878f8a421da3b014535dc409ab26dc3dc231ec86aa2fc408902c4c462
MATLAB
2,145
64
classdef CardPanel < uix.Container & uix.mixin.Panel %uix.CardPanel Card panel % % b = uix.CardPanel(p1,v1,p2,v2,...) constructs a card panel and sets % parameter p1 to value v1, etc. % % A card panel is a standard container (uicontainer) that shows one % its contents and hides the othe...
78380d9075b01f57ff33dc1afced2aa959efbbe5ddd0a4957b9374ccd3ef7624
MATLAB
2,145
94
%BIPOLAR returns an M-by-3 matrix containing a blue-red colormap, in % in which red stands for positive, blue stands for negative, % and white stands for 0. % % Usage: cmap = bipolar(M, lo, hi, contrast); or cmap = bipolar; % % cmap: output M-by-3 matrix for BIPOLAR colormap. % M: number of shades in the color...
a6e7c12ddf1b284b7463cf94791e8b04d15cb5509511d3512de4af8d4182c325
MATLAB
2,145
91
% Examples 5.6,5.8: An l_p norm approximation problem % Boyd & Vandenberghe "Convex Optimization" % Joëlle Skaf - 08/23/05 % % The goal is to show the following problem formulations give all the same % optimal residual norm ||Ax - b||: % 1) minimize ||Ax - b|| % 2) minimize ||y|| % s.t...
389d18427adc59e3a512dff5875d4df2a5205b57fef78bea6f224d0a74555d9c
MATLAB
2,147
58
function [dat] = bz_scrubTracking(dat) % USAGE % [dat] = bz_scrubTracking(dat) % % INPUTS % dat - struct created by calling dat = importdata(file.csv) on a csv % file exported from a .tak file % % OUTPUTS % dat - the same struct 1) outliers removed % 2) median filtering % ...
3f33ccb059f4f3d36442cf7669693a16933af8958e2b750a1886728b6e857d04
MATLAB
2,147
75
function obj = geom_label(obj,varargin) % geom_label Display data as labels % % Example syntax: gramm_object.geom_label('Color','auto','dodge',0.6) % Geom label displays text (provided as 'label' in the constructor call % gramm()). At the X and Y locations provided in the constructor call. % Appearance of the text can ...
421ff82facc06b3095eafcd53b34a36fdb98512ccd8f0507b95fa9fb0ad3a552
MATLAB
2,147
51
function M_t = BMP_solution_ihMT(t, M, R1a, R2a, dw, w1, w2, kab, kba, M0a, M0b, T2b, R1b, T1d, rfmt) % BMP_SOLUTION_IHMT Solves the Bloch-McConnell-Provotorov equations for ihMT. % % dM/dt = A * M + C % % Inputs: % t - Evolution time duration (s) % M - Initial magnetization state vector [Mxa; Mya; M...
968a8f52bd49c71d572749547db22a03c0da1efef312278c06eb913a5cdff2f2
MATLAB
2,147
68
function CBIG_MMLDA_forest_plot(A, xlimCmd, out_name) % CBIG_MMLDA_forest_plot(A, xlimCmd, out_name) % % This function gives a forest plot based on GLM results (estimated difference % between factors and standard error). % % Input: % - A: % N x 3 matrix. Outputs from hypothesis test. N is number of comparisons...
92335492262fd0035d53534803e976a44754063fad469ce852a8ebba6a63ceaa
MATLAB
2,148
52
function ea_normsubcorticalsegm(options) directory=[options.root,options.patientname,filesep]; if exist([directory,'mmnormalized.mat'],'file') return end mkdir([directory,'atlases',filesep,'mni',filesep]); mniatldir=[directory,'atlases',filesep,'mni',filesep,options.patientname,filesep]; natatldir=[directory,'at...
2981b90ca4a5c7881873049601254bfedb1906593641c2d0115d66a0fd8d9397
MATLAB
2,149
59
function dpvl = palm_dpxlabel(dpx,adj) % Label a DPV file (vertexwise data). % % Usage: % dpxl = palm_dpxlabel(dpx,adj) % % - dpx : Data per vertex or per face to be labelled. It should be % a logical vector, and the values marked as "true" are % the ones labelled. % - adj : Sparse adjacency matri...
5f835c4cd2cd8f73bbc23e52b0e30d340dcb38355818bc1fcfde2d7002f4bf75
MATLAB
2,150
60
function [H] = globalrescale(f); % GLOBALRESCALE creates the homogenous spatial transformation matrix % for a 7 parameter rigid-body transformation with global rescaling % % Use as % [H] = globalrescale(f) % % The transformation vector f should contain the % x-shift % y-shift % z-shift % followed by the % p...
8ad0b613b8b2a029f7cda5e813bea073ba6628c0333a5f178ac8e0ad816788c9
MATLAB
2,150
88
%% figure S3 load('figureS3_data') load('figure4_data.mat', 'motif_time'); %% A Z = linkage(squareform(distance_matrix), 'ward'); n_clus = 7; T = cluster(Z, 'maxclust', n_clus); % Cluster number (1-7) to motif number (0-6) mapping cluster_to_motif = zeros(n_clus, 1); for k = 1:n_clus cluster...
4d808454ab4482de771725584c96968b2adfe6f7b088b92944c1a2177564a197
MATLAB
2,151
87
function [track_info,pos_info_val] = bz_olypherInfo(data,round_to,smoothing) % USAGE % [track_info,pos_info_val] = bz_olypherInfo(data,round_to,smoothing) % % INPUTS % data - matrix (M x N x D) where M is the number of cells to analyze, % N is the number of trials for each cell, and D is t...
f9d7cafd9563f2a41401782c4b4659c8bad142e264028e20eed1978d9617d235
MATLAB
2,151
81
% NIFTI Object % % create - Create a NIFTI-1 file % disp - Disp a NIFTI-1 object % display - Display a NIFTI-1 object % fieldnames - Fieldnames of a NIFTI-1 object % nifti - Create a NIFTI-1 object % subsasgn - Subscript assignment % subsref - Subscript referencing % % other opera...