sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
58b66ca827db81062c3f2fff219dcaf33ec7e769507385a69a6302cb7dc18584
MATLAB
2,468
57
%% Transfer Entropy Demo 2 % This demo goes through calculating the transfer entropy between two % discrete time series. In particular, this example works with neural spike % trains. % Data Type: Discrete (Neuron Action Potentials) % Number of Variables: 2 % Information Analysis: Transfer Entropy % Trial Based or Sing...
a58ad4e8539af4a91b7e9bf0e87658d1a9a9576a720b324ba996b4777193a916
MATLAB
2,468
98
function importCellMaskMLMD(MLMD) %importCellMaskMLMD imports cell masks for a list of movies % %SYNOPSIS importCellMaskMLMD(MLMD) % %INPUT MLMD: MovieList or MovieData object for movie(s) to be analyzed % %OUPUT Output is saved in directory ImportedCellMask belonging to each % analyzed movie. % %Khuloud Jaqaman, ...
104a5a1e28378728e295df4b1d63772ef26c3275f8a80985159a45f617db7d07
MATLAB
2,469
72
function [t,wr,w] = trydif(t,wrIN,wIN, x,z, pars,K) % [t,wr,w] = trydif(t,wrIN,wIN, x,z, pars,K) % % TRYDIF Tries feasibility of differentiated step length w.r.t. % wide region and its neighborhood. % % ********** INTERNAL FUNCTION OF SEDUMI ********** % % See also sedumi, stepdif % This file is part of SeDuMi 1.1 ...
32054e0f2a2cea8eb0f85a049645bf8eb68073a677c2051144b4a7e84b0a4dae
MATLAB
2,469
65
function hline = plot_NSC_frac(sol, fluct, proc, k, scenarioLabel, color) % Plot NSC counts and aNSC fractions with prediction bands % % INPUTS: % sol - ODE solution struct (from ode23s) % fluct - struct with fields: t, sum, sum_upper, sum_lower, frac, frac_upper, frac_lower % proc ...
ee77ee99a14db3209ddd840c6b038a2dd53928bc106786ba4dfdf432fa0f2782
MATLAB
2,469
101
function A = catstruct(varargin) % CATSTRUCT - concatenate structures % % X = CATSTRUCT(S1,S2,S3,...) concates the structures S1, S2, ... into one % structure X. % % Example: % A.name = 'Me' ; % B.income = 99999 ; % X = catstruct(A,B) % % -> X.name = 'Me' ; % % X.income = 99999 ; % % ...
1c09d500cc50c66e541871cfc3f5647bd0e16544d0acc1f1544dceffcfcb6f31
MATLAB
2,470
79
% qmeshcut demonstration % % by Qianqian Fang, <fangq at nmr.mgh.harvard.edu> % % to demonstrate how to use qmeshcut to produce cross-sectional plot % of an un-structured (tetrahedral) mesh % run vol2mesh demo 1 to create a 3d mesh demo_vol2mesh_ex1 % define a plane by 3 points, in this case, z=mean(node(:,3)) z0=...
9c2b1d158fc88854e1223fb4c28de8222a374c4b01d39ef77f33a93c77c5e757
MATLAB
2,470
53
function [lh_labels,rh_labels]=CBIG_ArealMSHBM_BuildTwoVertThickBoundary(lh_avg_mesh, ... rh_avg_mesh, lh_orig_labels,rh_orig_labels) % [lh_labels,rh_labels]=CBIG_ArealMSHBM_BuildTwoVertThickBoundary(lh_avg_mesh, ... % rh_avg_mesh, lh_orig_labels,rh_orig_labels) % % This script will create boundaries for a given p...
12de378939a1a56fb7e4a8553b342ba57ea1b6e7750fb9fa83a0457035b0b46c
MATLAB
2,471
62
% SOFA API demo script % load HRTF in BT-DEI format and save in SOFA format. % Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences; % Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "License") ...
07b6a315d85e42c10e31faaa3ab0d854d7f55b44b2bd3f3c6e74b065b61fa820
MATLAB
2,472
53
function handles = dan_plot_detections(handles, detections, markColor) %% % Authors: Dan Denis % Date: 2021-07-14 %% for chan_i = 1:length(detections) % Look for each detected event in the current epoch specIdx{chan_i,:} = find(detections(chan_i).startSample >= handles.plotParam.epochSample(handles.p...
8e2f94b6cc886cb0ccfb3fb17b48cf39eae5ae207e2d8d57e012a15c50f2957a
MATLAB
2,472
85
function cell2csv(fileName, cellArray, separator, excelYear, decimal) % Writes cell array content into a *.csv file. % % CELL2CSV(fileName, cellArray, separator, excelYear, decimal) % % fileName = Name of the file to save. [ i.e. 'text.csv' ] % cellArray = Name of the Cell Array where the data is in % se...
717e9ceec2a49b5543b85643bd0bba5a5b2b7595223c875453eb86fd0820fd0f
MATLAB
2,475
83
function y = psdinvscale(ud,x,K) % y = psdinvscale(ud,x,K ,transp) % % PSDINVSCALE Computes length lenud (=sum(K.s.^2)) vector y. % Computes y = D(d^{-1}) x with d in K. % Y = Ud' \ X / Ud % ********** INTERNAL FUNCTION OF SEDUMI ********** % % See also scaleK, factorK. % This file is part of SeDuMi 1.3 by Imr...
213bba9c1b44f8a44af72f797c678453e05a07d6587763ab93a0c18416108f6a
MATLAB
2,476
58
function ClincFreq_Norm2MNI_T2(indat,inroi,outdir,outname,voxelsize,pth) try [patdat,namdat,extdat] = fileparts(indat); % [patroi,namroi,extroi] = fileparts(inroi); [v1 d1] = Dynamic_read_dir_NIFTI(indat); [v2 d2] = Dynamic_read_dir_NIFTI(inroi{1}); d1(isnan(d1)) = 0; d1(isinf(d1)) = 0; D1 = zeros(v1.dim); D1(d1>0) = 1...
bfa879a8b0755a0bba6e3fcb31d6c76162c05dc2c8166d1cb54fbf5b075ce62c
MATLAB
2,476
59
% SOFA API - demo script % Copyright (C) 2012-2014 Acoustics Research Institute - Austrian Academy of Sciences % Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "License") % You may not use this work except in compliance with t...
479007c5221af8e898a002fdab2c40c5e84e39f5eaf0194f457b72a885d4bbaa
MATLAB
2,477
79
function data = AFOFdata_struct_CL(inputdata, filenames) % USE THIS FOR EXP7 (CEM) (now Exp8) % how it works: % fly = AFOFdata_struct_CL(data,filenames) where data and filenames are % outputs from AF_OF_importer() for e = 1:length(inputdata) for t = 1:size(inputdata{e}{1},1) trial.filename = filena...
90196b99ce8bb8190b9119a28535c47d907c3c8442abe23f99995926df8be8da
MATLAB
2,478
99
function gmsh_mesh2d_write ( gmsh_filename, m, node_num, node_x, ... element_order, element_num, element_node ) %*****************************************************************************80 % %% GMSH_MESH2D_WRITE writes 2D mesh data as a Gmsh mesh file. % % Licensing: % % This code is distributed under the GN...
ccedfb713baf5f320e1a44679b099efb8c32a62602a71968496a1adb083eb8d9
MATLAB
2,478
58
function ClincFreq_Norm2MNI_EPI(indat,inroi,outdir,outname,voxelsize,pth) try [patdat,namdat,extdat] = fileparts(indat); % [patroi,namroi,extroi] = fileparts(inroi); [v1 d1] = Dynamic_read_dir_NIFTI(indat); [v2 d2] = Dynamic_read_dir_NIFTI(inroi{1}); d1(isnan(d1)) = 0; d1(isinf(d1)) = 0; D1 = zeros(v1.dim); D1(d1>0) = ...
6847ddb70002f3cb7149984f55e32fa3a3082946d5630f1c719a32f96cb3191a
MATLAB
2,479
70
function [H] = traditional(f); % TRADITIONAL creates the homogenous spatial transformation matrix % for a 9 parameter traditional "Talairach-model" transformation % % Use as % [H] = traditional(f) % % The transformation vector f should contain the % x-shift % y-shift % z-shift % followed by the % pitch (rot...
a7350622c2b2f8b2fab50424f80f212ed86cd6c221dd6b61f73ac492d426b167
MATLAB
2,479
73
function d=edit_distance_damerau(s,t) % Calculate the Damerau-Levenshtein string distance. % % @author B. Schauerte <schauerte@ieee.org> % @date 2010 % Copyright 2010 B. Schauerte. All rights reserved. % % Redistribution and use in source and binary forms, with or without % modification, are permit...
cca2ddb7a437d1cecc3fc1345986ac7efbef4125fb9ede1a1b76aac7027930bf
MATLAB
2,479
63
function [AllX,space]=ea_explorer_calcvoxelvals(vatlist,obj) templateresolution = obj.resolution; if size(vatlist,2)>1 sidesuffices={'_r','_l'}; else sidesuffices={''}; end disp('Need to export Efields in proper format, this may take a while'); outdir=[fileparts(obj.leadgroup),filesep,'sweetspots',filesep,obj.I...
db17d6056a1254f8d63ccc031aab3d468490ecbe407912b55bcd6feeada8325c
MATLAB
2,479
87
% Figure 6.15: A comparison of stochastic and worst-case robust approximation % Section 6.4.2 % Boyd & Vandenberghe "Convex Optimization" % Original by Lieven Vandenberghe % Adapted for CVX by Joelle Skaf - 10/03/05 % % Consider the least-squares problem: % minimize ||(A + tB)x - b||_2 % where t is an uncertain p...
845f44f72272b7da112290a52d1b5aa5e2abfd19692d92e56edf5f2467b6c087
MATLAB
2,480
73
function y = geo_mean( x, dim, w ) %GEO_MEAN Geometric mean. % Y=GEO_MEAN(X), where X is a vector, computes the geometrix mean of X. If any % of the elements of X are negative, then Y=-Inf. Otherwise, it is equivalent % to Y=PROD(X).^(1/LENGTH(X)). All elements must be real. % % For matrices, GEO_MEAN(X) is ...
f1b148e663d2c3d65a834df9222968d4a40d6249dbd0b4b45c2a57a0ba37a46b
MATLAB
2,482
84
%%******************************************************************** %% minEpts: minimum volume ellipsoid containing given %% points, V(:,1),...,V(:,m). %% %% max log(det(B)) %% s.t. || Bx + d || <= 1, for all x = V(:,1),...,V(:,m) %% %% [blk,At,C,b,OPTIONS,B,d] = minEpts(V,solve) %% %% For problem formul...
88f82102bf11c978c4167d5a31457cbba62c079234fa07ed023df5719bd8175d
MATLAB
2,483
66
function [diffs] = getbumpdifferences(trtyps,data,tys,vols) % This code is set up so that you can take pre-stimulus timepoints as well % if you want, but you need to edit the output (and maybe check that the % timepoints work) % data is output of normforbump % tys is second output from concat_dFF (matching dat...
b8123acf082606f087f22b3650c2119308d8aa0daa90002c4dd89e73f2e1e60c
MATLAB
2,483
75
function [ ] = run_diet_crossvalidation( ) % 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, Geo...
35cc09b90ce0b8d4f0cfdc8a8871225a3e80ab2b1fba99852bba3ca86f12da17
MATLAB
2,485
54
function CBIG_hMRF_example_wrapper(output_dir) % CBIG_hMRF_example_wrapper(output_dir) % % This is the wrapper function to set up and run the clustering algorithm based on the input arguments. % % Input % - output_dir: (string) % ABSOLUTE path to the directory to which the output results will be saved. % % Exam...
a1f7388c28af80668bc51aea14ad3313df67f682c9e8ebbcf3c163dab823f481
MATLAB
2,486
59
function [outdata, outsform1, outroi] = cifti_struct_dense_extract_volume_all_data(cifti, cropped, dimension) %function [outdata, outsform1, outroi] = cifti_struct_dense_extract_volume_all_data(cifti, cropped, dimension) % Extract the data for all cifti volume structures, expanding it to volume frames. % ...
b0cd99c7a611095822508e9513dd2ceb6b103dc6485f2f1ebfd16fdc0f444426
MATLAB
2,486
74
function data = AFOFdata_struct5(inputdata, filenames) % USE THIS FOR EXP5 DIV STIMS (CEM) % how it works: % fly = AFOFdata_struct5(data,filenames) where data and filenames are % outputs from rotoball_importer() for e = 1:length(inputdata) for t = 1:length(inputdata{e}{1}) trial.filename = filename...
1678588ecb1642dce6be59a42dc8ef5113f5ad8c369595e629d43ec5c1a88e7c
MATLAB
2,487
86
% Visualisation and diagnostics for meta-d' fit object generated by % fit_meta_d_mcmc %% Observed and expected type 2 ROCs for S1 and S2 responses h1 = figure(1); set(gcf, 'Units', 'normalized'); set(gcf, 'Position', [0.2 0.2 0.5 0.5]); subplot(2,2,1); plot(fit.obs_FAR2_rS1, fit.obs_HR2_rS1, 'ko-','linewidth',1.5,'ma...
d9a95876c8e415a5ec6195dd116eae0c357e9338b7b14d766844133eb6ba56f9
MATLAB
2,487
62
function [concat, concattypes, flybyfly] = concat_dFF(flies, trtyps, fr, baseper) % aka Step 1 from columnsbytrial % This will calculate the baseline as mean of lowest x percent values per % column across concatenated trials (in one experiment). % Then it calculates the dF/F. % To run this, you need to navigate ...
310b6e7fecc318cddb54e91d547239ff4319271a5441dacb9361d1e6a268fadc
MATLAB
2,488
166
% This video was uploaded and converted to .gif with Giphy: % https://giphy.com/create/gifmaker % % https://media.giphy.com/media/cI4WhBFPtnwhMoXAuD/giphy.gif D = imread('D-Pine_Black.jpg'); Dflat = any(D, 3); Df = uint8(repmat(Dflat, 1, 1, 3)); [n, k] = size(Dflat); t = 25; C = imread('../New_hampshire_colors.jpg'...
b9eb7fb54bdd74a85cb939559aae12b2394dfb356c1b5d3e9213df1b759d835a
MATLAB
2,489
75
% pop_importev2() - merge a neuroscan EV2 file with input dataset % (pop out window if no arguments). % % Usage: % >> OUTEEG = pop_importev2( INEEG ); % pop-up window mode % >> OUTEEG = pop_importev2( INEEG, filename); % % Inputs: % INEEG - input EEGLAB data structure % filename ...
4187d9f38d6369a4a2de3eb1067cf97f1dd0546f20371d8033f68a64e3a5aca6
MATLAB
2,491
77
%% Performs k-means clustering to classify the datasets into 2 groups based on their mean and variability clearvars -except Fig3Ddata highsync lowsync; % Clear all variables except those needed: Fig3Ddata, highsync, lowsync % Copy data for manipulation to avoid overwriting original variables ftemp = Fig3Ddata; h...
e99c1b7324a2285ed9a6d8dc7358207b4843ad137e0c1b20a46088b5547d2988
MATLAB
2,491
90
function x = subsasgn( x, S, y ) % Disciplined convex/geometric programming information for SUBSASGN: % Subscripting can be used to change values of elements or slices % of CVX variables in the same manner as with numeric arrays. All % conventions are preserved, including the colon ':' and 'end' % ...
0252bb8f655c0bbc50fcd28384c21c22827f424f0073e3235d19772a3f02d2dc
MATLAB
2,492
73
function codeKeeper = syncPatternFinderNSx(filenameNSx) % syncPatternFinderNSx % % Canculated the unique 8-bit code and the associated timestamp of the SYNC % pulse of the NSP. % % Use codeKeeper = syncPatternFinderNSx(filenameNSx) % % All input arguments are optional. Input arguments can be in any order. % % fil...
f6955685f6064ccb209bd2e8a043ab114ee328ccf0687b814a400de954673b37
MATLAB
2,496
90
function afv=ea_concatfv(fv,usecork,reduce) if ~exist('reduce','var') reduce=0; end if ~exist('usecork','var') usecork=0; end if isa(fv, 'matlab.graphics.primitive.Surface') fv = arrayfun(@(x) surf2patch(x,'triangles'), fv); end dataTrimmed = 0; for f=1:length(fv) if size(fv(f).vertices, 1) < size(fv...
263d380121cd2ff7ff6e2a0a3c7af35b24c3a54f0f62b1fa441943ab3dfa90eb
MATLAB
2,497
74
function [ ] = run_cdiff_crossvalidation( ) % 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, Ge...
63ef355e1117cb515f6081a48e3a7254f8425ba212dd210aa5c83c44f1dd10af
MATLAB
2,497
75
function CBIG_testRetest_k3(rid_prob, rid_prob_new, rid_colors, dotSize, lineColor) % CBIG_testRetest_k3(rid_prob, rid_prob_new, rid_colors, dotSize, lineColor) % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md inputname(2) % Match prob_old = []; prob_new = []; color...
78d1463880ea5c4ce6e23c95fd072c50551c2a7f5e679d83a2dd830318884baf
MATLAB
2,497
77
% inputdlg2() - inputdlg function clone with coloring and help for % eeglab(). % % Usage: % >> Answer = inputdlg2(Prompt,Title,LineNo,DefAns,funcname); % % Inputs: % Same as inputdlg. Using the optional additionnal funcname parameter % the function will create a help button. The help message will...
9eee752b191d169c61e9f23d9621293b62eccb8dd107e3a809fc660515a0575c
MATLAB
2,499
54
% 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...
f4cb06db20a7797bf46629926db8296520385564f301208beed11ccb28a380cc
MATLAB
2,499
76
function mineig = minpsdeig(x,K) % mineig = minpsdeig(x,K) % % MINPSDEIG Computes the smallest spectral coefficients of x w.r.t. K % Uses an iterative method if the matrix is large, takes the minimum of all % the eigenvalues if the matrix is small. % % ********** INTERNAL FUNCTION OF SEDUMI ********** % % See also se...
87b26a36366aa01030fd03e4f0141a0a38e31c0cb04740a7766b6702afc501a8
MATLAB
2,501
80
%%*************************************************************** %% logcheby: logarithmic Chebyshev approximation problem. %% SDP formulation. %% minimize t %% x,t %% such that 1/t <= (x'*B(i,:))/f(i) <= t, i = 1:p. %% %% B = pxm matrix, f = p-vector, p > m. %% %% Ref: Vanderberghe...
bbec9d06df8519eb8432bfc5e428fedfeeea36b077823d9176dfbd34a4ce6ce9
MATLAB
2,501
73
% pop_copyset() - Copy the current EEG dataset into another dataset. % % Usage: % >> ALLEEG = pop_copyset(ALLEEG, index1); % pop-up % >> [ ALLEEG EEG CURRENTSET ] = pop_copyset(ALLEEG, index1, index2 ); % % Inputs: % ALLEEG - array of dataset structure % index1 - input dataset number % index2 - in...
c889d8047d3ebb2c5d269b99871a76430ccf34fdaae52f2b3f1214a8bc9128fb
MATLAB
2,502
71
function LeG_setdefaultbutton(figHandle, btnHandle) % WARNING: This feature is not supported in MATLAB and the API and % functionality may change in a future release. %SETDEFAULTBUTTON Set default button for a figure. % SETDEFAULTBUTTON(BTNHANDLE) sets the button passed in to be the default button % (the button and ...
f8ba1f4aa44563ae839a02c475e35945d3f0a68a984fcdd1e56602a4766cd78c
MATLAB
2,502
64
function r = lambdaReference(kind, varargin) %LAMBDAREFERENCE Reference largest Lyapunov exponent, with its provenance. % % r = nonantest.lambdaReference('skewtent', 0.3) % r = nonantest.lambdaReference('lorenz') % % Returns a struct: % r.nats lambda1 in nats per unit time (per iteration for maps) % r...
13d2d038e3203e3d0145e689dd13198e09f7243e70a5ba1a7134074c3a52229e
MATLAB
2,503
57
function [Gprime, Gprimeprime, omega1, omega2] = get_complex_modulus(stress, strain, omega, dt) % GET_COMPLEX_MODULUS Extract the storage and loss moduli (G', G'') from % stress and strain time series under oscillatory (harmonic) shear. % % [Gprime, Gprimeprime, omega1, omega2] = GET_COMPLEX_MODULUS(stress, % stra...
cb104fae96bfa4da718494ca9330c7587aadc51e329a3b2b1a16e8e528653678
MATLAB
2,503
88
function matrixOut = smooth2a(matrixIn,Nr,Nc) % Smooths 2D array data. Ignores NaN's. % %function matrixOut = smooth2a(matrixIn,Nr,Nc) % % This function smooths the data in matrixIn using a mean filter over a % rectangle of size (2*Nr+1)-by-(2*Nc+1). Basically, you end up replacing % element "i" by the mean of the r...
175e2ca1cefa1ef02553ed35843f1c19930aa8e9ba622a2b079d737d4b0b86a8
MATLAB
2,505
86
function y=parseBiopac(fname,trigCh,trigs,samples,chIDlist) % Usage ... y=parseBiopac(fname,trigCh,trigs,samples,chIDlist) % % For ex. % parseBiopac('MyACQfile.acq','StimON'); % parseBiopac('MyACQfile',[],[],123456+[-5000 25000]); % parseBiopac('MyACQfile','StimON',[2:11],[-5000 25000]); if nargin<3, trigs=[...
f1cc6418596e9a237ba39446716ed763659c73fc6bc993ccbdbd22be28754a68
MATLAB
2,505
93
% eeg_emptyset() - Initialize an EEG dataset structure with default values. % % Usage: % >> EEG = eeg_emptyset(); % % Outputs: % EEG - empty dataset structure with default values. % % Author: Arnaud Delorme, CNL / Salk Institute, 2001 % % See also: eeglab() % Copyright (C) 2001 Arnaud Delorme, Salk Institute, a...
3bb4360dee94ce2ac87b9bdfd45380c59076a0e96a68e8d34fde0fd442158d63
MATLAB
2,506
83
function [tok] = tokenize(str, sep, rep) % TOKENIZE cuts a string into pieces, returning the pieces in a cell array % % Use as % t = tokenize(str) % t = tokenize(str, sep) % t = tokenize(str, sep, rep) % where % str = the string that you want to cut into pieces % sep = the separator at which to cut (default ...
ba56cb21955253f06e8f8b014e56626ce3608e7eeeb666ba766668ab97d00e7f
MATLAB
2,506
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...
089b7c59b690b93cce51dabbabd851a60ea20ec7863182c15cc5f06635892fa9
MATLAB
2,507
66
function [listOfNorms,normedVectors]=normList(vectors,doCheck,correctNaN) %calculates the norm of a list of vectors % %SYNOPSIS [listOfNorms,normedVectors]=normList(vectors,doCheck,correctNaN) % %INPUT list of vectors (nVectorsXdimension) % noCheck (optional, true/false, default: true): normList checks for ...
57f75bace88ebc2756beb11baf37a1b80d3bf755c3f2ae42bf192ff130b0e2de
MATLAB
2,507
60
function [traj] = wrap_numIntTrajFromSamples(T_sample,t0,t_end,dt,perturbations,experimentBlocks,pathogen_ID,pathogen_t0,Y0_ex_pathogen,Y0_pathogen,med_biomass,med_counts,glv_params,assumeStiff) % This file is a part of the MDSINE program. % % MDSINE: Microbial Dynamical Systems INference Engine % Infers dynamical syst...
caab12c7a03db9b266bff8eb788be2d6a659f391a5b8ecfc199417b7c8cfadba
MATLAB
2,507
66
function [cp,selectFeature,featureWeight,featureCOH] = interCOHBinclass(datatrial,trialtag,fold,featureNumber,freBand) alphaTrainset = permute(EEGfilter(permute(datatrial,[2 1 3]),freBand,'BP',5,'all',500),[2 1 3]); % Measure the coherence alphaCOH = zeros(sum(1:61),size(alphaTrainset,3));% The array to store the IS...
19b817e777f38e3482c06947e5478128895c9743fa7b664e14fb4fe62d9ff98d
MATLAB
2,509
86
function [ WPNEW,DPNEW,WONEW] = CreateCollocationTopics( C,Z,WO,DS,WS,T, MAXC ) %% Function CreateCollocationTopics % % Create new vocabulary and topic counts based on collocation model output %% % |[ WPNEW,DPNEW,WONEW] = CreateCollocationTopics( C,Z,WO,DS,WS,T,MAXC)| % creates a new vocabulary |WONEW| and new sp...
90994b9098ca5fd904c94ee0d4eb6e377a957cf2369e57c3835d1f5f8c16174d
MATLAB
2,509
74
% FROMPACK Converts a cone problem in SDPPACK format to SEDUMI format. % % [At,c] = frompack(A,b,C,blk) Given a problem (A,b,C,blk) in the % SDPPACK-0.9-beta format, this produces At and c for use with % SeDuMi. This lets you execute % % [x,y,info] = SEDUMI(At,b,c,blk); % % IMPORTANT: this function assumes that th...
85919aeb1eda47eb0d4fe58937f8c13a9870fa41fd99f5233bf0404519b8d0f3
MATLAB
2,511
85
function gcdf = palm_gcdf(G,df1,df2) % Convert a pivotal statistic computed with 'pivotal.m' % (or simplifications) to a parametric p-value. % The output is 1-p, i.e. the CDF. % % Usage: % cdf = palm_gcdf(G,df1,df2) % % Inputs: % G : G or Z statistic. % df1, df2 : Degrees of freedom (non infinite). % ...
0151ee8cc0eb0e3a687eca60ee3e5976d1bd32f96273249ea3f924424a5e24e1
MATLAB
2,512
100
function [adfreq, n, ts, fn, d] = nex_cont(filename, varname) % nex_cont(filename, varname): Read continuous variable from a .nex file % % [adfreq, n, ts, fn, d] = nex_cont(filename, varname) % % INPUT: % filename - if empty string, will use File Open dialog % varname - variable name % % continuous (a/d) ...
67f1a3975df51beb907c4299e8421ce525dc36a581bd80a37100244ac80c0297
MATLAB
2,512
73
function cvx_optpnt = convex_poly_coeffs( deg, mm ) %#ok %CONVEX_POLY_COEFFS Coefficients of convex degree-n polynomials. % CONVEX_POLY_COEFFS(DEG), where DEG is a nonnegative integer, creates a % CVX vector variable of length DEG+1 and treats its values as % coefficients of a polynomial (in the same sense as...
0ca9fee9c90617c0570440ae219289d4934e068010471f094093028b968e09d3
MATLAB
2,514
66
function [BAPremoval_coef, trace_BAPremoval] = ... BAPupdate_GUI(dff_all, BAPremoval_coef, trace_BAPremoval, BAP_current, scrsz, titlename, spID) pos_BAPremove = round([50 scrsz(4)*0.4 min(scrsz(3)/2,550) min(scrsz(4)/2, 400)]); minF = 0; for k = 1:size(dff_all, 2) trace_current = dff_all(:,k); yvalue = t...
1bcd4cc4e535328919ee6a551b2aa689dc1723842a6493947eefe780b9d249df
MATLAB
2,515
65
%% PaCER/EXAMPLE_2_1.m - Longitudinal Datasets and Plot of Segmentations and simplified VTA % % Andreas Husch % Centre Hospitalier de Luxembourg (CHL) / Luxembourg Centre for Systems % Biomedicine (LCSB), University of Luxembourg % mail@andreashusch.de / husch.andreas@chl.lu % 2017 % %% Make sure all PaCER files (incl...
2aa9b428fa4b9dd4d38e2326cff7f1f324293d63219c4a12abb0efa8015b7a49
MATLAB
2,515
76
function [NEV] = mergeNEV() %% % Saves a new NEV file that contains event data from one NEV and spike data % from another %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Use: mergeNEV() %mergeNEV version = '1.0.0.0'; %Author: Nick Halper %Contact: nhalper@blackrockmicro.com %% % Choo...
502d6b1e3329d9a667fe1942ca5257d14ddb5d10d1e5cda662d308376a6e4a72
MATLAB
2,515
57
% SOFA API - demo script % Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences % Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "License") % You may not use this work except in compliance with t...
624fb158891a3b15873df1312808431ccc826a4a2e19413e52905d5f91e4da98
MATLAB
2,515
107
function y = norms( x, p, dim ) %NORMS Internal cvx version. % % Size check % narginchk(1,3); try if nargin < 3, dim = []; end [ x, sx, sy, zx, zy, nx, nv, perm ] = cvx_reduce_size( x, dim ); %#ok catch exc error( exc.message ); end % % Check second argument % if nargin < 2 || isempty( p ), p...
7f6c5ed3cd9d18ba98c142c7e8547c0bf27f21e6ab395b0c4f32f58694402657
MATLAB
2,516
80
% Chebychev design of an FIR filter given a desired H(w) % "Filter design" lecture notes (EE364) by S. Boyd % (figures are generated) % % Designs an FIR filter given a desired frequency response H_des(w). % The design is judged by the maximum absolute error (Chebychev norm). % This is a convex problem (after sampling i...
40443fbef7ba83ecfe9f79e540a80cc8a3f784de8db1870f247c7a87682831a8
MATLAB
2,518
75
function lines = cvx_error( errmsg, widths, useline, prefix, chop ) % CVX_ERROR Formats text for inclusion in error messages. % This is an internal function used by CVX. It needed to be in the CVX % home directory so that it's available during a fresh installation. if ~ischar( errmsg ), if strncmp( errmsg...
8fd02a39b08726f4194b6359f7d21e9891b817f609eb17c0a2d497931bc5e19e
MATLAB
2,518
77
function [m,ll,ul,llj,ulj]=den_jack(X,family,varargin) % Function to compute smooth estimates of the mean of x using locfit, % the corresponding confidence intervals, and jackknife estimates of % the confidence intervals % Usage: [m,ll,ul,llj,ulj]=den_jack(x) % % Inputs: % X: data in the form samples x trials ...
bb10342c4f9e5e34ceaff372c0e470c5ba8f8c4caef794b6b2744b8b62e469a2
MATLAB
2,518
60
function [LL, Ld, Lskip, Ladd] = blkchol(L,X,pars,absd) %#ok % [L.L, L.d, L.skip, L.add] = blkchol(L,X,pars,absd) % % BLKCHOL Fast block sparse Cholesky factorization. % The sparse Cholesky factor will be placed in the fields L.L, L.d; % the symbolic factorization fields remain unchanged. % On input, L should ...
cd4e57226b0bfdd79e02da91d88e2f12401eb0cd987aa7b03489ac3f6ddd5a23
MATLAB
2,518
67
function test_shortest_paths %% msgid = 'matlab_bgl:test_shortest_paths'; %% all_shortest_paths Dtrue = [0 1 -3 2 -4; 3 0 -4 1 -1; 7 4 0 5 3; 2 -1 -5 0 -2; 8 5 1 6 0]; load('../graphs/clr-26-1.mat'); D = all_shortest_paths(A); if any(any(D ~= Dtrue)) error(msgid, 'all_shortest_paths returned an incorrect distance...
53bb7310fcbef6457cca34af058ce4b50c3e6962dbb6c4290d1bbeb716f90694
MATLAB
2,519
88
function [matsurf,labels]=ea_showconnectivitypatch(resultfig,pV,mX,thresh,atlaslegend,atlasindices,usecolormap,showregs,showlabels) matsurf=[]; labels=[]; if showregs tmX=abs(mX)>thresh; options.prefs=ea_prefs(''); if options.prefs.hullsmooth tmX=smooth3(tmX,'gaussian',options.prefs.hullsmooth); ...
7f2e30df430580f3cc1b2c49117d0c17363a0bda264995adea645e576b705007
MATLAB
2,520
87
function seg=bbxflatsegment(node,loop) % % seg=bbxflatsegment(node,loop) % % decompose edge loops into flat segments along the x/y/z % planes of the bounding box % % author: Qianqian Fang, <q.fang at neu.edu> % date: 2008/04/08 % % input: % node: x,y,z coordinates of each node of the mesh % loop: input, a s...
90b55e8ef879e759cea378082c96965685dea9d1deaf592a77d0cc98f5065e1a
MATLAB
2,520
60
function dynamicBC_Reslice(PI,PO,NewVoxSize,hld,TargetSpace) % PI - input filename % PO - output filename % NewVoxSize - 1x3 matrix of new vox size. % hld - interpolation method. 0: Nearest Neighbour. 1: Trilinear. % TargetSpace - Define the target space. 'ImageItself': defined by the image itself (correspond...
2d33895c8161012ba675bd577e7c8104016282fa4118961e81bcbefe868b2507
MATLAB
2,523
60
% 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...
5738fe21b330d98f7618e6f596eb543b99694cc97f47ebbdbd079d0b9e8fd43a
MATLAB
2,523
84
function timestamps = edgeDetect(signal, threshold, type) % edgeDetect % % Detects rising or falling edges of a signal whenever the signal crosses % the threshold. % % % Use timestamps = edgeDetect(signal, threshold, type) % % Variables fname and threshold are optional. % % signal: Name of the file to be ope...
68a2a7029e6ef44dc849e668756760c3e48dccca22337679842e61350a3b3a88
MATLAB
2,523
43
function bool = isoctave() %ISOCTAVE True if the operating environment is octave. % % Usage: t = isoctave(); % % ISOCTAVE returns 1 if the operating environment is Octave, otherwise % 0 (Matlab) %***************************************************************************** % Copyright (c) 2010-2012 Qua...
49dd5567f69b5592f4951fa770b7817210292a29d821128c35c7f0bfa74e0c3d
MATLAB
2,525
82
function breadth_first_search(A,u,bfs_visitor,varargin) % BREADTH_FIRST_SEARCH Fully wrap the Boost breadth_first_search call % including the bfs_visitor. % % breadth_first_search(A,u,vis) performs a breadth first traversal % of A starting from vertex u. For each event defined by the bfs_visitor % structure below, t...
4362149bcd2064885e1b21b966b2ed1596027bc5158821174242ac6d62c87718
MATLAB
2,529
70
function rid_durations = CBIG_compute_disDura(subInfoFile, GMICVFile, K) % rid_durations = CBIG_compute_disDura(subInfoFile, GMICVFile, K) %%% Fetch onset year % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md fileID = fopen('//share/users/imganalysis/yeolab/data/ADNI_...
d45205c0fa2005b08152f144b1675a8d1bc71b4261a59fafb770fccc5dc92150
MATLAB
2,530
79
function [x, y, bodyline, sqr] = FindFly(chunk, sqrsize) %FINDFLY % % Usage: % [x, y, bodyline, sqr] = FindFly(chunk, sqrsize) % % This function takes in a single image matrix (chunk) and finds the fly. % First, it finds the brightest pixel in the image, then grabs a square % of size 2*sqrsize pixels around the f...
8d919c91b58bd96adf628db66889cd09abd44877031621e71a0f43c07fa1a5ac
MATLAB
2,532
65
function X = fruchterman_reingold_force_directed_layout(A,varargin) % FRUCHTERMAN_REINGOLD_FORCE_DIRECTED_LAYOUT A force directed graph layout % % Compute the layout for an unweighted, undirected graph. % See % http://www.boost.org/doc/libs/1_36_0/libs/graph/doc/fruchterman_reingold.html % for information about the ...
b1d8e0426349f28835511791a351e665f33dcc2bf280d2cfaed89225d17d5a59
MATLAB
2,532
76
function [] = convertClu2Kwik(varargin) % USAGE % [] = restoreOriginalKwik(kwikfile) % % INPUTS % % kwikfile - filename of .kwik file in current working directory % % OUTPUT % % this function restores the original klustakwik results to the /main branch of the .kwik file % David Tingley, 2017 p = inputParser; add...
1a1a00cca8c0d01f0ddd12fa31998ac61d5d25b2888e9f731bdb65ed4a798f11
MATLAB
2,534
47
% eeg_helphelp() - How to use EEGLAB help. % % EEGLAB MENU: % Each EEGLAB menu item calls a Matlab function from the commandline. If this % function pops up a graphic interface window, the figure title usually % contains the name of the function that the window will call. EEGLAB help % files are thus simply the col...
9469ff5140236b294ed95a87357182d43b5f9dadd9b180047bbf3e9391c85ba4
MATLAB
2,535
62
function Y_ds = downsample_data(Y,direction,tsub,ssub,nrm) % downsampling for 2d or 3d imaging data (already loaded in memory) % INPUTS % Y: input dataset in 2D+T or 3D+T format % direction: direction of downsampling: 'space','time','spacetime' % tsub: degree of downsampling in time % ssub: ...
0224b3ee427bfefeb501b1954207bc89d8db0b2c31efe7141a2ec12ba6768060
MATLAB
2,537
71
function pointsw = ea_antspy_apply_transforms_to_points(points, transform, useinverse) % Wrapper for ANTsPy's apply_transforms_to_points function arguments points {mustBeNumeric} % N*3 Input coordinates transform {mustBeText} % Transform or Lead-DBS patient folde...
9a0b0c77cfabeaa09a4e7f5dad5aace17df72f71c639246c617390a36e3f52ca
MATLAB
2,540
58
function p_fwe = tfce_fwe_from_null(tfce_real, TFCE_null_max) % tfce_fwe_from_null Voxelwise FWE-corrected p from a max-statistic null. % % p_fwe = tfce_fwe_from_null(tfce_real, TFCE_null_max) % % Implements the standard permutation FWE correction (Smith & Nichols 2009): % each voxel's observed statistic is comp...
b9f32215187d66f4acd661718de22fcf08383b4e7993e2b650dc9cb137151130
MATLAB
2,541
63
% CircStat Toolbox % Toolbox for circular statistics with Matlab % % Descriptive Statistics. % circ_mean - Mean direction of a sample of circular data % circ_median - Median direction of a sample of circular data % circ_r - Resultant vector length % circ_var - Circular variance % circ_std ...
55da713f5aae7d56e4b3ab55269d3afff8592c85b96654f0cfa6609b71347330
MATLAB
2,542
81
function [times,id,group] = CCGParameters(varargin) %CCGParameters - Reformat time series for CCG computation % % USAGE % % [times,id,group] = CCGParameters(series1,group1,series2,group2,...) % % series1... time series (one column) with optional IDs (in the second % column, such a...
db4465592657d1416708bb6141b41a04cbf6647c7bc58243a593fb7365977ded
MATLAB
2,542
76
function CBIG_ASDf_mean2mat(inputDir, outputDir, k, r, scalelim) % CBIG_ASDf_mean2mat(inputDir, outputDir, k, r, scalelim) % % This function computes factor-specific RSFC patterns (i.e., E(RSFC patterns|Factor)), % plot it and save it as a 419x419 matrix. % % Input: % - inputDir: % Absolute path to the di...
f8bc3da3ff65ea25b3b612fb8c87369adbc6a1b0190d26c889be79073dad8e8f
MATLAB
2,542
59
function [outdata, outsform1, outroi] = cifti_struct_dense_extract_volume_structure_data(cifti, structure, cropped, dimension) %function [outdata, outsform1, outroi] = cifti_struct_dense_extract_volume_structure_data(cifti, structure, cropped, dimension) % Extract the data for one cifti volume structure, expa...
fdc2708181a23b692bba9daff5d50bbd4b88c8b1dff34794e07669167202d9a6
MATLAB
2,542
65
function FLAG = flag_implicit_skip_nan(i) % FLAG_IMPLICIT_SKIP_NAN sets and gets default mode for handling NaNs % 1 skips NaN's (the default mode if no mode is set) % 0 NaNs are propagated; input NaN's give NaN's at the output % % FLAG = flag_implicit_skip_nan() % gets current mode % % flag_implicit_skip_nan(FLAG) ...
b0e81e18a777ca25adade7bb446eedba22ed9387e10d91fd7aa167449b3ab99e
MATLAB
2,544
50
function [ADAS, MMSE, NEUROBAT] = CBIG_MMLDA_behavior_choose(phase) % [ADAS, MMSE, NEUROBAT] = CBIG_MMLDA_behavior_choose(phase) % % This function reads in the ADNI1_behavior_choose.csv or ADNI2_behavior_choose.csv % into matlab and get the filednames, description, sign, category of ADAS, MMSE % and NEUROBAT behavior s...
01dd223b3ffc46cb86aae610decf25bcef2b96b6e93cc6f34aedc991ecf68c6e
MATLAB
2,547
50
% 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...
d0d1ad335a001460f01c7337cac14f82ce6ecac4474a2651e60988c1100f2924
MATLAB
2,548
68
function y = quad_form( x, Q, v, w ) %QUAD_FORM quadratic form. % QUAD_FORM(x,Q) is real(x'*Q*x) = x'*((Q+Q')/2)*x. % QUAD_FORM(x,Q,v,w) is real(x'*(Q*x+v)+w). % % x must be a row or column vector, and Q must either be a scalar or % a square matrix with the same number of rows as x. If supplied, v must % be ...
d62199bddc614080643628fe003acacb1bb09d1bb4c9bd634d6dcc08f139557d
MATLAB
2,548
82
function [ts_bold] = run_bold(topology, homparam, hetparam, stim, tol) % Compute the BOLD response, which is approximated as the zero frequency component of the underlying stimulus evoked response % ts_bold(r) = sum_n=0^\infty phi(r, t = ndt). % List of step-size inputs (topology) % T: time domain [0, T] ...
320660cf3c38c0f57a330bfd4ef50551b6b0c968e1f0a6b68e6506007b12c2f8
MATLAB
2,550
74
function [As,A,eil,Ei] = indexed_sparse(i,j,v,m,n,varargin) % INDEXED_SPARSE Create a sparse matrix with indexed edges. % % [As,A,eil,Ei] = indexed_sparse(i,j,v,m,n) creates a sparse matrix A just % like A = sparse(i,j,v,m,n). However, indexed_sparse returns additional % information. The matrix As is a structural mat...
6f787fb6c4a7ee9b8dc8b30973ce727d9df59e1be6f556cdc6bf8db9e7ac0e7d
MATLAB
2,553
79
function [A coords] = grid_graph(varargin) % GRID_GRAPH Generate a grid graph or hypergrid graph % % [A xy] = grid_graph(m,n) generates a grid graph with m vertices along the % x axis and n vertices along the y axis. The xy output gives the 2d % coordinates of each vertex. % [A xyz] = grid_graph(m,n,k) genera...
fe5efbe1e6f1c32ecfb72e8a8d048c22615583dc9764f5f15d15bcbbc1289bf4
MATLAB
2,553
87
%% New features in MatlabBGL version 4.0 % MatlabBGL 3.0 was only released as a beta test. Version 4.0 is a % full release with quite a few new features. %% Improved reweighted graphs % In MatlabBGL 3.0, reweighted graphs were a pain to use. Now they are % simple! We combine a structural matrix with a weight matr...
61a2e7fec8191d0a01ff9b014ead6f40989ff891348cb49ef9b10a5cb873af6f
MATLAB
2,554
106
% Testing script to check some of the PLS Toolbox functionalities clc; clear all; close all; addpath('./myPLS_functions') addpath('./RotmanBaycrest') addpath('./misc') %% defining all the inputs myPLS_inputs %% run PLS analysis, including permutation testing and bootstrapping res = myPLS_analysis(input,pls_opts); ...
66dca8df5c8f3487b0b752a8c779d8eea688194657bcb7d633cb2dc28e8bea2b
MATLAB
2,554
54
% 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...
bed3fcfa958b11c9409e49e82301061ae8e3a07cb3e60922eb1d74b1584ea391
MATLAB
2,554
84
function pointsw = ea_ants_apply_transforms_to_points(points, transform, useinverse) % Wrapper for antsApplyTransformsToPoints used for both linear % transformation and non-linear transformation arguments points {mustBeNumeric} % N*3 Input coordinates transform {mustBeText} ...
2f35f69bc8f5f006f0e213cd4408ba62880fbfd27ccc7bf146c931400b125a00
MATLAB
2,556
60
% This code simulate gradient echo (GRE) data: Magnitude and phase ( total, positive, and negative) (see README.md % for more details). %%%%%%%%%%%%%%%%%%%%% VARIABLES %%%%%%%%%%%%%%%%%%%%%%%% %%% Inputs: %%% % Chimap_file- 3D total susceptibility map % Chiposmap_file- 3D positive susceptibility map % Chinegm...
8395dd54a26c3e302962198891f2196bb88fb0e809f258ee65ee25ffa8dc4029
MATLAB
2,556
62
function dff2(foldername,Ypix,Xpix) %% load files % Folder with stack images of diferent sessions %foldername='Z:\Andrew\2-photon imaging\vt019532\vt019532_f3e4_010_corr'; %path to image folder cd(foldername); listfiles = dir('*.tif'); %will look for all the tif files % !!! Files are listed in alphabetical order...