sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d7ce0b37f0c6b6bd4ea5571e027f99b04c2f399a7ac169306979cccce77344c1
MATLAB
868
31
function rid_colors = CBIG_setColorByAmyloid(ridList) % rid_colors = CBIG_setColorByAmyloid(ridList) % Red a+; green a-; blue unknown % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md rid_viscode_dummyCol_amyloid = CBIG_get_amyloid(ridList); rid_amyloid = cell2mat(rid...
817d98ce9870b824d8909c621b78550cadaa821b510e862fac1d37fd1749c700
MATLAB
869
22
function y = pow_pos( x, p ) %POW_POS Power of positive part. % POW_POS(X,P) = POS(X).^P = MAX(X,0).^P. % Both P and X must be real, and P must be greater than or equal to 1. % % Disciplined convex programming information: % POW_POS(X,P) is convex and nondecreasing in X; so when used in CVX % expre...
ff17755261fec64fc9966d047f78121cd1de1198f886027726e85079c4bbb867
MATLAB
869
28
function cvx_setpath( arg ) %#ok %CVX_SETPATH Sets the cvx path. % CVX_SETPATH adds the internal cvx directories to Matlab's path so that the % CVX system can find the functions that they contain. There is no reason to % call this function during normal use of CVX; it is done automatically as % needed. Howe...
0ea7e3659d8d7342688b9f94c24bed014d18fc979385dba6fd8c349c5bad1514
MATLAB
870
36
function [conn,connnum,count]=neighborelem(elem,nn); % % [conn,connnum,count]=neighborelem(elem,nn) % % create node neighbor list from a mesh % % author: Qianqian Fang, <q.fang at neu.edu> % date: 2007/11/21 % % input: % elem: element table of a mesh % nn : total node number of the mesh % % output: % conn: ...
bee446a12c937785714ef5e5b2a658af784bdcf7797a146a306d5ce3fce6551f
MATLAB
870
24
function E = epochs_from_arrays(all_hbo, all_hbr, Fs, baseline_sec, block_sec, all_aux) %EPOCHS_FROM_ARRAYS Build epoch struct E from epoched arrays in memory. % E = nirsproc.epochs_from_arrays(all_hbo, all_hbr, Fs, baseline_sec, block_sec, all_aux) % % Inputs % all_hbo : nBlocks × T × nCh % all_hbr : nBlocks × T...
eb2afc51e551b4123f5d68634366bb21a18f9811bd77c134babc7640bcbdbf58
MATLAB
871
75
function B=permutation(n, dif_subjs) % This script is used for permutations. B=[]; bootstrap_num=0; k=n; for i = 1:n, A(i) = 1; end while A(1)<n, for i = 1:n, array(i) = 0; end for i = 1:n, array(A(i))=1; end sum=0; for i = 1:n, sum=sum+array(i); ...
72b48f1ef45d22454f2f97456d17725707edfbc352557f20195b3ab6eb716ece
MATLAB
872
20
function copyROIs(headpath,fileexpnum)%change back to regular if you want to use regular %function to copy the handdrawn ROIs to all other directories. %might need to add error checking. Can update hand drawn ones individually %if there needs to be shifts [ROIfile,ROIpath]=uigetfile('*.*'); %user picks ROI f...
3f0fe09889be1d95d433fd775d52bfa26957d2234b03be3e8de8adf2ee5451fb
MATLAB
873
43
function varargout = permission(varargin) % Format % For getting the value % dat = permission(obj) % % For setting the value % obj = permission(obj,dat) % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: permission.m 1340 2008-...
9dd944fd61a202027089776559f19c18bf90f65384225f454908a737ebebe193
MATLAB
873
29
function [xir,xjc] = sdpasplit(xcol,maxnnz) % ------------------------------------------------------------ % Allocate enough space % ------------------------------------------------------------ n = length(xcol); if nargin < 2 maxnnz = n; end xir = zeros(maxnnz,1); xjc = zeros(maxnnz+1,1); % --------------------...
04d1123e18011e603d644132b5a26c2b5a8dc9a8fbd6fb54fd5658f29f55f0b9
MATLAB
874
18
function z = mldivide( x, y ) % Disciplined convex/geomtric programming information for MLDIVIDE: % The MLDIVIDE operation X\Y can be employed with X as a scalar. In % that case, it is equivalent to the LDIVIDE operation X.\Y, and % must obey the same rules as outlined in the help for CVX/LDIVIDE. % ...
3858b0b898b8866fdbb72823659c17e39f41d926e1136302c82d6304abfefe4e
MATLAB
875
23
function [fluordatas,fluordata_reds,fluordata_diffs] = combineFluordata(flyname) % Use this if you run multiple experiments of the same type on the same % fly. This will combine the fluordata, fluordata_red, and fluordata_diff % structs. matfiles = dir(['*' flyname '*analysis2.mat']); ex=load(matfiles(1).name); ...
22d56a9a9304b7816b2662c12d2f34a7857fd5b0162eae4016d1e03b4d10c542
MATLAB
876
23
function [adfreq, n, ts, fn] = plx_ad_gap_info(filename, ch) import CMBHOME.PLX2Mat.* % plx_ad_gap_info(filename, channel): Read a/d info from a .plx file % % [adfreq, n, ts, fn] = plx_ad_gap_info(filename, ch) % % INPUT: % filename - if empty string, will use File Open dialog % channel - 0-based channel number % %...
f2d1e91c5e50023c458298eb4f54d185a21b3adeac38892df583048ab6bca3a0
MATLAB
876
18
function obj=coord_flip(obj) % coord_flip Flips plot axes % % Using coord_flip flips the plot axes, i.e. x data will be on the vertical axis and y data on % the horizontal axis. This is mainly useful to draw stat_ visualisations horizontally, % such as boxplots, violin plots, etc. Coord flip sets the following axes pro...
1c895cae613497823bde59c461c2aa594bcd02aad7cbece537a5452a3c01ec28
MATLAB
877
29
function setPosition( o, p, u ) %setPosition Set position of graphics object % % setPosition(o,p,u) sets the position of a graphics object o to value p % with units u. % % In contrast to setting the Position property directly, this function % honors the ActivePositionProperty of axes. % Copyright 2009-2016 The M...
349290a6b452dc208c10e518fcd363df3249f4a2f2b99820bb4eb6e74faea34a
MATLAB
877
28
function p = PlotSlope(x,y,slope,len,varargin) %PlotSlope - Plot line with given slope. % % USAGE % % p = PlotSlope(x,y,slope,len,<options>) % % slope line slope % x,y coordinates of central point % len segment length along the x axis % <options> line and color speci...
39f4adfcaba515889fd876d180af819a174ae3653298055cd1f4ec2976f76889
MATLAB
877
23
% isnumeric() - returns 1 % % Author: Arnaud Delorme, SCCN, INC, UCSD, Nov. 2008 % Copyright (C) 2008 Arnaud Delorme, SCCN, INC, UCSD % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either v...
3e795e1976ac28102f0bf0944d77abead597bde294aea1d9ad96a5945ba89dc8
MATLAB
877
27
%% plot every trial as unique comparisons (no averaging across flies) alldRdiffs=[]; alldLdiffs = []; % allhdjdiffs = []; % allhdbdiffs = []; for y = 1:15 % allhdjdiffs = [allhdjdiffs;hdjdiffs{y}]; % allhdbdiffs = [allhdbdiffs;hdbdiffs{y}]; alldLdiffs = [alldLdiffs;pfndLdiffs{y}]; alldRdiffs =...
7b7faca1fc4a40fc43c95843eaae12e4936f339aa3b54540b071489e704afdc8
MATLAB
877
42
% Demonstration of hierarchical model fits % % SF 2014 clear all Ntrials = 200; Nsub = 30; c = -0.3; c1 = [-1.5 -1 -0.5]; c2 = [0.5 1 1.5]; group_d = 2; group_mratio = 0.8; sigma = 0.5; mcmc_params = fit_meta_d_params; mcmc_params.estimate_dprime = 0; for i = 1:Nsub % Generate dprime d(i) ...
2bfacc2d3178220746f5a78d46ad66a2d78785f1e5ddae6def7b09c47dffeb49
MATLAB
878
22
function blocks = day_to_blocks_v2(datadir) all_folders = dir(datadir); all_folders = all_folders([all_folders(:).isdir]); all_folders = all_folders(~ismember({all_folders(:).name},{'.','..'})); blocks = length(all_folders); for b = 1:blocks clear block_number all_block_files block_number = str2num(all...
8d7e67d69a4caf7788761004289c896a0d5d0fdb018cd2415ca66206d5d81b95
MATLAB
878
24
function xlabelLowHighPkRespRatio(colors) xlabel({'',''}) num = '$$ \textrm{Peak Low Contrast}\; \Delta \textrm{F/F} $$'; barLine = '$$\rule{5.2cm}{0.1mm}$$'; den = '$$ \textrm{Peak High Contrast}\; \Delta \textrm{F/F} $$'; tNum = text(1,1,num,'Interpreter','latex','Units','Normalized'); tBar = text(1,1,barLine...
b49773aabd0b50ee8f60b0098e38b66c097bf88f9e9b7396102a54165675138f
MATLAB
878
37
function data = readNPY(filename) % Function to read NPY files into matlab. % *** Only reads a subset of all possible NPY files, specifically N-D arrays of certain data types. % See https://github.com/kwikteam/npy-matlab/blob/master/tests/npy.ipynb for % more. % [shape, dataType, fortranOrder, littleEndian, totalHea...
2c836c5d51ad825ae447a5b0249085b8c8c43460cb24d66d4c2b70fd2dd21557
MATLAB
879
19
function outputPaths = ea_get_oss_outputPaths(options,S) % Prepare various paths to conform with Lead-DBS BIDS structure. % by Butenko and Li, konstantinmgtu@gmail.com arguments options % lead-dbs options for electrode reconstruction and stimulation S % lead-dbs stimulation settings end outputPaths.sub...
76ac97a82f89b68a76f5063f2d016a17bcef18c973ff702d874b6f08d4920737
MATLAB
879
33
function [ convolution_result_fft ] = FConv( kernel, signal, varargin ) %FConv(kernel,signal) convolves a signal with a kernal via the fourier %transform for speedy delivery. %Note: as is, kernel is centered. % Adapted from Cohen Chapter 13 % %TO DO: % -add varargin in for centered or left-aligned kernel % %Last U...
c908aa75228ce280dce05d180845e5706c3a0c4fbf62fa777ff381ab57526d47
MATLAB
879
34
function [y_model,fit_params,rsquare,goodness] = SaturatingRegression(x, y) % Does a natural growth fit and returns the model expected values, % parameters of best fit, rsquare value, and other goodness object. % % [fit,params,rsquare,goodness] = CMBHOME.Utils.LogRegression(x,y) if length(x)~=length(y) error('LogR...
cab135007059f1e3d7a4234cb1f2c3bf0fad23d3e2a40afb8386085134526174
MATLAB
880
37
%%********************************************************* %% smat: compute the matrix smat(x). %% %% M = smat(blk,x,isspM); %% %% SDPT3: version 3.1 %% Copyright (c) 1997 by %% K.C. Toh, M.J. Todd, R.H. Tutuncu %% Last Modified: 16 Sep 2004 %%********************************************************** function M = ...
df7d73bd79414f7ac3fb29f32d6b2e5ad84365e93451143954fd3472b05131df
MATLAB
880
35
function savetetgennode(node,fname) % % savetetgennode(node,fname) % % save a mesh node list to tetgen .node format % % author: Qianqian Fang, <q.fang at neu.edu> % % input: % node: node coordinates, dimension (nn,3) % columns beyound the 3rd column are treated as % markers and attributes as...
ae24fa916d4bfd91052d4b86d1c387568d7461261134688eeeb85c0a4067cffb
MATLAB
881
25
function [Xpix,Ypix,FrameRate,Zframes,fbframes]=findkeyparams_newThor5D() %use this function to get the FOV and the framerate of aquisition %you have to parse the XML file from thor. %this sucks and is definitely not elegent disp('Show me where the XML file is for any experiment from this set'); [matexpfile...
daef80fffa3dd21b5b14ca522595e31faabcd476905c114eb86c67801e82017f
MATLAB
881
48
function [pnt, tri] = read_vtk(fn) % READ_VTK reads a triangulation from a VTK (Visualisation ToolKit) format file % Supported are triangles. % % Use as % [pnt, tri] = read_vtk(filename) % % See also WRITE_VTK % Copyright (C) 2002, Robert Oostenveld % % $Id$ fid = fopen(fn, 'rt'); if fid~=-1 npnt = 0; while...
e798bf49447e578690a41eae7f6040cab6b9621eec9d3d94c16e8a7a37adb46d
MATLAB
881
35
function cwt = loadCwtMultiChannelCrop_(filePaths, trialIdx, fIdx, tIdx, useSingle) % Return: nTrialSelected x nChannel x nFreqSelected x nTimeSelected if islogical(trialIdx) trialIdx = find(trialIdx); end nTrial = numel(trialIdx); nCh = numel(filePaths); nFreq = numel(fIdx); nTime = n...
23f5d022dadafc6825fba70f34fe24ecf871ad2f988e71e8593bea4dad76b432
MATLAB
882
39
function frame = getnext(vr) %FRAME=GETNEXT(VR) % This method is a shortcut for % if (next(vr)) % frame = getframe(vr); % else % frame = []; % end % % Although this method can be more convenient than calling NEXT and GETFRAME % separately, there is no way to distinguish between a zero-sized frame ...
3355bd2a9293b68268e42ce18c5c8b893f87adf776abac0034f3e9883399cefe
MATLAB
882
27
function data=createdatamatc(data,E,Fs,win) % Helper function to create an event triggered matrix from univariate % continuous data % Usage: data=createdatamatc(data,E,Fs,win) % Inputs: % data (input time series as a column vector) - required % E (events to use as triggers) - required % Fs (sampling frequen...
58ffd6a478f3d04442f3be411d05e996d255783ce8842ce63cb8e5718f5b45c4
MATLAB
882
49
function M1 = vox2ras_0to1(M0) % M1 = vox2ras_0to1(M0) % % Converts a 0-based vox2ras matrix to 1-based, ie, % Pxyz = M0*[c r s 1]' = M1*[(c+1) (r+1) (s+1) 1]' % % % vox2ras_0to1.m % % Original Author: Doug Greve % CVS Revision Info: % $Author: nicks $ % $Date: 2011/03/02 00:04:13 $ % $Revision: 1.3 $ % % Co...
7551b31fadfbeb1f25a475d97f34cbc68fd7bbba726e3b3f70afce54602f6cd0
MATLAB
883
32
function [x,y]=to_polar(obj,theta,rho) %If the graph is set as polar, x and y are interpreted as rho and %theta respectively, and data is converted in cartesian x and %y. Passthrough if is_polar is false if obj.polar.is_polar if iscell(theta) x=cell(size(theta)); y=cell(size(theta)); for k=...
58b15ed815617d70f55b82956d39f632c78ff71b677ea32ed7ca69af1164f596
MATLAB
884
42
function [f]=OIS_corr2(data,reference) % Usage ... f=OIS_corr2(data,reference) % % reference - reference waveform for correlation % Image-course approach sumim=0; sumref=0; count=0; sumnx=0; sumny=0; sumnxy=0; sumnx2=0; sumny2=0; %t=clock; %disp(['Time:']); %disp(t); disp(['Initiating Analysis...'])...
9912ccdcaf92e68873b03209dc7920c81b67cf1cd095f698525b758f51377883
MATLAB
884
24
mean_rr1a_micronsWsm=mean(all_rr1a_micronsWsm,2); mean_rr1aSEM_micronsWsm=mean(all_rr1aSEM_micronsWsm,2); mean_rr1a_percentWsm=mean(all_rr1a_percentWsm,2); mean_rr1aSEM_percentWsm=mean(all_rr1aSEM_percentWsm,2); mean_rr2a_micronsWsm=mean(all_rr2a_micronsWsm,2); mean_rr2aSEM_micronsWsm=mean(all_rr2aSEM_micronsWsm,2); ...
9c5a7f45946f337169e6dfeed53ce83670e199a58e1d835014d4dba7973ada8a
MATLAB
884
29
function [isLFP] = bz_isLFP(lfp) % USAGE % [] = bz_isLFP(lfp) % % INPUT % lfp - struct with the following fields % .lfp % .timestamps % .samplingRate % .channels % % % OUTPUT % logical true if struct meets lfp crite...
c18dccf7ddb916b68113b6615d722b31f2c4dc806a4aa0052a857d2bd7361df9
MATLAB
884
33
% Exercise 4.3: Solve a simple QP with inequality constraints % From Boyd & Vandenberghe, "Convex Optimization" % Joëlle Skaf - 09/26/05 % % Solves the following QP with inequality constraints: % minimize 1/2x'*P*x + q'*x + r % s.t. -1 <= x_i <= 1 for i = 1,2,3 % Also shows that the g...
c53196f0fb37cf1ff80b53dc35a60f6875d8ce35eb15f193303f793bde94c7f8
MATLAB
884
19
function Lambda=BarycentricCoordinatesTriangle(VN0,VN1,VN2,rx,ry) % Normalization factors f12 = ( VN1(2) - VN2(2) ) * VN0(1) + (VN2(1) - VN1(1) ) * VN0(2) + VN1(1) * VN2(2) - VN2(1) *VN1(2); f20 = ( VN2(2) - VN0(2) ) * VN1(1) + (VN0(1) - VN2(1) ) * VN1(2) + VN2(1) * VN0(2) - VN0(1) *VN2(2); f01 = ( VN0(2) - VN...
31c4ee340b1cfc1bacfaaa4a3ea12919dbd4bb781b7b512edb8781e54436a042
MATLAB
885
28
function minimise( varargin ) %MINIMISE Specifiies a convex (or affine) objective to be maximized. global cvx___ prob = evalin( 'caller', 'cvx_problem', '[]' ); if ~isa( prob, 'cvxprob' ), error( 'No CVX model exists in this scope.' ); elseif isempty( cvx___.problems ) || cvx___.problems( end ).self ~= prob, ...
5e06d78a43283ba56085a985db98b1d60cfc6808a270b3faa63ac831fadfc6a6
MATLAB
885
36
function m=jVecToSymmetricMat(v,msize,offset) % converts a vector into a square symmetric matrix % % IN: % v: nx1 vector of numbers % msize: scalar, resulting matrix size (msize rows by msize columns) % OUT: % m: square symmetric matrix % % v1.0 Nov 2009 Jonas Richiardi % - initial release % v1....
80681409f53613396614ba72d7cb708646f1f6aa553c76653d665d652479365b
MATLAB
885
28
function minimize( varargin ) %MINIMIZE Specifiies a convex (or affine) objective to be maximized. global cvx___ prob = evalin( 'caller', 'cvx_problem', '[]' ); if ~isa( prob, 'cvxprob' ), error( 'No CVX model exists in this scope.' ); elseif isempty( cvx___.problems ) || cvx___.problems( end ).self ~= prob, ...
01366a011cb9bc467b5f50b06ee8b8ba35ca757851558df931505f2be562cf30
MATLAB
886
24
function isMotorStop = motorStop(stepperHandle, panelHandle) unitStep = fix(360/0.13*16);% pulses per mm timeDelay = 5; valPtr = libpointer('int64Ptr', 0); calllib('phidget21', 'CPhidgetStepper_getCurrentPosition', stepperHandle, 0, valPtr); currPosition = get(valPtr, 'Value'); calllib('phidget21', 'CPhidge...
3ba298da83a0e44e8069272a5f7e821e88d8840890f3625a76b8c9ac6d33ac94
MATLAB
886
28
function maximize( varargin ) %MAXIMIZE Specifiies a concave (or affine) objective to be maximized. global cvx___ prob = evalin( 'caller', 'cvx_problem', '[]' ); if ~isa( prob, 'cvxprob' ), error( 'No CVX model exists in this scope.' ); elseif isempty( cvx___.problems ) || cvx___.problems( end ).self ~= prob, ...
4e8bdb92c1dacdb9f6809241cbd8a5c13f3da98ea4e22810f983d404fd567a40
MATLAB
886
28
function maximise( varargin ) %MAXIMISE Specifiies a concave (or affine) objective to be maximized. global cvx___ prob = evalin( 'caller', 'cvx_problem', '[]' ); if ~isa( prob, 'cvxprob' ), error( 'No CVX model exists in this scope.' ); elseif isempty( cvx___.problems ) || cvx___.problems( end ).self ~= prob, ...
827375cc625c854b720ec068a09405dcdb4935136c3f315ea952b2a52b617721
MATLAB
886
33
%%%%%%%%%%%%%%%%%%% %% Zicheng Yang CCMU %% origin averaged calcium signal of several mice; heatmap %% Version: 0.1-2024/07/08-YZC-initial version %%%%%%%%%%%%%%%%%%% clear all; close all; % parameters nko=5; nwt=5; Ts=1/100; mcako =xlsread('x'); mcawt =xlsread('x'); avmcak =mean(mcako,1); stmcak=s...
d8f2423cd7d21018113749c03d126ee6f06fc536001c3903bb16274294ac8767
MATLAB
886
27
function z = colon( x, y ) if ~isa( x, 'cvxdual' ), z = x; x = y; y = z; end global cvx___ try dvars = cvx___.problems( x.problem_ ).dvars; q = builtin( 'subsref', dvars, x.name_ ); catch error( 'CVX:Corrupt', 'Internal CVX data corruption. Please CLEAR ALL and rebuild your model.' ); end if q.attached_...
f0869e39140549149fa1dea845dfca2e672fd5ca02d4af18e7838b8f49592cf3
MATLAB
886
31
function [varargout]=kolmogorov_max_flow(A,u,v,varargin) % KOLMOGOROV_MAX_FLOW Kolmogorov's max flow algorithm % % Kolmogorov's algorithm implements a variation on the augmenting path idea % to compute a maximum flow or minimum cut in a network. % % See the max_flow function for calling information and return paramet...
3a2a6c9ee553131943fe5b18027560af4add4b2de3bd723fb82e9e8885668fe0
MATLAB
887
33
%GetNextItem - Get next item from a Batch object (iterator mode). % % This is a helper class to easily read and parse batch files. % % USAGE % % [b,item,line] = GetNextItem(b); % % b batch object % Copyright (C) 2007 by Michaël Zugaro % % This program is free software; you can redistribute it and/o...
7966dc8b2f03c815be608104d29962ca7580e279ac6e75abcd3086caf5f9544f
MATLAB
888
34
function ea_acpcdetect(inputimage, outputimage) % Wrapper for acpcdetect % % Detect AC and PC locations, set the origin of the input NIfTI image to % the AC-PC midpoint. Output image will be tilt-corrected and in RAS % orientation. if nargin < 2 outputimage = inputimage; end ea_libs_helper; basedir = fileparts(m...
7bb71274bbb10605aabefb473f9933c26b52ea36ae922eefcc24afa84b79e487
MATLAB
888
37
function y = log_normcdf( x ) %LOG_NORMCDF Internal CVX version. narginchk(1,1); if ~isreal( x ), error( 'Argument must be real.' ); end persistent a b nb ob if isempty( a ), a =sqrt( [ 0.018102332171520 0.011338501342044 0.072727608432177 0.184816581789135 ...
f8f3484e7026f172e188260e75461efb1962ed54284ce01704464aad24ed2888
MATLAB
888
36
function spy( x, mode ) global cvx___ % SPY is not a computational function, so it can be applied to any % CVX variables. switch nargin, case 0, error( 'Not enough arguments.' ); case 1, mode = ''; case 2, if ~ischar( mode ) || size( mode, 1 ) > 1, error( 'Second...
1ac79cb769a796d3d5022677b22b216e954ccdf84aba20385e37ac11806d3b30
MATLAB
890
30
function [V,F,nF,T,nT]=process(V,F,nF,T,nT,Frows,F_Local,F_Local_new, Vertex_id) % Remove faces by replacing them Frows=sort(Frows(:),1,'descend'); for i=1:size(F_Local,1), F(Frows(i),:)=F(nF,:); nF=nF-1; end for i=1:size(F_Local_new,1) F2=F(1:nF,:); checkduplicate=(any(F2==F_Local_new(i,1),2)&a...
291f4d48448728f6aa68bc9a80c24eb5ddef864f7d369f08b3afb79488b655dc
MATLAB
890
36
function [n,names] = plx_chan_names(filename) % plx_chan_names(filename): read name for each spike channel from a .plx or .pl2 file % % [n,names] = plx_chan_names(filename) % % INPUT: % filename - if empty string, will use File Open dialog % % OUTPUT: % names - array of channel name strings % n - number...
daca599351c060c296a85414719549817ff6b2482dc2aa13869ced01f877ec1d
MATLAB
890
32
function y = cvx_blkdiag( varargin ) % A reimplemenetation of MATLAB's blkdiag function, which is broken in % certain versions of MATLAB. if nargin == 1, y = varargin{1}; else isYsparse = false; for k = 1 : nargin, x = varargin{k}; [ p2(k+1), m2(k+1) ] = size(x); %#ok if issparse(x...
fac64acdab55dad883a1f83e75d6dc7a459ff1e2d32ec41140eec703cf2af797
MATLAB
890
19
function z = mrdivide( x, y ) % Disciplined convex/geomtric programming information for MRDIVIDE: % The MRDIVIDE operation X/Y is quite often employed with Y as a % scalar. In that case, it is equivalent to the RDIVIDE operation % X./Y, and must obey the same rules as outlined in the help for % ...
fadf78a550b12bad254c55eef01c9a739bb158bacebdac54db1f197604e41559
MATLAB
890
34
% W = dwt3(V, wl) % % Implements the discrete 3D wavelet transform, using Matlab 2D functions. % % See also: idwt3 % Code written by Iman Aganj. function W = dwt3(V, wl) for i=1:3 s(i) = length(dwt(zeros(size(V,i),1), wl)); end W.wl = wl; W.dec = cell(2,2,2); for i=1:2 for j=1:2 for ...
1f9d1b8e6c241aed055ea76f95024b9e85d2a6e1f928f2fcc2d2c681d3288975
MATLAB
891
21
function xmax=findpeaks_chronux(data,threshold) % Helper function to find peaks in a given continuous valued time series x % Usage: xmax=findpeaks(data,threshold) % Input: % data (data in time x channels/trials form or a single vector) % threshold (if specified returns locations of peaks at which data exc...
5ec1a5ce946561fad4649bdc239c8ca2dbe45989aeccc85514af96e96f6316b8
MATLAB
891
41
function [] = Batch_Alignment() % reference image for allignment ref = 750; % Prompt for manual browse to image folder folder_name = uigetdir(pwd, 'Select Folder containing Prairie Images'); if folder_name == 0 error('no folder selected') end display(folder_name); files = dir([folder_name, '/TS...
8b8065d4f95f37f677bd45be2c70d9e17b9561df2c6d6537994a4d4597652c73
MATLAB
891
37
function data = readNPY(filename) % Function to read NPY files into matlab. % *** Only reads a subset of all possible NPY files, specifically N-D arrays of certain data types. % See https://github.com/kwikteam/npy-matlab/blob/master/npy.ipynb for % more. % [shape, dataType, fortranOrder, littleEndian, totalHeader...
ba29e80b8d05e597e12ec05d0054b6b756df93fc9f90398738b2110d13d97fd8
MATLAB
891
32
function atlases = ea_loadatlas(atlases,resultfig,ht) % Load atlases and do struct2roi conversion when needed if ischar(atlases) % Input is not atlases struct itself if isfile(atlases) % Input is atlas_index.mat file path load(atlases); else % Input is atlas name (suppose in MNI space) load([ea...
faad6649a0824edddccf3a8e3287fb69cee1a54222e4807076b473cee728fd26
MATLAB
891
27
function foldID = makeGroupedFolds(nGroups, K) % makeGroupedFolds Assign groups (not rows) to K cross-validation folds. % % foldID = makeGroupedFolds(nGroups, K) % % Randomly distributes nGroups group labels across K folds as evenly as % possible. In the paired PLS-DA pipeline the groups are SUBJECTS, so both of...
28b4ecbb1f67d9d6bd44d6b18969e0d834b7f7341d556b472e0358ef8378a18b
MATLAB
892
36
%% statejit - jitter states % Jitters states with adjacent states in time order, trial order, or % whatever order they are presented. The jittering is performed using a % Gaussian distribution with a supplied standard deviation (in units of % bins). % % Syntax: [randstates] = statejit(states,std) % % Input: % states...
321facf733c220dbd2979a54f3db5c09247589464394e70985e531e68bd2d06f
MATLAB
892
24
function [adfreq, n, ts, fn, ad] = plx_ad(filename, ch) import CMBHOME.PLX2Mat.* % plx_ad(filename, channel): Read a/d data from a .plx file % % [adfreq, n, ts, fn, ad] = plx_ad(filename, ch) % % INPUT: % filename - if empty string, will use File Open dialog % channel - 0-based channel number % % a/d data...
65eb4ca8a9fa786b096dcf826f306105f138d1b5554a7324257cf66c670a9be3
MATLAB
892
45
function v = cvx_vexity( x ) global cvx___ s = x.size_; if any( s == 0 ), v = cvx_zeros( s ); return end p = cvx___.vexity; b = x.basis_; n = length( p ); nb = size( b, 1 ); if nb < n, p = p( 1 : nb, 1 ); elseif n < nb, p( nb, 1 ) = 0; end if ~any( p ), v = cvx_zeros( x.size_ ); if x.slow_, ...
36b70da4ba8b79d95c76843a0e46014a102596451f2f2d4e2454b186ec1cffc9
MATLAB
893
31
function [ self, cel, args] = infieldness_p(varargin) % Handles infieldness required fields to an input parser if strcmp(class(varargin{1}),'inputParser') p = varargin{1}; varargin = varargin(2:end); else p = inputParser; end p.StructExpand = true; p.KeepUnmatched = true; if isstruct(varargin{1}) if is...
8611e4043f611127788a8335732612a443c2665b4a2c9eda23ad7f762c39c6c6
MATLAB
893
30
function [varargout]=push_relabel_max_flow(A,u,v,varargin) % PUSH_RELABEL_MAX_FLOW Goldberg's push-relabel max flow algorithm % % This function calls Boost's implementation of Goldberg's push relabel % algorithm to compute a maximum flow in a graph. % % See the max_flow function for calling information and return param...
eedd4708c15e80a956485ef3a03112cc08f20ea50fa506d37a060b63f992846a
MATLAB
893
38
function plotBordersCCF(dorsalMaps, randomBorders, lw, color, alpha) % Plots a simplified allenMap with specified randomized borders on top if nargin < 3 lw = 0.1420; end if nargin < 4 color = 0.35*[1,1,1]; end if nargin < 5 alpha = 0.75; end % Figure allenMapSMc(dorsalMaps, [-3.6, 0, -2, 3]) % Creates ...
113a72bc01bc9a3ddae88c249b894d4038660ed69563409ca14b23a3674f35d1
MATLAB
894
34
function [CFCdata,time] = getISPCCFCchannelTime(deltaphase,thetaphase,alphaphase,betaphase,featureLabel) % Get the bands phase switch featureLabel(1) case 0.5 phase1 = deltaphase(featureLabel(3),:,:); case 4 phase1 = thetaphase(featureLabel(3),:,:); case 8 phase1 = alphaphase(feature...
527a8b838b399ed0a57160be8592f96ba1ceb09fbc4684c7f1bce65609d3364c
MATLAB
894
22
tmpvars={'do_crop','do_load','do_loadall','do_motc','do_realign',... 'do_maskreg','do_intc','do_bin','do_binfirst','do_average',... 'do_arfilt','do_ffilt','do_arfilt_apply','do_intc_apply',... 'do_motc_apply','do_motcmask','do_detrend',... 'do_timing','do_sequential','do_seqint...
7913fbc06fb46c477ce547e197d9b28c6d66169c53508cc749c7ebaf1d4e9d02
MATLAB
894
30
function data=createdatamatpb(data,E,Fs,win) % % Helper function to create an event triggered matrix from a single % channel of data. % Usage: data=createdatamatpb(data,E,Fs,win) % Inputs: % data (input time series as a single vector) - required % E (events to use as triggers) - required % Fs (sampling fre...
85090643acead7e5bdd41a3768cd01c8ac724248517b66050a7443f2cedc114a
MATLAB
894
45
% % check dijkstra for only positive values % % write graph xml reader % % add graph struct type... % % ctrl-c mex files % % % % graph constructions % - butterfly graph [A xy labels] = butterfly_graph(levels) % - cycle graph [A xy] = cycle_graph(nodes) % - complete graph [A xy] = complete_graph(nodes) % - hypercub...
f6438d81b44aa3d47cbe6e938a2e26cffc70aa95bc8023ea0f9e5d0ef2d8a36e
MATLAB
894
22
function cvx_optval = det_root2n( X ) %DET_ROOT2N 2nth-root of the determinant of an SPD matrix. % For a square matrix X, DET_ROOT2N(X) returns % POW(DET(X),1/(2*size(X,1)) % if X is symmetric (real) or Hermitian (complex) and positive % semidefinite, and -Inf otherwise. % % This function has b...
25a86df55eaa17f34511380dc7e9562ef5b9ac6fccaf6e5f150c6d4aee986b2e
MATLAB
895
31
function child = children(tree,uid) % XMLTREE/CHILDREN Return children's UIDs of node uid % FORMAT child = children(tree,uid) % % tree - a tree % uid - uid of the element % child - array of the UIDs of children of node uid %__________________________________________________________________________ % % Return UID'...
6a4dbf30da86726886d428b40949dd26941fb7d7bd99f073110f3476b3ed492a
MATLAB
895
28
function z = lambda_max( Y ) % LAMBDA_MAX Maximum eigenvalue of a symmetric matrix. % For square matrix X, LAMBDA_MAX(X) is MAX(EIG(X)) if X is Hermitian % or symmetric and real; and +Inf otherwise. % % An error results if X is not a square matrix. % % Disciplined convex programming information: % ...
8899ff56734d5118af026789f6b500f4e8d85edfd0ba1941ddbd476a8def4955
MATLAB
895
24
function C = CORE_histxt(X,d) %CORE_HISTXT Core computational routine for HISTXT. % C = CORE_HISTXT(X,D), where X is an M x N matrix, returns a D x N % matrix C such that C(i,j) = #[X(:,j)=i]. % % CONDITIONS % ---------- % X must only contain integer values between 1 and D. % X must be of type double...
ec6ead38528e0837daea2a040826f78c2c0969663ff55f35dd636716ec1142d9
MATLAB
895
25
function CBIG_ASDf_gamma2table(gamma_file, output_name) % CBIG_ASDf_gamma2table(gamma_file, output_name) % % This function normalizes estimated gamma to get Pr(Factor|Participant) % (i.e., factor compositions of participants), % and write to a text file specified by output_name. % % Input: % - gamma_file: % ...
5b4e97799ddb37f2895a99c47587e8355c4dc587053a4a271d362b3169217630
MATLAB
896
38
function [thetahat kappa] = circ_vmpar(alpha,w,d) % r = circ_vmpar(alpha, w, d) % Estimate the parameters of a von Mises distribution. % % Input: % alpha sample of angles in radians % [w number of incidences in case of binned angle data] % [d spacing of bin centers for binned data, if supplied % ...
8e8fe5198e5cf6a2e7bf40c49fd911d86653933e0296bfb02c92bd21fbde8a97
MATLAB
896
23
function baselines = processColData(headpath,lowestper) % To process columnar imaging data. 'lowestper' is the lowest percent of % values you want to take the mean of to calculate the baseline intensity % for an ROI across concatenated data. load('cat_MC_Videocdf2.mat'); [rois timepoints] = size(Cin); bgCorr = ...
c8bb7b313f42734bdda29c28dee97877767034e0decde38ec8eb85652c284711
MATLAB
896
41
function CBIG_hypoTest_3t(betas, stats) % CBIG_hypoTest_3t(betas, stats) % Overall % % Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md H = [0 1 0 0 0 0; 0 0 1 0 0 0]; c = [0; 0]; % H*b = c p = linhyptest(betas, stats.covb, c, H, stats.dfe); fprintf('Overall p = %e\n', p)...
6a2a8768c8aa04f666819f74af7994d1497670a383dc8657ac0eeb42f309fe1f
MATLAB
897
37
% Euclidean projection on the nonnegative orthant % Section 8.1.1, Boyd & Vandenberghe "Convex Optimization" % Joelle Skaf - 10/07/05 % % The projection of x0 on the proper cone K = R+^n is given by % minimize || x - x0 ||^2 % s.t. x >= 0 % It is also given by: P_K(x0)_k = max{x0_k,0} % Inpu...
9e66b28dffe47d89703d776093b638294e45caf5ac849badee8c3077be26ed08
MATLAB
897
25
%FindField - Find field in a map, e.g. firing field in a firing map. % % Find field in a map, i.e. the connex area around the peak, where the values % are above a given threshold. % % Note: This function should not be called directly. Use <a href="matlab:help FiringMap">FiringMap</a>, <a href="matlab:help FiringCurve">...
5bf6003ba311dc63843571525c803243f6f266fe3e72ac3bcfa3a0bc432fcb94
MATLAB
898
21
function [surflist, vollist] = cifti_diminfo_dense_get_structures(diminfo) %function [surflist, vollist] = cifti_diminfo_dense_get_structures(diminfo) % Get the names of all the structures used in the dense mapping. % % The diminfo argument should usually be "cifti.diminfo{1}". if ~isstruct(dimi...
511e295778db9430258cad6f39eb81b9ed0608839215dfa432467c5ab7f9fffa
MATLAB
899
25
function [ts] = PL2Ts( filename, channel, unit ) % PL2Ts( filename, channel, unit ): read spike timestamps from a .pl2 file % % ts = PL2Ts( filename, channel, unit ); % ts = PL2Ts( filename, 'SPK01', 1 ); % ts = PL2Ts( filename, 2, 3 ); % % INPUT: % filename - if empty string, will use File Open dialog % c...
3c0312fabf91f6920b1630eec6398cf1ab13849cb252ef45f613b8a09f27b7ae
MATLAB
900
23
function baselines = getconcatbaselines(headpath,lowestper) % To process columnar imaging data. 'lowestper' is the lowest percent of % values you want to take the mean of to calculate the baseline intensity % for an ROI across concatenated data. load('cat_MC_Videocdf2.mat'); [rois timepoints] = size(Cin); bgCor...
3cf358b7770056c4854d1f9f970cdf8f0a9d78a0ea045705515da26378dedd42
MATLAB
900
47
function pval = circ_medtest(alpha,md) % % [pval, z] = circ_medtest(alpha,w) % Tests for significance of the median. % H0: the population has median angle md % HA: the population has not median angle md % % Input: % alpha sample of angles in radians % md median to test for % % Output: % pval p...
a98753658b0d20c457d6f81fb9ebed96fd640f48cc22855d18350e42c9f32312
MATLAB
900
28
% Written by Nanbo Sun and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md addpath(spm_dir) % Read rid.txt file fid=fopen(id_list); rid=textscan(fid,'%s'); fclose(fid); rid=rid{1,1}; % Calculate the GM and ICV of all subjects for i = 1:length(rid) gm_file = [output_dir '/mri...
af92f2e83ed4daabc35f2426962591e7aa71354ad48c185dfc80389fd53ec0d2
MATLAB
900
23
% https://www.xquartz.org/ % https://surfer.nmr.mgh.harvard.edu/fswiki/rel7downloads % https://surfer.nmr.mgh.harvard.edu/fswiki//FS7_mac % [projected, projected_seg] = CBIG_RF_projectfsaverage2Vol_single(lh_input_array, rh_input_array, interpolation, path_to_mapping, path_to_mask) cifti_struct = cifti_read('tra...
20530fb9fd2260993374fb4a7de4edfbcbd29aa632f705b2fef60a04c96dc63f
MATLAB
901
34
function plotModulationMapCCF(dorsalMaps, allROIs, propField, color) % Creates a binned and smooth map of cell count proportions based on the % field propField % Figure allenMapSMc(dorsalMaps, [-3.6, 0, -2, 3]) % Creates figure by itself % Plot params xLimits = [-4 0]; yLimits = [-2.35 3.3]; gridRes = 50; smoothSD = ...
eedeeda22cffe5ad5ce0ee9126daa2c324c4c1ba54e9919aa4e3a0a47c95822d
MATLAB
901
23
% end() - last index to memmapdata array % % Author: Arnaud Delorme, SCCN, INC, UCSD, Nov. 2008 % Copyright (C) 2008 Arnaud Delorme, SCCN, INC, UCSD % % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Founda...
f3b81371a24218f1a8e0c5f910222272c816c49a61f0e6c6d3654c70c754578e
MATLAB
901
46
function [node,elem]=readasc(fname) % % [node,elem]=readasc(fname) % % read FreeSurfer ASC mesh format % % author: Qianqian Fang <fangq at nmr.mgh.harvard.edu> % date: 2009/04/02 % % input: % fname: name of the asc file % % output: % node: node positions of the mesh % elem: element list of the mesh % % ...
3df517500ee481e3345331ba3e30dcf68fc75294841aa2eeab47c17d499a304c
MATLAB
902
31
function [N,C]=check_consistency(data1,data2,sp) % Helper routine to check consistency of data dimensions % Usage: [N,C]=check_consistency(data1,data2,sp) % Inputs: % data1 - first dataset % data2 - second dataset % sp - optional argument to be input as 1 when one of the two data sets is % spikes times stored as a 1d a...
833641a0f08e03e37eb7e8f1975177999a7b3b5fcc9a8f0ebaa67d76861632cb
MATLAB
903
30
function [R, mean_theta, S] = MeanResultant(self, cel) % MRL of head tuning % % Returns length, angle and circular variance pertaining to the mean % resultant of directionality of neuron spiking. % % RETURNS: % R, mean_theta and S. M x N array where N is the number of cells, and % M is the number of epochs % % see equa...
9a145cfde8ec5addb562d9fcf4e739906b31a3df4c708e8642d7bfafdea5e9cc
MATLAB
903
30
function obj = Empty( varargin ) %uiextras.Empty Create an empty space % % obj = uiextras.Empty() creates an empty space that can be used to add % gaps between elements in layouts. % % obj = uiextras.Empty(param,value,...) also sets one or more property % values. % % See the <a href="matlab:doc uiextras.Empt...
ca1d121e7169a24a21476055650c70a63c6d0e873e52921aba67572257620459
MATLAB
903
31
function [] = restorehold(ax, prevhold) %RESTOREHOLD restore hold status. % RESTOREHOLD(ax, prevhold) restores the hold status of axes object with % handle ax, to the state defined by prevhold. To save prevhold for use % with this function, call takehold or ishold. % % usage % RESTOREHOLD(ax, prevhold)...
d4993e81f31835d808b276b4d9c4313cb3d4af7a8f362fda9abe3b20c7f8f1c7
MATLAB
903
32
function root = MergeEpochs(root) % Returns root with epochs that do not overlap. Touching epochs are merged. % % % Assumes that all epochs are on the timescale of root.b_ts (all epochs % have samples within them. any epochs without samples within them are % deleted) % root = CMBHOME.Utils.MergeEpochs(root); if ~strcm...
f82610b796bfa8dee1c3ef8579fa91df3904b522ed6ebdbdf0b59ff406c62ec7
MATLAB
903
40
function outface=outersurf(node,face) % % outface=outersurf(node,face) % % extract the out-most shell of a complex surface mesh % % author: Qianqian Fang, <q.fang at neu.edu> % % input: % node: node coordinates % face: surface triangle list % % output: % outface: the out-most shell of the surface mesh % % --...
01bbb3c9eb382d82c36ad489f9f758211f98fe0b56ba4ce12e35cf15cc77ac54
MATLAB
904
31
function tree = delete(tree,uid) % XMLTREE/DELETE Delete (delete a subtree given its UID) % % tree - XMLTree object % uid - array of UID's of subtrees to be deleted % % Delete a subtree given its UID % The tree parameter must be in input AND in output % % See also XMLTREE uid = uid(:); for i=1:length(uid...
be23798d0ff03aecfc5dc8da16fa761cf00daf945ed180422fabd8c61d2f8d23
MATLAB
904
39
function y = avg_abs_dev_med( x, dim ) %AVG_ABS_DEV_MED Internal cvx version. if ~cvx_isaffine( x ), error( 'Disciplined convex programming error:\n ABS_AVG_DEV_MED is convex and nonmonotonic in X, so X must be affine.', 1 ); %#ok end try if nargin < 2, dim = []; end [ x, sx, sy, zx, zy, nx, nv, perm ] =...
bf11031618c7bfafd81761a4b7361a91e9b4bc3b160901da32bfe45a90cfc4bf
MATLAB
904
41
function [r mu] = circ_axialmean(alphas, m, dim) % % mu = circ_axialmean(alpha, w) % Computes the mean direction for circular data with axial % correction. % % Input: % alpha sample of angles in radians % [m axial correction (2,3,4,...)] % [dim statistic computed along this dimension, 1] % % ...
f175b2bbaeda5d13154be407ffd3b0e6d05373c3e2a3829019032d574297c38e
MATLAB
904
27
% Example of why B_other in eqcont segregation is not the same in across % system types when there are only two system types % create random 6x6 matrix B = toeplitz(randi([0 9],6,1)); % assumeing 3 systems, 1:2, 3, 4:6 % assuming 2 systype, 1:3, 4:6 % between system wither others for system type 1 sys_type1_b_othe...