sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
ae62f11547aee81079af8f8777a1d25663ce60558e66286a95a9f9f9dcf92036
MATLAB
1,502
63
clc clear all close all set(0,'defaultfigurecolor',[1 1 1]);% set figure background color if ~contains(path, '/Users/guofanhua/Desktop/gfh/tools/MatlabTools/BrainSpace-latest/matlab') addpath(genpath('/Users/guofanhua/Desktop/gfh/tools/MatlabTools/BrainSpace-latest/matlab')); end %% ======================= step 1 ...
dff4d7181812e16f23ee3ddbd9a09282c5aa6ffd6d2d2706d0bcd8ba1bd76b5d
MATLAB
1,503
59
function savestl(node,elem,fname,solidname) % % savestl(node,elem,fname,solidname) % % save a tetrahedral mesh to an STL (Standard Tessellation Language) file % % author: Qianqian Fang, <q.fang at neu.edu> % date: 2012/02/14 % % input: % node: input, surface node list, dimension Nx3 % elem: input, tetrahedral...
042b79fe4cc329068dee24fb308470ad14309bbb5a962d7545e163af55e46847
MATLAB
1,504
59
function [ datamean,datastd ] = BoxAndScatterPlot( data,varargin ) %BoxAndScatterPlot(data) makes a box plot with data points. % %INPUTS % data {ngroups} cell array - each cell has a set of data points % (options) % 'colors' [ngroupx x 3] matrix of colors for each groups % 'labels' {ngroups} ce...
409b3e6ee696f345f372ba6963073081bf8f592be7d9df8dc8d4a12e9337cab2
MATLAB
1,505
26
function SANDIinput = TrainMachineLearningModel(SANDIinput) %%%%%%%%%%%%%%%%%%%%%%%%%%% USER DEFINED INFO %%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Define the parameters to build the training set. This can (and should) change according to the acquisition! % UB stands for upper bound. Model parameters values will be chosen ran...
63d58e03711bc81f8ba53f589769e98b8a4ef71c72889c1dfc0f731b9eef0314
MATLAB
1,505
47
function [outR, outID] = makeBayesWeightedCorrBatch1(Pr, bID, varargin) %function [outR, outID] = makeBayesWeightedCorrBatch1(Pr, bID, preComputedQ (optional)) % inputs % Pr: [nTimeBin X nSpatialBin] matrix of posterior probabilities % (each row should sum to 1) % bID = 'bin Id's', [nTimeBin X 1] vector % ...
b1176cd83c737ad46f66e34ce1fc92007400750dde87cb093fe7bddcd5cf22e0
MATLAB
1,506
39
function [otuMap1,otuMap2,otu_names_merged] = generateMergedOTUMap(otu_names1,otu_names2) % 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...
2fae1adddbcde093d2d42e4ab8323ace013c403cd4df9004e1474c07e44ed8b7
MATLAB
1,507
41
%% Axes inside layouts % This example demonstrates how axes are affected by being placed into % layouts. The layouts take into account the "ActivePositionProperty" in % order to determine whether to set the "Position" or "OuterPosition" % (default) property of the axes. % % Copyright 2009-2013 The MathWorks, Inc. %% O...
7279d4a8b385c3a66997737a8498228a97d4be80fcbd42e00bd7a251663e34ef
MATLAB
1,507
53
function [C] = corr_col(A, B, dim) %CORR_COL quickly compute the column by column correlation between two large matrices % % C=CORR_COL(A, B) computes the correlation for each column in A of the % congruent column in matrix B. A and B must be identical in size % % C=CORR_COL(A, B, dim) computes the correaltions for th...
686f579e2c2851279d84e6ffa242ef6fcf7ce1737b56b821b354ca5756d50b45
MATLAB
1,508
49
%%*********************************************************** %% lmiexamp3: generate SDP data for the following LMI problem %% %% max eta %% s.t. [A*P+P*A' P*B'] + eta*[0 0] <= [-G 0] %% [B*P 0 ] [0 I] [ 0 0] %% P >= 0 %% P and eta are variables, P symmetric. %% %% Ref: ...
1bae13bbbc2f157ea444d3098d3d90ee88e938ff5b247d2f6b3063a0d1437c89
MATLAB
1,509
40
function C = conv2fft(varargin) % C = conv2fft(A, B) % C = conv2fft(H1, H2, A) % % C = CONV2FFT(A, B) performs the 2-D convolution of matrices A and B. % If [ma,na] = size(A), [mb,nb] = size(B), and [mc,nc] = size(C), then % mc = max([ma+mb-1,ma,mb]) and nc = max([na+nb-1,na,nb]). % % C = CONV2FFT(H1, H2, A) fi...
7f94063920543efe40a029d50ea66780e840cc98fd033f03c1606c0cf65b83b0
MATLAB
1,509
45
types = [13 14]; A = allflies([allflies.trtype]==types(1)); B = allflies([allflies.trtype]==types(2)); % A = thing([thing.trtype]==types(1)); % B = thing([thing.trtype]==types(2)); for i = 1:length(A) figure; set(gcf,'Position',[405 235.5 368 475.5]) subplot(1,5,[1 2]); imagesc(A(i).gaussianfluor);...
fb3658430cb4ee4c3dc6cdb47baab80671f22a4072930982aa07cedacb218290
MATLAB
1,509
62
function D = dijkstra_all_sp(G,optionsu) % DIJKSTRA_ALL_SP Compute all pairs shortest path using repeated Dijkstras % % This algorithm runs a series of Dijkstra's shortest path problems to % compute the all pairs shortest path matrix. % % Using one of the other algorithms is preferable, however, this algorithm % is us...
ae04bc5dec0722faee67a394fb7eb95e821bbbd6a35f211b3aeb3439b86f7fd9
MATLAB
1,510
53
function outpoints = tal2icbm_other(inpoints) % % This function converts coordinates from Talairach space to MNI % space (normalized using templates other than those contained % in SPM and FSL) using the tal2icbm transform developed and % validated by Jack Lancaster at the Research Imaging Center in % San Antonio, T...
22ac4ad31aa7ba52453280fc2541a36bafc23e17d783a5617154c5e9fde121c6
MATLAB
1,513
36
function y = bwblkslv(L,b) %#ok % BWBLKSLV Solves block sparse upper-triangular system. % y = bwblkslv(L,b) yields the same result as % y(L.perm,:) = L.L'\b % However, BWBLKSLV is faster than the built-in operator "\", % because it uses dense linear algebra and loop-unrolling on % supernodes. %...
a78e61e7fcc77894b05996aaf06fd163c61819c404bcdfa3999aefef9ee43390
MATLAB
1,513
45
function rgbdata = cmplx2rgb(cmplxdata, logmag) %CMPLX2RGB Convert complex matrix to an imageable RGB form. % RGBDATA = CMPLX2RGB(CMPLXDATA) converts the [M x N] CMPLXDATA to an % [M x N x 3] truecolor matrix in RGB color coordinates. The mapping % goes through HSB space, where the hue is determined by t...
c58a73ef8486cbb5775c31ca5c2baa4b81e96f0c9f904bb2251f7525addeaa4c
MATLAB
1,515
45
function M = Array2Matrix(A) %Array2Matrix - Transform an N-dimensional array into a matrix. % % Each line in the output matrix lists the subscripts for all dimensions % (one per column) and the corresponding value in the array. % % Copyright (C) 2009-2011 by Michaël Zugaro % % This program is free software; you ca...
fe897731b71b2e9bc5c76a127352750ab616b04fd7182db84275db6b302f8d6d
MATLAB
1,516
60
function [ind,tf] = OverThresholdDetect(A, thresh, min_sep, min_length) % Searches for continuous epochs for which A is at least thresh, merges those % separated by less than min_sep indices, and returns ind, an Nx2 array of % indices for continuous epochs over thresh % ind = ThresholdDetect(A, thresh, min_sep, min_len...
a94b18d32089329f88a75f0bafe320a62ad76170be02659865167cf398ac89d7
MATLAB
1,517
45
function ea_checkprefs % Check prefs files and adapt for new prefs folder prefsDir = ea_prefsdir; prefs = ea_regexpdir(ea_gethome, '^\.ea_prefs.*', 0, 'f', 1); if ~isempty(prefs) newprefs = replace(prefs, [ea_gethome, '.'], [prefsDir, filesep]); cellfun(@(x,y) movefile(x,y,'f'), prefs, newprefs); end prefs ...
1a0d21d85071a9cf1fa8aa84942920562fe008c861bd74058c38fc3c896c4d12
MATLAB
1,518
25
function [OpenedFileName, Version, Freq, Comment, Trodalness, NPW, PreTresh, SpikePeakV, SpikeADResBits, SlowPeakV, SlowADResBits, Duration, DateTime] = plx_information(filename) import CMBHOME.PLX2Mat.* % plx_information(filename) -- read extended header infromation from a .plx file % % [OpenedFileName, Version, Freq...
2d32b264da8461056ef4e05b6f9fa3ce9269316cffec225b08e35d0cb8e278ca
MATLAB
1,520
52
function nirs = buildNirsMesh(baseMeshPath, srcCoord, detCoord, link, outPath, opts) %BUILDNIRSMESH Load a NIRFASTer mesh, place optodes, and save. % baseMeshPath : path to a NIRFASTer .mat mesh (for load_mesh) % srcCoord : Sx3 double, source coordinates already projected to scalp % detCoord : Dx3 double, detector ...
4b6c69b19d0c3ddcdcf96221d8733be5eedf913ea27855094235ae49fc4143fe
MATLAB
1,521
35
function [T,Tout]=RemoveInvalidTetrahedrons(T,V,F) NZ=zeros([size(V,1) size(V,1)],'int8'); Fdel=true([size(T,1) 1]); for i=1:size(T,1) Edge=[T(i,1) T(i,2)]; if(NZ(Edge(1),Edge(2))==0), if(CheckVisiblePoint3D(V,F,Edge(1),Edge(2))), NZ(Edge(1),Edge(2))=1; else NZ(Edge(1),Edge(2))=-1; end; end if(NZ(...
986aa2dd6dc991c56fcb7b003666513167a65ae20dbb8086d6e16b39ab97b1fd
MATLAB
1,521
57
% Section 8.2.2: Separating polyhedra in 2D % Boyd & Vandenberghe "Convex Optimization" % Joelle Skaf - 10/09/05 % (a figure is generated) % % If the two polyhedra C = {x | A1*x <= b1} and D = {y | A2*y <= b2} can be % separated by a hyperplane, it will be of the form % z'*x - z'*y >= -lambda'*b1 - mu'*b2 > ...
ba3e64f5143a3755a05166c281dfdea40f6efa396bf4e7b718893152cc4e641d
MATLAB
1,521
65
function y=estLaserPower(lambda,pockel) % Usage ... y=estLaserPower(lambda,pockel) % wavelength pockel= 50 100 150 200 250 300 350, power is before obj % assume pockel 0 is 0mW data=[ 700 55 180 305 392 370 205 40 740 70 280 565 720 710 510 245 780 90 360 730 950 1000 780 450 820 80 320 710 920 1060 950 600 ...
f4acff63e6334bdad192864161156fd7b65e93eb83983414d986493f96b413ea
MATLAB
1,523
52
% fastregress - perform fast regression and return p-value % % Usage: % [ypred, alpha, rsq, B] = myregress(x, y, plotflag); % % Inputs % y - y values % x - x values % plotflag - [0|1] plot regression % % Outputs % ypred - y prediction % alpha - significance level % R^2 - r square % slope - slope of the fit % %...
f67cea2ce154acb67707aac246ddfe8065a4b5e187ece139f39aeb9584cfb971
MATLAB
1,523
44
function [k,d] = CORE_mindist(x,y) %CORE_MINDIST Core computational routine for MINDIST. % [K,D] = CORE_MINDIST(X,Y), given an M x P matrix X and an % N x P matrix Y, returns the M x 1 vectors K and D such that % K(i) = argmin_j ||X(i,:) - Y(j,:)||^2 and % D(i) = min_j ||X(i,:) - Y(j,:)||. % (||.|| m...
1c5add4f93e4528f40b4d4b5d989190f98d242241860f5b241376e9e029916bc
MATLAB
1,524
51
%PDF2EPS Convert a pdf file to eps format using pdftops % % Examples: % pdf2eps source dest % % This function converts a pdf file to eps format. % % This function requires that you have pdftops, from the Xpdf suite of % functions, installed on your system. This can be downloaded from: % http://www.foolabs.c...
64ea1ce7e6cc0c64a512950ba636a769c1747b1fe07a4233356946063c5f8cd4
MATLAB
1,524
72
%% [sampling_num,cell_num]=size(x0); view_point=8; %³õʼ»¯½á¹¹ÌåÊý×é clear peak_test; peak_test.peak_imfo=[]; peak_test.mean=0; peak_test.stu=0; peak_test.old_sequence=[]; peak_test.new_sequence=[]; peak_test=repmat(peak_test,[cell_num view_point]); %·åֵɸѡ£¬²ÎÊýÉèÖ㺠params.upper=3; %×î¸ßµã´óÓÚparams.upper±...
79766e06b6d7c5016005fdfb9e2df3b70d2bd325b6deecbfde513593d264a20a
MATLAB
1,524
38
function [azi,ele]=hor2sph(lat,pol) %HOR2SPH transform horizontal-polar to spherical coordinates. % [azi,ele]=hor2sph(lat,pol) % % Input: % lat ... lateral angle (-90 <= lat <= 90) % pol ... polar angle (-90 <= pol < 270) % % Output: % azi ... azimuth (0 <= azi < 360) % ele .....
1441e10d89893099be70ecb588c19dceaf86b784a22d7c7afa7f92369baefc83
MATLAB
1,525
48
function h = DendriticSpine_hist(handles, ax1, ax2, targetID, ... binvalue, spine_evolve, Dendrite_CrossSess) DendLoc = table2array(Dendrite_CrossSess); DendLoc_plot = DendLoc(DendLoc(:,1)==targetID,:); SpineLoc = table2array(spine_evolve); NumSess = length(handles.datafilename); im = handles.im_norm_mask; ...
39febf6e42eaa3fbd2a437131e0f2c745fe3b967b8b9b7a11542994d47c9d9f1
MATLAB
1,525
43
function computeSaliencyMaps(params, split) % computeSaliencyMaps(params) % % ---------------------------------------------------------------------- % Matlab tools for "Predicting human gaze beyond pixels," Journal of Vision, 2014 % Juan Xu, Ming Jiang, Shuo Wang, Mohan Kankanhalli, Qi Zhao % % Copyright (c) 201...
d9837b5feee5281bbcb74a92ff97006723fe0dab43a7cb1377fe878acf5b95d5
MATLAB
1,526
47
function orientation = FlyOrient(subset_frame, threshold) %FLYORIENT % Usage: % orientation = FlyOrient(subset_frame, threshold) % % This function takes in a subset frame around the fly (calculated by % FindFly) and discards the 3D data by placing points where the pixel intensity % is larger than the user cho...
444d87776355b92a4aec74b03977a6da8bf5f9ff6d93c86d6c569939c3fb0baa
MATLAB
1,527
21
% CVX example library % % antenna_array_design/ - Antenna array design % circuit_design/ - Circuit design % cvxbook/ - Figures, examples, and exercises from the book <a href="http://stanford.edu/~boyd/cvxbook">Convex Optimization</a> % filter_design/ - Filter design...
6e9da2a72c24f155e9768a4a0ffd62cdd9ae3e7d620c5075ed8e30d8432b235e
MATLAB
1,528
51
function varargout=s2v(node,face,div,varargin) % % [img,v2smap]=s2v(node,face,div) % % shortcut for surf2vol, coverting a surface to a volumetric image % % author: Qianqian Fang (fangq <at> nmr.mgh.harvard.edu) % % input: % node: node list of the triangular surface, 3 columns for x/y/z % face: triangle node indices, ...
5f520cf73240f672bf803756b67c76be09a648fe31afecdbb6373ce0dd4c06e3
MATLAB
1,530
54
function [f,header]=readPrairie(fname,imno,header) % Usage ... [f]=readPrairie(fname,imno,header) do_files=0; if strcmp(fname(end-3:end),'.tif')|strcmp(fname(end-3:end),'.TIF'), do_files=1; end; if do_files, if length(imno)==2, imno=[imno(1):imno(2)]; end; for mm=1:length(imno), tmpname=sprintf('%s_%06d.ti...
902a8358f643360fd5e5880c1d3424cada182ba9da280ed810e94d39fe1c0404
MATLAB
1,530
68
function DBRemoveFigures(query) %DBRemoveFigures - Remove all figures that match given criteria. % % Actual removal will require confirmation from the user. % % USAGE % % DBRemoveFigures(query) % % query optional figure list query (WHERE clause; see Example) % % SEE % % See also DBAddFigure, DBGet...
aae5f470fe5e59f45e87dc5b8413e9d0fd89aaf2dddecfc8281c4c19081ab227
MATLAB
1,530
39
%% Create model outputs % First you must load the stims file as `stims` % Then, navigate to the model_code folder for i = 1:length(stims) gustres.heading = stims(i).heading; gustres.Atheta = stims(i).gamma; %Atheta; gamma gustres.Amag = stims(i).airspeed; %Amag; airspeed gustres.Otheta = stims(...
79b5652fc58ad76319c0ce1581b2a813e99f54d6657e9e5d93a1fa3f04a19337
MATLAB
1,531
43
function [neighbors, distances] = knn(data, k) %KNN Finds the K nearest neighbors in a reference matrix. % NEIGHBORS = KNN(DATA, K) takes the N x D matrix DATA, where each row % is treated as a D-dimensional point, and finds the K nearest neighbors % of each point (using a Euclidean distance metric)...
3adc249793c61257285097411ea756bcc487a12261eb8cf3575c72641ef9f647
MATLAB
1,533
41
function [n, evchans] = plx_event_chanmap(filename) % plx_event_chanmap(filename): return map of raw event numbers for each channel % % [n, evchans] = plx_event_chanmap(filename) % % INPUT: % filename - if empty string, will use File Open dialog % % OUTPUT: % n - number of event channels % evchans - 1 ...
5520a466d8355f9a44803e93d2ce94d4717bf92e91a2813ec325cd3ed6380bba
MATLAB
1,533
45
% This code Create an R2 prime map (used for X-separation) (see README.md for more details). % %%%%%%%%%%%%%%%%%%%%% VARIABLES %%%%%%%%%%%%%%%%%%%%%%%% %%% Inputs: %%% % T2star_img- 3D T2* map % T2_img- 3D T2 map (created using the CreateT2map.m script) %%% Output: %%% % % R2prime_img- 3D R2' map %%%%%%%%%%...
c80e058c1dd0ad79c30f8f8282aef81d322db71cf0176dc0b177cb0a9a78ba08
MATLAB
1,534
54
function [] = plx_spike_info(filename) % plx_spike_info(filename): prints .plx file spike channel info % % plx_spike_info(filename) % % INPUT: % filename - .plx file name. Will use file open dialog if filename is empty string % % OUTPUT: % (none) if nargin ~= 1 error 'expected 1 input argument'; e...
7557bf08383f7f5fc07bb66b3f195190a10d30442308737221e025a7a226383b
MATLAB
1,535
63
function [PvalpermV0001C,PvalpermV0005C,PvalpermV001C,PvalpermV005C] = getclusterinfo(PvalpermV005,PvalpermV001,PvalpermV0005,PvalpermV0001,iperm); Coninf = bwconncomp(PvalpermV005); nums = Coninf.NumObjects; if nums>0 for i = 1:nums PvalpermV005C(i,1) = length(Coninf.PixelIdxList{i}); end else Pv...
c1798a251cec0a29e9e0b6da56ac50db4555707be98bda27c76a0958884a9907
MATLAB
1,535
32
% 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...
ce9394fe26347b857cb73281a7f726c6f5790e31802ec496155f0356328a57e2
MATLAB
1,535
41
function pred=lengauer_tarjan_dominator_tree(A,u,varargin) % LENGAUER_TARJAN_DOMINATOR_TREE Compute a dominator tree for a graph. % % A dominator tree encodes dominates relations. A vertex u dominates a % vertex v if all paths to v must go through u. In an undirected graph, % this means that if u dominates v, then v ...
f4d15d8c4624e55ee1e9ce4c451a7f94ed51d7a8ee8fbcf959b98288e9b8e125
MATLAB
1,535
46
function ea_ftr2nii(ftrFile, reference, outputName) if ~exist('reference','var') || isempty(reference) reference = [ea_space,'t1.nii']; end refnii = ea_load_nii(reference); if ~exist('outputName','var') outputName = regexprep(ftrFile, '\.mat$', '.nii'); end [fibers,idx,voxmm,mat,vals] = ea_loadfibertracts(ft...
0333ba3b7e2560c9c2c6be1912262b986f87d6e70c7bbf28741a69410246121b
MATLAB
1,536
57
function [R2,R2adj]=ea_R2map_weighted(varargin) % creates a correlation nifti file given a set of images and a % regressor ("R map" in Horn 2017 AoN) % ea_R2map_weighted(fis,regressor,outputname,mask,sk,weights) % sk can be 'k','s','sk' % for smoothing and normalization options. Mask only necessary if % choosing 'k' o...
66d47eb5f74787fdbdb09dfac185a5f23cb97ddf7ccac46911197a7895d2b834
MATLAB
1,536
39
files = dir('2308*.mat'); for f = 1:length(files) load(files(f).name) files(f).name for u = 1:length(flydata) disp(u) starts = find(diff(flydata(u).flightstate)>0)+1; ends = find(diff(flydata(u).flightstate)<0); if flydata(u).flightstate(1)>0 starts = [1,...
5b60fd00e037bf920a1770cc21d8af57439b1f61568cbe907e3249e218dc998b
MATLAB
1,537
63
function [yy,act_ftm_filter]=myfilter1(x,ftm_filter,ts) % Usage ... [y,filt]=myfilter(x,ftmag_filter,ts) % % Filters the magnitude of the FT of x using the magnitude filter % in Fourier domain [0,2*pi] as provided by ftmag_filter if (size(x,1)==1), x=x.'; end; if exist('ts'), df=(1/length(x))*(1/ts); ft...
62c3f70f59187e38c826076ebc156ff90e76d10997ab4f346b888cc59b4e4b64
MATLAB
1,537
42
function k = xml_findstr(s,p,i,n) %XML_FINDSTR Find one string within another % K = XML_FINDSTR(TEXT,PATTERN) returns the starting indices of any % occurrences of the string PATTERN in the string TEXT. % % K = XML_FINDSTR(TEXT,PATTERN,INDICE) returns the starting indices % equal or greater than INDICE of occu...
dba4e1a760fe2603704b225c78910abc118f7249c196f8b06454a7ccb73a414a
MATLAB
1,538
48
function [p ei ej]=planar_canonical_ordering(A,varargin) % PLANAR_CANONICAL_ORDERING Compute a planar canonical ordering % % See % http://www.boost.org/doc/libs/1_36_0/libs/graph/doc/planar_canonical_ordering.html % for a description of a planar canonical ordering % % p = planar_canonical_ordering(A) returns the vertex...
7a42c516994cfec27995c50db258c68fb08569edb233b61bf596f59f71046f7b
MATLAB
1,540
59
function [curv, fnum] = read_curv(fname) % % [curv, fnum] = read_curv(fname) % reads a binary curvature file into a vector % % % read_curv.m % % Original Author: Bruce Fischl % CVS Revision Info: % $Author: nicks $ % $Date: 2007/01/10 22:55:09 $ % $Revision: 1.2 $ % % Copyright (C) 2002-2007, % The General H...
b9a49110168ec0c4e50bd271cbe53343eb6823f976d9419243ccd501d6b06050
MATLAB
1,540
43
function [dregmode, Nbatch, savegrad] = reg_dregmode(handles, RegPara, figuretitlename, w, Nbatch) savename = RegPara.savenamebase; if handles.savetoTif == 0 && handles.savetoBin == 0 && handles.savesubsampletif == 0 handles.savetoBin = 1; set(handles.savetoBin_check, 'Value', handles.savetoBin) drawnow en...
1b3c06786528a126692315ba496d1e5ae0409f4245dae5b162fcaaaf31b179e2
MATLAB
1,541
51
function [q] = meshgrid2vec(xgv, ygv, zgv) %MESHGRID2VEC meshgrid matrices to matrix of column vectors % % [q] = MESHGRIDVEC(xgv, ygv) takes the matrix of abscissas XGV and % ordinates YGV of meshgrid points as returned by MESHGRID and arranges % them as vectors comprising the columns of matrix Q. % % ...
25c965c1a9bb8a1df13ce030807878de5317cd8fdc1afed9bb9c0fc78a6d8234
MATLAB
1,541
68
% FDR correction for all p values in our paper. % % Written by Nanbo Sun and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md clear('all'); p_10foldCV = [2.07070741778782e-05 ... 0.0369183037868885 ... 0.00447403666057892 ... 0.0440814279686049 ... 0.000190379245466227 ... 0.4848491...
a80804b280086e85027a6b2109da113f3ce67d2ad4fcb921a0816ec2ad9b3be5
MATLAB
1,541
57
function [pnt, tri] = read_off(fn); % READ_OFF reads vertices and triangles from a OFF format triangulation file % % [pnt, tri] = read_off(filename) % % See also READ_TRI, READ_BND % Copyright (C) 1998, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation a...
f19f0c241f7919fc909fe25de910c4e707739910b73d9a39ca7dc2bff0bd6ce8
MATLAB
1,541
48
%% Figure 9 supp 3 % RUN fig9_analysis, then return here fig9_analysis % Load map load('allenDorsalMap.mat'); % Params cmap = 'L20'; smoothSD = 0.15; colors = cmapAreas(); % Contour params contConfig.thresholds = [98 95 90]; contConfig.alpha = 0.5; contConfig.lw = 0.9869; contConfig.ls = {'-', '--', ':'}; %% Panel ...
7ebc362756be52d11947835dc28d56c4609b047d7eba17fd0794820bd74e8fc0
MATLAB
1,543
32
function varargout=ea_coregpostopct_fsl_multiple(options) % Wrapper function for FSL FLIRT (multiple-run) registration of post-op CT % __________________________________________________________________________________ % Copyright (C) 2019 Charite University Medicine Berlin, Movement Disorders Unit % Andreas Horn if is...
e67a9de5ed8fe588c31af380bffc66177dddad47402d263a332ba0b830a4787a
MATLAB
1,543
47
function amplitudes = LoadSpikeAmplitudes(filename,nChannels,nSamples,peak,rate) %LoadSpikeAmplitudes - Read spike times, cluster IDs and amplitudes from disk. % % USAGE % % amplitudes = LoadSpikeAmplitudes(filename,nChannels,nSamples) % % filename spike waveform file name % nChannels nu...
2b48fe956ba6d716ad74aa356b11d91456d9fe115361f0411907eecb967d50a6
MATLAB
1,545
38
% Script to generate stim.volumes for StimSets or an arbitrary stim_vector % By Butenko, konstantinmgtu@gmail.com e_field_file = '/home/forel/Documents/data/CologneStimFit/derivatives/leaddbs/sub-CIR02/stimulations/MNI152NLin2009bAsym/stimsetstest/sub-CIR02_sim-4D_efield_model-ossdbs_hemi-R.nii'; stim_vector = []; %...
e54736eb50e8ba0a0c8eb53a42bc64c4f9cc8dab2902f184bdd950b4104b343b
MATLAB
1,545
57
function [S s] = circ_var(alpha, w, d, dim) % s = circ_var(alpha, w, d, dim) % Computes circular variance for circular data % (equ. 26.17/18, Zar). % % 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...
b3d432238c30167e779aefb9c1b81233a1cf51092f7073b2372d708bd8b46ed0
MATLAB
1,546
53
function funcsel = prepCrossSessReg(handles) funcsel = []; pos = get(handles.mainfigure, 'Position'); scrsz = handles.scrsz; pos(1) = pos(1)+100; pos(3) = 300; pos(4) = 300; hplot = figure(25); clf('reset') set(hplot, 'NumberTitle', 'off', ... 'MenuBar', 'none', ... 'Too...
854420fe215e2b4b6ad03854481a4cc76cc06425990b99522e5fa71be6fc910e
MATLAB
1,547
40
function sparsity=spars(x) % sparsity = sparse(x) % % Returns the sparsity of the matrix/vector x. It works for sparse and dense % storage, too. % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko % Copyright (C) 2005 McMaster University, Hamilton, CANADA (since 1.1) % % Copyright (C) 2001 Jos F. St...
b31373afbbce7190f22752b857ba10f791c191fca350dded701ba7be1805cf1e
MATLAB
1,547
80
function [fnameArray] = path2array(fname,refString) % Splits a path in to cell aray, breaking upon filesep % % takes in a string representing the path to a file or folder and breaks it % into a cell array in which each cell holds the portions of the filename % that were between file seperator symbols ('/' or '\'). % ...
1333b6cd3df646e8939422a29bbf552e34a74492d0e2c438407a50efd27ea08e
MATLAB
1,548
52
function y=stkFilt(x,type,parms) % Usage ... y=stkFilt(x,type,parms) % % Filter the stack using type and paramaters parms % % Example for median and smoothing filter of all images % y=stkFilt(stk,'image',[3 0.6]); % Example of time filtering % y=stkFilt(stk,'fermi',{[0.02 0.2],[0.005 0.04],[-1 1],0.1}); xdim=size...
ba1b3d1346abe293acd5c21af71be1141c53f357f5c0b27e73760fe8e5e68225
MATLAB
1,548
41
function sleepstagesOUT = luna2danalyzer(sleepstagesIN) % Convert a Luna score file to a danalyzer score file. %% % Authors: Dan Denis % Date: 2021-07-14 %% sleepstagesOUT.stages = zeros(height(sleepstagesIN), 1); for i = 1:height(sleepstagesIN) if strcmpi(sleepstagesIN.Var1(i), 'wake') sleepstag...
0d22e432d45a3c3641c7cb17908bf0256ea8ba3353a20b0954902ab79ad1019d
MATLAB
1,549
56
row_mean = mean(fiber(:, 800:1600), 2); [~, sort_idx] = sort(row_mean, 'descend'); fiber_sorted = fiber(sort_idx, :); fiber=fiber_sorted fiber=fiber(:,1:2400) subplot(2,2,1) hold on clim = [-5 5]; imagesc(fiber,clim); colormap("parula") ylabel('# of Trial') ylim([1 size(fiber,1)]) set(gca,'ytick',1:s...
95e822621fc5371885d018fc562c357f3dd16135b4c08fc90d4db0b22686c137
MATLAB
1,550
34
function ssg_databrowse2d(spikes, assigns, show) % SSG_DATABROWSE2D Feature projection GUI in 2D (work in progress). % SSG_DATABROWSE(SPIKES) creates a 2-D databrowse figure. Call with a % spike sorting object SPIKES and an optional assignments vector whose length % corresponds to the number of waveforms ...
bf351cc0b72b283b62e62b40303caf48345112e7897789f1d78518d0fc5a6190
MATLAB
1,550
53
function [mean_firingRate, fanoFactor, max_firingRate, min_firingRate] = computeSpikeProp(theseSpikes) % Handle empty or insufficient spike times if isempty(theseSpikes) || numel(theseSpikes) < 2 mean_firingRate = NaN; fanoFactor = NaN; max_firingRate = NaN; min_firingRate = NaN;...
08cf85a78035a8d18b4089dac36717c2e89d367fda4293dcdf7c795eef4696c8
MATLAB
1,551
46
%%******************************************************************* %% HSDHKMdirfun: compute (dX,dZ), given dy, for the HKM direction. %% %% SDPT3: version 3.1 %% Copyright (c) 1997 by %% K.C. Toh, M.J. Todd, R.H. Tutuncu %% Last Modified: 16 Sep 2004 %%****************************************************************...
2a53d93191da1502be965e2fa2f6b58fcc08f26db0be1512c2cb7d1ce186841a
MATLAB
1,551
40
function cvx_optval = prod_inv( x, dim, p ) %PROD_INV inverse of the product of a positive vector. % For a real vector, matrix, or X, PROD_INV(X) returns 1.0 ./ PROD(X) if % the elements of X are all positive, and +Inf otherwise. % % For matrices, PROD_INV(X) is a row vector containing the inverse % product of...
4c410166575c212ad3f7b74eae6f3f805a13448c7cf731f4ced9d24da20207bc
MATLAB
1,551
33
% CVX: Built-in operators and functions supported in CVX models. % % The following operators and functions are included with MATLAB but % have either been verified to work properly within CVX models or have % been extended with additional code to do so. In many cases, typing % help cvx/<func> % whe...
ef9e0b2b13b1424db1f8383bfc25088b3a34e7ad556acd842b484e71a9ead1cf
MATLAB
1,551
49
% eeg_getversion() - obtain EEGLAB version number % % Usage: % >> vers = eeg_getversion; % >> [vers vnum] = eeg_getversion; % % Outputs: % vers = [string] EEGLAB version number % vnum = [float] numerical value for the version. For example 11.3.2.4b % is converted to 11.324 % % Authors: Arnaud De...
c8d37f9ff7f78afacec8c1d9684c10ce8085da2096f131fff05a997a9c724cfe
MATLAB
1,552
39
function x = frameit(lab,frmq,frms,K) % x = frameit(lab,frmq,frms,K) % % FRAMEIT % % ********** INTERNAL FUNCTION OF SEDUMI ********** % % See also sedumi % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko % Copyright (C) 2005 McMaster University, Hamilton, CANADA (since 1.1) % % Copyright (C) 200...
2aa0af5e8615542d78dc103db24bf0347a13cd8d493d09a335596c0ce05f6e66
MATLAB
1,553
49
function ea_tonemapct(options, nativenorm) if ~exist('nativenorm', 'var') || isempty(nativenorm) nativenorm = 'native'; end switch nativenorm case 'native' if isfile(options.subj.postopAnat.CT.coreg) ea_dispt('Tonemapping coregistered CT...'); ct = ea_load_nii(options.subj.posto...
0e7a7abfd31db2082cdaf79b38cf35142405f3c1a98ba06d44747bbdc8c096cc
MATLAB
1,554
45
function data=extractdatapt(data,t,offset) % Extract segements of spike times between t(1) and t(2) % Usage: data=extractdatapt(data,t,offset) % % Input: % data: structural array of spike times for each channel/trial or a single % array of spike times % t : time as a 2d vector [t(1) t(2)] % offset: 0/1 - if 1, ...
7ada7b4007088a955449c67eafe1fb6a3983284869583580af71331239ea69e3
MATLAB
1,555
28
function [rawWaveformsFull, rawWaveformsPeakChan, baselineNoiseAmplitude, baselineNoiseAmplitudeIndex, emptyWaveforms] = ... loadRawWaveforms(savePath, spikeClusters, spikeWidth, nSpikeChannels, waveformBaselineNoiseWindow) rawWaveformFolder = dir(fullfile(savePath, 'templates._bc_rawWaveforms_kilosort_format.npy'...
0ae47c3414635d47dc810aa058e4c7093417cfa3d4cf1fe1fc7fb24fb12fda60
MATLAB
1,556
68
function DBRemoveVariables(query) %DBRemoveVariables - Remove all variables that match given criteria. % % Actual removal will require confirmation from the user. % % USAGE % % DBRemoveVariables(query) % % query optional figure list query (WHERE clause; see Example) % % SEE % % See also DBAddVaria...
b5f9416dbea9279ff8c76145b03821876b59f701e558831b0717ea531e32cab1
MATLAB
1,556
45
function CBIG_ASDf_checkJobStatus(progress_file, num_jobs, lag_time) % CBIG_ASDf_checkJobStatus(progress_file, num_jobs, lag_time) % % This is a helper function that holds off the next jobs until submitted jobs % are finished. Useful when the next job is dependent on the submitted % jobs. % % Input: % - progress_fi...
22fff5349566f255945a1f19a26e702c87dae254417db74606ac5adcadd43151
MATLAB
1,557
56
function [] = latex2pdf3d(fname, latex_compiler) %LATEX2PDF3D Compile LaTeX code to PDF. % % usage % LATEX2PDF3D % LATEX2PDF3D(fname, latex_compiler) % % optional input % fname = file name string % latex_compiler = 'xelatex' | PATH_TO_XELATEX % % output % If compilation succeeds, then a PDF fil...
e4ad15d9fe46b5e49ae419db8bd1dbab45f612cb632cb0b5b0451e424486b265
MATLAB
1,557
59
function [oisii,trigid,dii]=reportBiopacImageIntake(bname,imchname,tw,bts) % Usage ... [ii,trigid]=reportBiopacImageIntake(biopac_matname,imChName,time_extent,sampling_time) if length(nargin)<4, ts=0.001; end; if length(nargin)<3, tw=160; end; if isempty(imchname), imchname='MainCam'; end; verb...
fac9a0df18486271941a7337c9c7a591676956b3e76c7b916737141c0b07c66b
MATLAB
1,557
70
% This Matlab script demonstrates the usage of this package. % % ---------------------------------------------------------------------- % Matlab tools for "Predicting human gaze beyond pixels," Journal of Vision, 2014 % Juan Xu, Ming Jiang, Shuo Wang, Mohan Kankanhalli, Qi Zhao % % Copyright (c) 2014 NUS VIP - Visual I...
15ee390c4532f1fa0254c9eed377b16491c47864812a9fd21199d963c1c4aa79
MATLAB
1,558
48
function map = PhaseMap(positions,phases,varargin) %PhaseMap - Compute spatial phase map. % % Compute phase map (e.g. for a place cell), as well as occupancy and count maps. % % USAGE % % map = PhaseMap(positions,phases,<options>) % % positions position samples % phases phases in radians % <...
471e71776e4cd3ad64ecc22d54c49f5762cf932091d5c8a8cfdeeb88400d321d
MATLAB
1,558
50
function [cs matchInds scores] = performMatching(grpRes,indRes,matchingFlag) % [cs matchInds scores] = performMatching(grpRes,indRes,matchingFlag) % % NOTE: This function is not exactly the same with Danial Lashikari's % function performMatching.m, which can be found here: % http://people.csail.mit.edu/dan...
edba59da06ba658e0dfc310d14db08e6d75f42fbe9b29eab147d3c10614df839
MATLAB
1,558
32
% Extract data from each region in a standardized atlas, averaging over voxels in the region % Method 1 % pass fmri_data object img into canlab_connectivity_preproc, using the 'extract_roi' keyword and passing in the atlas img = load_image_set('emotionreg'); % a sample fmri_data object; insert your single-subject 4-D...
8f8857745bdc00c1b7252998370314921ea4dbe33391418380e467b3c993f117
MATLAB
1,560
32
function new_tractset = ea_update_settings(tractset,new_settings) % Updates the given tractset object based on the % struct passed into the function tractset.calcthreshold = new_settings.calcthreshold; tractset.posvisible = new_settings.posvisible; tractset.negvisible = new_settings.negvisible; ...
994360107dcc68a6e174f9bcd8accbd43f94408fff58628775866db515e50514
MATLAB
1,560
53
function [nvar, names, types] = nex_info(filename) % nex_info(filename) -- read and display .nex file info % % [nvar, names, types] = nex_info(filename) % % INPUT: % filename - if empty string, will use File Open dialog % OUTPUT: % nvar - number of variables in the file % names - [nvar 64] array of variable names...
8d37ca3d4e440c84af9825aeb93ddb6267dc3391a0ec15b159f891ed2602f2d4
MATLAB
1,561
40
function [biomass_avg] = avgBiomass(BMD,numReplicates) % 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 ...
909665bad8fff0434c1849956c43557fb96cde7254eb9ac9c2db962a26f7d869
MATLAB
1,561
60
function [ind, tf] = UnderThresholdDetect(A, thresh, min_sep, min_length) % ind = ThresholdDetect(A, thresh, min_sep, min_length); % [ind, tf] = ThresholdDetect(A, thresh, min_sep, min_length); % % Searches for continuous epochs for which A is under thresh, merges those % separated by less than min_sep indices, and ret...
ec08c6cd4ee60be907e06f7c4ca7431056cd51dced00d96c70176c2ca128b3b4
MATLAB
1,562
73
function y = cvx_recip( x ) %RECIP Internal cvx version. % % Determine the expression types % narginchk(1,1); persistent remap if isempty( remap ), remap_1 = cvx_remap( 'constant' ) & ~cvx_remap( 'zero' ); remap_2 = cvx_remap( 'log-valid' ) & ~remap_1; remap = remap_1 + 2 * remap_2; end ...
512e41158e8e800dd9ce377898488e6cbf7ad72c29af28a4b21c09b9104c7ce6
MATLAB
1,563
39
% tutorial() - Bring up the ICA / electrophysiology toolbox tutorial % in a browser window (see docopt.m in the toolbox dir). % Tutorial URL: http://www.sccn.ucsd.edu/tutorial/ % Download: See http://www.sccn.ucsd.edu/ica.html % % Authors: Scott Makeig & Tzyy-Ping Jung, SCCN/INC/U...
96fe19e5df9ea89c05833b6b0e419ca21b801b408c92c00b2e4e871527d7e1a5
MATLAB
1,563
47
function StateIntervals = StateEditorToInts(basepath,basename) % Takes output from stateeditor and puts it back into StateIntervals. Also % puts metadata into apppropriate places as well, including saving any % manual thresholds % Brendon Watson July 2016 if ~exist('basepath','var') [~,basename] = fileparts(cd); ...
a56a275b077c90673150d3038c1e081985f931908d229a29f4e02411861ddf65
MATLAB
1,563
76
function fit = coxnet(x,is_sparse,irs,pcs,y,weights,offset,parm,nobs,nvars,... jd,vp,cl,ne,nx,nlam,flmin,ulam,thresh,isd,maxit,family) % Internal glmnet function. See also glmnet, cvglmnet. %time --- column 1 %status --- column 2 ty = y(:,1); tevent = y(:,2); if (any(ty <= 0)) error('negative event times enc...
4553e6e1bdafa86b526874a826b3b9d5f1ea5513c931d24c2cbff84eef5ca67d
MATLAB
1,564
56
function vol=smoothbinvol(vol,layer) % % vol=smoothbinvol(vol,layer) % % perform a memory-limited 3D image smoothing % % author: Qianqian Fang <fangq at nmr.mgh.harvard.edu> % % input: % vol: a 3D volumetric image to be smoothed % layer: number of iterations for the smoothing % % output: % vol: the volumetr...
6cd770b4e970485d9c0a6033c5ab523a43d1e4642fd4d2d6263dc5a98f55844f
MATLAB
1,564
47
% Solve a floor planning problem given graphs H & V % Section 8.8.1/2, Example 8.7, Boyd & Vandenberghe "Convex Optimization" % Joelle Skaf - 11/13/05 % (a figure is generated) % % Rectangles aligned with the axes need to be place in the smallest % possible bounding box. No overlap is allowed. Each rectangle to be plac...
b5f6069114ddaf6c4c30113a56ee30b983f0494b3174b47a646f6a954365b98e
MATLAB
1,564
52
function [adfreq, n, ad] = plx_ad_span_v(filename, channel, startCount, endCount) % plx_ad_span_v(filename, channel): read a span of a/d data from a .plx or .pl2 file % % [adfreq, n, ad] = plx_ad_span_v(filename, channel, startCount, endCount) % % INPUT: % filename - if empty string, will use File Open dialog ...
e5dc42aaee3e208991fee7b7965aaddd29c32fb34eb08b39337e66dcdc0f3e28
MATLAB
1,565
65
atl = load_atlas('yeo17networks'); def = select_atlas_subset(atl, {'Default'}); figure; montage(def); %% def = select_atlas_subset(atl, {'Default'}, 'flatten'); % figure; hh = addbrain('inflated surfaces') % surface(def, 'surface_handles', hh); figure; hh = addbrain('foursurfaces_hcp'); [~, cm] = seaborn_colors(22); ...
0ddf9fa5c1592b6f31ab2329bd738d2a90d99ddf121865f6deef53c2ad76507a
MATLAB
1,566
44
function [t_obs, p_val, t_null] = perm_paired_ttest(x, y, nPerm) % perm_paired_ttest 符号付置換による対応のある t 検定 % % [t_obs, p_val, t_null] = perm_paired_ttest(x, y, nPerm) % % 入力 % x, y : 対応のあるサンプルベクトル(同長ベクトル、または同サイズの行列) % nPerm : 置換回数(例:5000) % % 出力 % t_obs : 観測された t 統計量 % p_val : 両側検定の p 値 % ...
12d142f93cb2bcbec503e045c65cd7494ad374f185d53bc507d1b18e838153c3
MATLAB
1,566
53
%% Optimization of a simple (Rosenbrock) function, with no constraints % The unconstrained solution is at [1,1] rosen = @(x) (1-x(1)).^2 + 105*(x(2)-x(1).^2).^2; % With no constraints, operation simply passes through % directly to fminsearch. The solution should be [1 1] xsol = fminsearchbnd(rosen,[3 3]) %% Full lowe...
5621c788e58dd7535a545b915d0240a69a8dc11445557a502f0214706bd0186c
MATLAB
1,566
38
function my_fprintf(fid, varargin) %This function is needed because Matlab R2006B does not support fprintf with %fid=0, i.e., no output. This is a workaround. % %Internal function of SeDuMi. % This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko % Copyright (C) 2006 McMaster University, Hamilton, CANADA...
7347d978e976c1daf0fc3f0135242538d7dab99472c2a0de49e64f465e06a698
MATLAB
1,566
58
function ea_brainsresample(varargin) % Wrapper to apply BRAINSFit transformation using BRAINSResample fixedVolume = varargin{1}; movingVolume = varargin{2}; outputVolume = varargin{3}; volumedir = [fileparts(ea_niifileparts(movingVolume)), filesep]; if nargin >= 4 affine = varargin{4}; else % determine the a...
c329bc4b2a513bd51afd67d824324f17a8294bd991ae8c5ec0a52417d5af2078
MATLAB
1,566
58
function score = ea_discfibers_predict(atlas, groupAnalysis, improvement, mode, selection, side, posneg) if isfolder(groupAnalysis) load(ea_getGroupAnalysisFile(groupAnalysis), 'M'); elseif isfile(groupAnalysis) load(groupAnalysis, 'M'); end if ~exist('mode', 'var') || isempty(mode) mode = 'bin'; end if ...