sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
24db6d2acff5ff87154996e36470ad62e711b726bd7c832b8b3f02a2ee41382a | MATLAB | 2,229 | 77 | function plot_val_arrays(vals,monkey)
% project a set of values in cortical/array space
% vals = 1x1024
% monkey = 'F' or 'N'
% warning: some info are handcrafted, so it'll only work with 'F' and 'N'
% 2024 P.Papale fecit
img = imread(['\_code\code_utils_v2\_figs\',monkey,'_array.png']);
bw = im2bw(img);
stat... |
51d8ae4dcde0f7047be6c4fb88cd247e8759c09bbd47f3add11d018eefad3e89 | MATLAB | 2,229 | 45 | function SANDIinput = ProcessAllDatasets_forGUI(SANDIinput, fig_ax)
StudyMainFolder = fullfile(SANDIinput.StudyMainFolder,'derivatives','preprocessed');
SubList = dir(fullfile(StudyMainFolder,'sub-*'));
SANDIinput.DatasetList = SubList;
SANDIinput.report = [];
for subj_id = 1:numel(SubList)
SesList = dir(ful... |
9bc25c37286b39711a515bcf4031f27e7a30dfec44e7d636764b22ea954b2912 | MATLAB | 2,229 | 52 | % 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... |
4fc02a5c0f16db6d4388fe520b730ab56eca58a2aac570452fe1ede0acb77fde | MATLAB | 2,233 | 94 | function [adfreq, n, ts, nf, w] = nex_wf(filename, varname)
% nex_wf(filename, varname): Read waveform variable from a .nex file
%
% [adfreq, n, ts, nf, w] = nex_wf(filename, varname)
%
% INPUT:
% filename - if empty string, will use File Open dialog
% varname - variable name
%
%
% OUTPUT:
% ... |
543bf25d9acbc665bd5639fe9c50eec230c6cd71f19c4563402e91da143bc724 | MATLAB | 2,233 | 66 | function ff = draw_state_LE(V, C, strain, fignum, c, lw, opac)
% DRAW_STATE_LE Plot the tissue's cell polygons under Lees-Edwards
% sheared periodic boundary conditions.
%
% ff = DRAW_STATE_LE(V, C, strain, fignum, c, lw, opac) draws the
% outline of every cell, unwrapping each cell's vertices (relative to
% its... |
7125a596fafd9214477d3bc5a93958dc7ead4590ba6131b5a0ddf569863c4a1d | MATLAB | 2,234 | 83 | %% Example 2 of running basic topic model -- getting multiple samples
%
% This example shows how to run the LDA Gibbs sampler on a small dataset to
% produce *multiple* Gibbs samples from the same and different Markov
% chains
%%
% Choose the dataset
dataset = 1; % 1 = psych review abstracts 2 = NIPS papers
... |
10b7c80839d936492bf3e7fb37aceb196ead10cfb698258243511ea0c35aa5ff | MATLAB | 2,235 | 70 | function dimsiz = getdimsiz(data, field)
% GETDIMSIZ
%
% Use as
% dimsiz = getdimsiz(data, field)
%
% If the length of the vector that is returned is smaller than the
% number of dimensions that you would expect from GETDIMORD, you
% should assume that it has trailing singleton dimensions.
%
% Example use
% dimord... |
414f48f9e9f228cbfc04808f2388842d02bc6f31ef188356a5dba5f817f5cb09 | MATLAB | 2,235 | 97 | function [X,n]=ea_genX(fis,regressor,output,mask,sk,ctype)
if ~exist('mask','var')
mask=nan;
else
if isempty(mask)
mask=nan;
end
end
% check wheter want to normalize or smooth data
if exist('sk','var')
switch sk
case 'k'
dok=1; dos=0;
case 's'
dos=1; dok=0;
... |
4141486d908bfd52aa85ec096ce322856fe74a7ee1811f9028d19bde096a7aa9 | MATLAB | 2,236 | 71 | function ea_compare_Rmaps(rmap1,rmap2,n1,n2,alpha)
if ~exist('alpha','var')
alpha=0.05;
end
imr1=ea_load_nii(rmap1);
imr2=ea_load_nii(rmap2);
t_r1 = 0.5*log((1+imr1.img)./(1-imr1.img));
t_r2 = 0.5*log((1+imr2.img)./(1-imr2.img));
z = (t_r1-t_r2)./sqrt(1./(n1-3)+1./(n2-3));
p = (1-normcdf(abs(z),0,1))*2;
imr1.img... |
44637d9353414fed618193c511ab7de9f0e26dffa4b5a8d62478b52417a10e2c | MATLAB | 2,237 | 60 | % eeg_urlatency() - find the original (ur) latency of a time point in
% the original continuous data.
%
% Usage:
% >> lat_out = eeg_urlatency( event, lat_in );
%
% Inputs:
% event - event structure. If this structure contain boundary
% events, the length of these events is add... |
522dcbd8b4cde3260b67120ede4e66d52b30063b1507b7c054231bbbd3eeadd0 | MATLAB | 2,237 | 59 | clear;
clc;
close all;
addpath(genpath('../functions/'));
SUBINFO_FILE = '../../subInfo/rid_sex_mDoB_yDoB_mExam_yExam_ageExam_dx_icv_bl.csv';
GMICV_FILE = '../../vbm_810bl/gmVolAndICV/rid_gmVol_icv_bl.csv';
% What is the subtype order?
TEM = 2;
SUB = 3;
COR = 1;
fprintf('\n\n\n');
fprintf('!!! Subtype order assumed ... |
d52cc114e20ce822ece46dfb13f33ea526775c1ad9259df6ead8f380f53216ce | MATLAB | 2,239 | 140 | function colors=ea_nice_colors(nc,options)
try
options.prefs=ea_prefs(options);
catch
keyboard
end
switch options.prefs.d2.groupcolors
case 'lead'
colors=[179,163,118
255,219,168
119,154,179
168,219,255
252,45,21
176,30,14
252,160,20
176,111,14
252,149,21
176,103,14
... |
8aade8e00ded3f2a287e7035b0b4a6b24a18868a71065092753405d0d4fc6791 | MATLAB | 2,240 | 112 | function y = cat( dim, varargin )
%Disciplined convex/geometric programming information for CAT:
% CAT imposes no convexity restrictions on its arguments.
if ~isnumeric( dim ) || any( size( dim ) ~= 1 ) || dim <= 0 || dim ~= floor( dim ),
error( 'First argument must be a dimension.' );
end
%
% Quick exit
%
if... |
f9b413be850a68f8d0904071e79163adce1365a397c51b351c206cf1a926677d | MATLAB | 2,240 | 76 | function Ne=ea_vertex_neighbours_double(Fa,Fb,Fc,Vx,Vy,Vz)
F=[Fa Fb Fc];
V=[Vx Vy Vz];
% Neighbourh cell array
Ne=cell(1,size(V,1));
% Loop through all faces
for i=1:length(F)
% Add the neighbors of each vertice of a face
% to his neighbors list.
Ne{F(i,1)}=[Ne{F(i,1)} [F(i,2) F(i,3)]];
... |
2b3ecb2b90a2ec6930de392b678996ff3c4fc5faea5799d81f59a0d529a7e047 | MATLAB | 2,241 | 63 | function str = encodevarname(str,varargin)
%
% newname = encodevarname(name)
%
% Encode an invalid variable name using a hex-format for bi-directional
% conversions.
% This function is sensitive to the default charset
% settings in MATLAB, please call feature('DefaultCharacterSet','utf8')
% to set t... |
03a60920c0039d6fa0f529bb38f9c3cdbac5cdc68adcf9221d310c6dee3e5ec3 | MATLAB | 2,242 | 95 | % Example 7.2: Maximum entropy distribution
% Section 7.2, Figures 7.2-7.3
% Boyd & Vandenberghe, "Convex Optimization"
% Originally by Lieven Vandenberghe
% Adapted for CVX by Michael Grant 4/11/06
%
% We consider a probability distribution on 100 equidistant points in the
% interval [-1,1]. We impose the following pr... |
02491f23be30dda99a742faa7b9402b34a79473e929fef03f180ccd70a4d9b57 | MATLAB | 2,244 | 57 | % std_chaninds() - look up channel indices in a STUDY
%
% Usage:
% >> inds = std_chaninds(STUDY, channames);
% >> inds = std_chaninds(EEG, channames);
% >> inds = std_chaninds(chanlocs, channames);
% Inputs:
% STUDY - studyset structure containing a changrp substructure.
% EE... |
2ee01e390d7e5c197738b64f903263b2c288e679571c9db93049065a568202f6 | MATLAB | 2,245 | 58 | function y = sparfwslv(L,b, ysymb)
% y = sparfwslv(L,b, ysymb)
%
% SPARFWSLV Solves block sparse upper-triangular system.
% y = sparfwslv(L,b) yields the same result as
% y = L.L\b(L.perm,:)
% However, SPARFWSLV is faster than the built-in operator "\",
% because it uses dense linear algebra and l... |
2cef4332adf688f5615202287f1669c8df8b9e4477677f4d5e66cc2fa2ffe6a3 | MATLAB | 2,247 | 48 | % see E_CumSumInterval.m for education
% Detect Bursts based on spike detection timeframe.
clear all; close all;
%% Input parameters %%
BurstCriteria=[20,40,4,0]; % [minimal ISI (ms, <=) to start, maximal ISI(ms, >) to stop, minimal burst number, minimal burst interval (> excluded)]
TestISI=[12,30,42,50,60,30... |
43d9aeb73d69db9eeb26a261432c064c7fc759f15aec129cfbe52245dd3268b6 | MATLAB | 2,247 | 44 | % Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions
%
%=========================================================================
%
% Copyright (c) 2008 Thomas Yeo and Mert Sabuncu
% All rights reserved.
%
%Redistribution and use in source and binary forms, with or without
%modification, a... |
419afc516fd94cd7729c506837ad17ccbed7e1c546c63eec41fc0a9ae5cbb10f | MATLAB | 2,249 | 74 | % Lindquist (under review): You should not sequentially apply high-pass
% filtering and nuisance regression. Combine them into one step.
% This is an example of how to do that.
% Use SPM to get a filter
TR = 2;
n_timepoints = 300;
hpf = 128; % 128 is high pass filter length in sec, 1/hz
[S,KL,KH] = use_spm_filter(TR,... |
4c8c9d92a8e182fff6f340b65d6018905e51551e1b177cedc8fb4d1ef03fae75 | MATLAB | 2,250 | 65 | function checkMexCompiled(varargin)
%CHECKMEXCOMPILED Check if mex file is compiled for system
%
% IOSR.GENERAL.CHECKMEXCOMPILED(SOURCE_FILE) checks whether a mex source
% file SOURCE_FILE is compiled for the current operating system OR
% whether the source file has been modified since it was compiled. It is
% ... |
5375e07b7e44197d0e9415f273410541689abcd068081113c762558ca3e43cfc | MATLAB | 2,250 | 48 | mainfolderlist = {'1_1s';'2_2s5';'3_5s';'4_10s'};
mainfolder = '/Users/yiyuan/OneDrive - University of Essex/PG Research/0A_Journal/202004_unknown Journal_Probability Score/1_Results/0_Final Results/Results_';
resultfolder = '/Users/yiyuan/OneDrive - University of Essex/PG Research/0A_Journal/202004_unknown Journal_Pro... |
d21c65fc8e70d9a9bdf2af8380c41906c7f4d06b864548b328ec77a4c0d97550 | MATLAB | 2,250 | 56 | % demo file for applying the NoRMCorre motion correction algorithm on
% 1-photon widefield imaging data using low memory (good for long datasets)
% Example files can be obtained through the miniscope project page
% www.miniscope.org
clear;
gcp;
%% read data and convert to double
name = '/Users/epnevmatikakis/... |
635838caf57a2cdef7cdc3985426515024e6ab141f767c92af44929f204e9eab | MATLAB | 2,251 | 81 | function o = nifti1struc
% Create a data structure describing NIFTI-1 headers
%__________________________________________________________________________
% Copyright (C) 2005-2012 Wellcome Trust Centre for Neuroimaging
%
% $Id: nifti1struc.m 6289 2014-12-18 15:55:02Z guillaume $
persistent org;
if ~isempty(org)
... |
7a9089bdb77a0c5ee4d5134aaacbd6dcb77968169191c50302b0eba581ae2449 | MATLAB | 2,251 | 106 | % Convert image of different orientations to standard Analyze orientation
%
% Usage: nii = rri_orient(nii);
% Jimmy Shen (jimmy@rotman-baycrest.on.ca), 26-APR-04
%___________________________________________________________________
function [nii, orient, pattern] = rri_orient(nii, varargin)
if nargin > 1
... |
91e4b6ece4dbe276dc2718b3b00d8567e5eafc1d8aac16c13445b2972b208f7c | MATLAB | 2,252 | 60 | % dipfit_1_to_2() - convert dipfit 1 structure to dipfit 2 structure.
%
% Usage:
% >> EEG.dipfit = dipfit_1_to_2(EEG.dipfit);
%
% Note:
% For non-standard BESA models (where the radii or the conductances
% have been modified, users must create a new model in Dipfit2 from
% the default BESA model.
%
% Author: Arnaud D... |
e996c80307efec71aabf01e3f6724d85a04d385372669a592c3fb2b66b99576b | MATLAB | 2,252 | 76 | function stats = CBIG_fitLME_2t(subInfoFile, GMICVFile, q)
% stats = CBIG_fitLME_2t(subInfoFile, GMICVFile, q)
% What is the subtype order?
% Offset by 1, the RID column
%
% Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
COR_COL = 1+1;
fprintf('\n\n\n');
fprintf('!!! Su... |
8cf89fa256f50a79a792376b053c80d7471dca3865482c6dd014e2ac30ad83b5 | MATLAB | 2,254 | 80 | % getallmenus() - get all submenus of a window or a menu and return
% a tree.
%
% Usage:
% >> [tree nb] = getallmenus( handler );
%
% Inputs:
% handler - handler of the window or of a menu
%
% Outputs:
% tree - text output
% nb - number of elements in the tree
%
% Author: Arnau... |
81a5216759b4c05b064c1fdbb0a47fb8e5e7173a20ea70804f6306795e52e4ba | MATLAB | 2,256 | 79 | function [node,face,elem]=meshacylinder(c0,c1,r,tsize,maxvol,ndiv)
%
% [node,face]=meshacylinder(c0,c1,r,tsize,maxvol,ndiv)
% or
% [node,face,elem]=meshacylinder(c0,c1,r,tsize,maxvol,ndiv)
% [nplc,fplc]=meshacylinder(c0,c1,r,0,0,ndiv);
%
% create the surface and (optionally) tetrahedral mesh of a 3D cylinder
%
% aut... |
36257e501e29bf5976e40a17893506a89b28ec8172ab346320c515ccf7900f9a | MATLAB | 2,260 | 58 | function Obj=SOFAconvertCIPIC2SOFA(CIPIC)
% Obj=SOFAconvertCIPIC2SOFA(CIPIC) converts the HRTFs described in the structure CIPIC
% (see CIPIC HRTF format) to a SOFA object.
%
% Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences;
% Licensed under the EUPL, Version 1.1 or – as soon... |
87204ea0fb44b92e75acd36130ff60cc00527d5a21bedb507efd3685ffc4d138 | MATLAB | 2,260 | 80 | function [B, A] = buttersimple(Wn, option)
%BUTTERSIMPLE Fixed order Butterworth digital filter design.
% [B, A] = BUTTERSIMPLE(Wn), where 0.0 < Wn < 1.0, computes the
% numerator/denominator coefficients for a 6th order lowpass digital
% Butterworth filter.
%
% [B, A] = BUTTERSIMPLE(Wn, 'high'), where 0.0... |
e9e860217d6e912adb87d1eca57a0ca4eb808e3f3d8fb5a00e6d8505ba14f0e7 | MATLAB | 2,260 | 62 | function [regressors, regressors_CCA] = CBIG_ASDf_genRegressors(sub_info_file, sub_id)
% [regressors, regressors_CCA] = CBIG_ASDf_genRegressors(sub_info_file, sub_id)
%
% Helper function that generates regressors (age, sex, head motion, sites) for subjects
% indicated by sub_id.
% If sub_id is not specified, the regre... |
194bb336bbabffa3d0921f3137b575b6437a33820c11b17db1ad6c1167f27731 | MATLAB | 2,261 | 79 | function [propLongISI, coefficient_variation, coefficient_variation2, isi_skewness] = computeISIprop(ISIs, theseSpikes)
% refs:
% Yamin/Cohen 2013
% Stalnaker/Schoenbaum 2016
% Handle empty or insufficient spike times
if isempty(theseSpikes) || numel(theseSpikes) < 2
propLongISI = NaN;
coefficient_variation =... |
cbd07e9e10d055b6c8662385c1d9745295d544e6621dfa9f78c41cb6b5fe19d1 | MATLAB | 2,261 | 76 | function res = computebumpfilters(data,pre,post,lambda)
% close all
res.amp = [];
res.col = [];
res.odor = [];
res.fvel = [];
res.avel = [];
res.heading = [];
% trim bad data from ends and concatenate trials to form single vector for each parameter
j = 0;
for i=1:length(data) %add trials together
bump_col = data... |
ff1d6880f74436f5489aea3a3226449e6ba72f801a88ffffcab4052191b04615 | MATLAB | 2,261 | 60 | function SYMBADA = getsymbada(At,Ablkjc,DAt,psdblkstart)
% SYMBADA = getsymbada(At,Ajc,DAt,psdblkstart)
%
% GETSYMBADA
% Ajc points to start of PSD-nonzeros per column
% DAt.q has the nz-structure of ddotA.
%
% ******************** INTERNAL FUNCTION OF SEDUMI ********************
%
% See also sedumi, partitA, getad... |
07a91dfadfe79bbfc1a6c0dab37b3c8746973115ae2d517c1347870829d1babf | MATLAB | 2,263 | 84 | function [recurrence, diag_hist, vertical_hist, a] = line_hist(data, a, radius, type)
% Check if a is cell
if ~iscell(a)
a = {a};
end
% Convert distance matrices to recurrence matrices
for i2 = 1:length(a)
a{i2} = a{i2}+radius;
a{i2}(a{i2} >= 0) = 1;
a{i2}(a{i2} < 0) = 0;
end
% If a contains multiple... |
5a173f8eda34d05192d1bd98e6c931239ed415b651d9a4e5c5792fb7b625f996 | MATLAB | 2,263 | 64 | function d=edit_distance_levenshtein(s,t)
% Calculate the 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 permitted ... |
b339053a78b0c7e8c1c4b93a3f1dee3c62c24469e373bc235a66f43dad3c2e68 | MATLAB | 2,263 | 57 | %%*****************************************************************************
%% HSDsqlpCpert: perturb C.
%%
%%*****************************************************************************
function [At,Cpert] = HSDsqlpCpert(blk,At,par,C,X,Cpert,runhist)
iter = length(runhist.pinfeas);
prim_infeas = runhist.pinfeas(... |
62b2409d8a272e30a6e51da652daf322415369eec5b4c14717a01b494730c147 | MATLAB | 2,265 | 75 | function [V,C,topo,strain,stress_tensor] = unshear_initial_state_qvm...
(V,C,KP,P0,KA,A0)
% input must be a strain zero state!
topo = get_adj_mat(V,C);
box_size = sqrt(topo.Ncell);
max_relaxation_steps = 5000;
force_tol = 1e-8;
strain = 0;
[V,mf] = vm_minimize_LE(V,C,KP,P0,KA,A0,max_relaxation_steps,force_tol,stra... |
c87fdc8d3b4a5ce2fbe8d4519f26b7f507c1eaef962de4e9a15c40326249e39b | MATLAB | 2,266 | 41 | % Read in histology image with imread function %
imgRGB = imread('/dcs04/lieber/lcolladotor/with10x_LIBD001/HumanPilot/10X/20190925_JHU_Lieber_HumanBrain_LP/');
% convert image datatype to double %
imgRGB = im2double(imgRGB);
% Applied gaussian smoothening and increased the contrast in image to get rid of the noise i... |
07b03a3ce15564191c44bdc2efc360e85683bc18aa09114b4a56c3e4fd974230 | MATLAB | 2,267 | 91 | function p = PlotMean(X,Y,L,U,style,color)
%PlotMean - Plot mean and confidence intervals.
%
% USAGE
%
% p = PlotMean(X,Y,L,U,style,color)
%
% X abscissae
% Y ordinates
% L lower error level
% U upper error level
% style optional style (':... |
559fa3c5957e3e28b3df0124cfa29a129a94eba5c16a5b32e4614f2d87000cbd | MATLAB | 2,268 | 91 | function x=editmask(x,im,ax)
% Usage ... x=editmask(x,im,ax)
do_relabel=0;
if max(x(:))>1,
disp(' X > 1, turning it to a mask and relabeling at the end...');
do_relabel=1;
xorig=x;
x=x>1;
end;
if nargin<3, ax=[1 size(x,2) 1 size(x,1)]; end;
if ischar(ax), if strcmp(ax,'roi'),
do_relabel=2;
... |
11e3d5b012f1a5755f1423deae0d637f6e2d40aa20aa3198f9a018c9dcc499a5 | MATLAB | 2,270 | 60 | function uipatdir = ea_getdataset(options,handles)
try
load([ea_prefsdir, filesep, 'ea_recentdatasets.mat'], 'recentfolders');
startPath = fileparts(recentfolders{1});
catch
% Use default location
defaultLocation = fullfile(ea_gethome, 'Documents', 'LeadDBSDataset');
if ~isfolder(defaultLocation)
... |
016c023f26a72759af86f408f89c1dde1d659bb5a564573b1497449087ff2e25 | MATLAB | 2,271 | 71 | function ea_discfibers2raw(discfiber, patientdir)
% Warp discriminative fibers to patient T1 (anchor in LeadDBS) and raw T1 space
%
% discfiber: discriminative fibers including fiber cell and T-scores
% patientdir: patient directory
% Load discfibers in MNI space
load(discfiber, 'fibcell')
load(discfiber, 'val... |
34b3ad32d2ba893271b9dfe6ff8aa9d50a5cbdec21b797bc5378d9cac7fb60bd | MATLAB | 2,272 | 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... |
54d46f6f041f2de6e66e21a215b8e4c035b38bbb4d01b9cfb5e3220f67f54b39 | MATLAB | 2,272 | 60 | %% Fits a parameterized polynomial [0,1] -> R^3 to a skeleton point cloud
% Params:
% skeleton - 3 x N skeleton pointcloud
% OPTIONAL degree - degree of fitted polynomial (DEFAULT: 3)
%
% Andreas Husch
% Centre Hospitalier de Luxembourg / Luxembourg Centre for Systems
% Biomedicine, University of Lu... |
f6d2181ea54aad048170fec782ea88dd4045b00569eeaa71a4150ddd84e65705 | MATLAB | 2,272 | 65 | function T = spm_type(x, arg)
% Translates data type specifiers between SPM & MATLAB representations
% FORMAT T = spm_type(x, arg)
% x - specifier
% T - type
% arg - optional string argument, can be:
% - 'maxval' - return maximum allowed value.
% - 'minval' - return minimum allowed value.
% ... |
31cbe957dbe2991261d44d9ea2873d15eaf457dae3641966f0e71f9dcc5dd00f | MATLAB | 2,273 | 78 |
%% Profiles across signatures
% Load signature maps
[bucknerlab, netnames, imgnames] = load_image_set('bucknerlab');
bucknerlab.image_names = netnames;
% Riverplot
% ----------------------------------------------------------------
printhdr('Cosine Similarity : All conditions');
% Name the conditions
for i = 1:leng... |
7154a42ccc123bb77e340a20c68173e1f9788685b40db034a739f484716aa602 | MATLAB | 2,273 | 66 | function [] = restoreOriginalKwik(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;... |
b77afccab9888554460aafcd3627d8d35b10ac0b1d57896e1ebc71bc38dab884 | MATLAB | 2,273 | 68 | function Combine_BilateralSrf(p,MapType,SrfFolder,RoiLabel,srfprefix)
% This script will plot the back-projection of the fMRI responses into the
% visual space, by using the pRF data and the contrast responses (xx_con)
clear all;
close all;
clc;
if nargin < 1
disp('..... SELECT DIRECTORY FOLDER FOR THE MAIN PROJE... |
fe29e1314058264f3f69ec602e69330f1e27c88a2102ea10615bb2008e3066e6 | MATLAB | 2,273 | 69 | % fdr() - compute false detection rate mask
%
% Usage:
% >> [p_fdr, p_masked] = fdr( pvals, alpha);
%
% Inputs:
% pvals - vector or array of p-values
% alpha - threshold value (non-corrected). If no alpha is given
% each p-value is used as its own alpha and FDR corrected
% array is ret... |
1018a830a3ff138f71b6e13f50896556eaaece8dbd78eedfaa09364bcd5b962f | MATLAB | 2,274 | 66 | function ea_spec_atlas(obj, command, cmap, setinterpol)
set(obj, 'LineWidth', 0.1);
if ~setinterpol
fc=get(obj, 'FaceColor');
set(obj, 'EdgeColor', fc/1.2);
colormap(gray);
else
set(obj, 'FaceColor', 'interp');
colormap(gray);
end
len = get(obj, 'CData');
switch command
case 'labeling'
... |
272d98fa9ade00edeb3f472b2dc434b6536a7991b98f9437cf78a5831fbc43a4 | MATLAB | 2,274 | 53 | function handles = loadframestamp(framestampname, datafilepath, handles)
framestampvariable = handles.framestampvariable;
stampinfovariable = handles.stampinfovariable;
if isempty(framestampname)
% load frame stamp from data directory
for k = 1:length(handles.datafilename)
datafilename = handles.dataf... |
39efdf3785b05b0c2429af1e5ea64c605c20b2261640e6395aafb7ef438521f5 | MATLAB | 2,274 | 76 | load("LOO_results.mat")
load("MF_results.mat")
F1_deepMF(size(results)) = 0;
F1_deepMF_He(size(results)) = 0;
F1_rand(size(results)) = 0;
F1_MF(size(results)) = 0;
Precision_deepMF(size(results)) = 0;
Sensitivity_deepMF(size(results)) = 0;
Precision_rand(size(results)) = 0;
Sensitivity_rand(size(results)) = 0;
for i =... |
5e6b778058afde09308532d85e6de3659130ccb0b9d794e03f5268d3e12b279a | MATLAB | 2,274 | 104 | function lfplot(varargin)
% Plot (for one or two dimensions) a locfit() fit.
%
% Usage:
% fit = locfit(x,y);
% lfplot(fit);
%
% Plot the fitted smooth curve, and add a scatterplot of the data.
%
% Required argument:
% fit (produced by locfit()).
%
% Optional arguments:
% 'nodata' - don't add data to plot.
%... |
b043b214061a3bd634ce94c999a92ddcd1b9824d9adcc24a93e395ce76ca12e9 | MATLAB | 2,274 | 63 | function [S,U,S_history, U_history] = sparse_coding_by_LCA(...
X, A, lambda, thresh_type, eta, s_max, n_iter, history_flag, S_past, U_past)
% Implement sparse coding using local competition algorithm, i.e. LCA (Rozzel et al. 2008)
% X: input matrix where each column is one example of the input
% A: the columns ... |
3921218869a3c77f05def8d7aa836521844b8449a9b2f09e124c049c28cce74b | MATLAB | 2,275 | 51 | % 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... |
988eb526e8a0259863ee7ddd09bbe7669ea65d784173a0f68bf6e1c432eb7f29 | MATLAB | 2,276 | 69 | function [var_information] = Information(self,variableName,root,varargin)
% var_information = root.myvar2.Information('x',root,...);
%
% Calcuates how much information can be extracted about variable
% 'variableName' from the firing rate of root.cel. (bits/spike). See
% CMBHOME.Session.SpatialInformation for inspirati... |
4a566ce883015a3f0f78026edb70c503489ac7bb60d6b5cc5b8c18874587d4e7 | MATLAB | 2,277 | 66 | function [adfreq, n, ts, fn, ad] = plx_ad(filename, channel)
% plx_ad(filename, channel): read all a/d data for the specified channel from a .plx or .pl2 file
% returns raw a/d values
%
% [adfreq, n, ts, fn, ad] = plx_ad(filename, channel)
% [adfreq, n, ts, fn, ad] = plx_ad(filename, 0)
% [adfreq, n,... |
86422bed0a29f326f5865717ded01f10795c8e1c89051757c1222b0b9ab50bce | MATLAB | 2,277 | 42 | function X = cell2mat_ov_sum(I,xx_s,xx_f,yy_s,yy_f,zz_s,zz_f,overlap,sz,Bs)
% converts a cell array to a matrix when the cell elements overlap
% INPUTS:
% I: cell array
% grid_size: true size of each element
% overlap: amount of overlap in each direction
% d1: number of rows of matrix
% d2... |
b027b83d38715716b9080ed9b19dfba00e4a336ab875754c321a0d220c2b9891 | MATLAB | 2,278 | 58 | function varargout = settingsManager(varargin)
% settingsManager
%
% Loads, maintains and saves the NPMK Settings File. For internal use only.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Use settingsManager
%
% Use settingsFile = settingsManager(settingsFile)
%
% settingsFile: ... |
ea72189bd4c9846ea701233e8022ce81ff802ed528d5645dd21c23f18c6c2fae | MATLAB | 2,278 | 63 | function rgb = vals2colormap(vals, colormap, crange)
% Take in a vector of N values and return and return a Nx3 matrix of RGB
% values associated with a given colormap
%
% rgb = AFQ_vals2colormap(vals, [colormap = 'jet'], [crange])
%
% Inputs:
% vals = A vector of values to map to a colormap or a cell array ... |
c8ca3cc6f6496493a853746ad6f7d6e7873557aea269a50dcd19c09369a57ae0 | MATLAB | 2,279 | 87 | function sts = write_hdr_raw(fname,hdr,be)
% Write a NIFTI-1 header
% FORMAT sts = write_hdr_raw(fname,hdr,be)
% fname - filename of image
% hdr - a structure containing hdr info
% be - whether big-endian or not [Default: native]
%
% sts - status (1=good, 0=bad)
%_____________________________... |
b23d6b10e5e7427f860e63e908e6fadde3a521fb7e3c08d3b030caff999d9bd7 | MATLAB | 2,280 | 78 | %%********************************************************************
%% scaling: scale the SDP data so that A_k,C,b have unit norm.
%%
%% [At,C,b,normA,normC,normb,X0,y0,Z0] = scaling(blk,At,C,b,X0,y0,Z0);
%%
%% The linear objective function value is unchanged under
%% the scaling.
%%
%% SDPT3: version 3.1
%% ... |
dc36a286ac227f3b7f271873c0005decafa69388d2a7a0bd5b7333bd0e9cd52c | MATLAB | 2,280 | 108 | function [fibers,idx,voxmm,mat,vals]=ea_loadfibertracts(cfile, ref)
if ~exist('ref','var')
ref = 'mni';
end
if endsWith(cfile, {'.trk', '.trk.gz'})
ea_trk2ftr(cfile, ref, 1);
cfile = replace(erase(cfile, '.gz'), '.trk', '.mat');
end
fibinfo = load(cfile);
if ~isfield(fibinfo,'ea_fibformat')
ea_convert... |
fee591fc0cc83f468e58439e905a40e6e6bcd6aec18ac92671496440df97398d | MATLAB | 2,282 | 70 | % Exercise 4.31: Design of a cantilever beam (GP)
% Boyd & Vandenberghe "Convex Optimization"
% Almir Mutapcic - 01/30/06
% Updated to use GP mode 02/08/06
% (a figure is generated)
%
% We have a segmented cantilever beam with N segments. Each segment
% has a unit length and variable width and height (rectangula... |
863a852a28a3cd229590bdff48ab3cfeb2bea4e06378d2efa59e1e9bd1f6c11e | MATLAB | 2,283 | 67 | function [d dt ft pred] = dfs(A,u,varargin)
% DFS Compute the depth first search times.
%
% [d dt ft pred] = dfs(A,u) returns the distance (d), the discover (dt) and
% finish time (ft) for each vertex in the graph in a depth first search
% starting from vertex u.
% d = dt(i) = ft(i) = -1 if vertex i is not reachable... |
41a0fd75178e544c2fc0c225327053bfc492c3d5f8a79145288dc6161496bd92 | MATLAB | 2,284 | 94 | function cvx_optval = sqrt( x )
% Discipined convex programming information for SQRT:
% SQRT(X) is log-concave and nondecreasing in X. Therefore, when used
% in DCPs, X must be concave (or affine).
%
% Disciplined geometric programming information for SQRT:
% SQRT(X) is log-log-affine and nondecr... |
57d8931c3501dcd609c8fad6d89df682a80e13c75de38839c7c4f3afa57184b7 | MATLAB | 2,284 | 45 | % Specialized plotting functions for FMAToolbox.
%
% Interactive commands
%
% Browse - Interactively browse the data in one or all subplots in a figure.
% UIAddLine - Interactively add horizontal/vertical line to existing plot.
% UIInPolygon - Find points in interactively d... |
7739d64e2fec0e938760aef3829f46a6d7b1deffd135922f9d159a6cfa78b270 | MATLAB | 2,285 | 77 | function [col_shift,M] = correct_bidirectional_offset(Y,nFrames,us)
% look and correct for phase artifacts due to bi-directional scanning
% with thanks to Fabian Sinz for useful discussions.
if ~exist('us','var'); us = 10; end
if ~exist('nFrames','var'); nFrames = 50; end
if isa(Y,'char')
Y = read_file(... |
ce6dfcacf0a173e17c4262dd55dfc32fbc3794f3c0311c3b1c82426ce9b1ac2f | MATLAB | 2,286 | 75 | function [newno,newfc]=remeshsurf(node,face,opt)
%
% [newno,newfc]=remeshsurf(node,face,opt)
%
% remesh a triangular surface and the output is guaranteed to be
% free of self-intersecting element. This function is similar to
% meshresample, but it can both downsample or upsample a mesh
%
% author: Qianqian Fang (fangq... |
7fe81cd64e0066704c1206fb14190bd9792d093c131c254d05d2cacffe9c7eea | MATLAB | 2,290 | 75 | function loops=extractloops(edges)
%
% loops=extractloops(edges)
%
% extract individual loop or polyline segment from a collection of edges
%
% author: Qianqian Fang, <q.fang at neu.edu>
% date: 2007/11/21
%
% input:
% edges: two column matrix recording the starting/ending
% points of all edge segme... |
5462499ed75180e927013cbaf1ddc6330bf58ee1812af70f78e54966204bc7bc | MATLAB | 2,291 | 54 | function oldinfo = busyfigure(figurehandle, busy, statusstring, oldinfo)
%BUSYFIGURE Disable/restore a UI figure.
% OLDINFO = BUSYFIGURE(FIGUREHANDLE, BUSY) freezes (or unfreezes) the UI
% figure when it is busy (done) with a task; the BUSY argument is 1 to
% freeze and 0 to unfreeze. Freezing disables al... |
d00f60b3ae525a8f5bce63d56a214ab9179f2f546173f1aa3885416f7579ef94 | MATLAB | 2,291 | 68 | function [xsmooth, Vsmooth, VVsmooth, loglik] = kalman_smoother(y, A, C, Q, R, init_x, init_V, varargin)
% Kalman/RTS smoother.
% [xsmooth, Vsmooth, VVsmooth, loglik] = kalman_smoother(y, A, C, Q, R, init_x, init_V, ...)
%
% The inputs are the same as for kalman_filter.
% The outputs are almost the same, except we cond... |
2e5aca268a3cbc1faae56a40ecec3027d8e7a508a359dd43f0cd22738fd2c1f5 | MATLAB | 2,293 | 71 | function [headmodel] = ft_read_vol(filename, varargin)
% FT_READ_VOL reads a volume conduction model from various manufacturer
% specific files. Currently supported are ASA, CTF, Neuromag, MBFYS
% and Matlab.
%
% Use as
% headmodel = ft_read_vol(filename, ...)
%
% Additional options should be specified in key-value ... |
f64f768707bcb5cbf5f2f7262818e14c2016a70d05911e3281684fc14bbbed95 | MATLAB | 2,293 | 72 | function i_plot = plotEBC_tight(root,out,ha,i_plot)
%
% Downloaded from the Github of Hasselmo's lab
% Modified by Yanbo Lian for the purpose of displaying figures
%% scatter of spike directions
ax = ha(i_plot); i_plot = i_plot + 1;
axes(ax);
hold on;
c_size = 4;6; % default 15;
% c_size =... |
89afc6690e1d0aa09c188c38f544ffbd339a49bd78b69fe46ed38cde284e2cfc | MATLAB | 2,294 | 62 | function [ results ] = runBatchAnalysis(analysisToRun,directoryList,fileList)
% runBatchAnalysis(analysisToRun,directoryList,fileList) is a high level function that
% takes as its input an analysis function, a list of folders, and a list of files. It
% iterates through each folder, loading the listed files and running... |
b0357d6f16c8f575ee8be3ac087e4defb52ef45ab7e0e641c4986a97d7f7eff6 | MATLAB | 2,294 | 65 | function y = ea_sgolayfilt(x, order, framelen, weights, dim)
% varargin: x, order, framelen, weights, dim
has_sgolayfilt = ~isempty(which('sgolayfilt'));
if has_sgolayfilt
if nargin < 4
y = sgolayfilt(x, order, framelen);
elseif nargin < 5
y = sgolayfilt(x, order, framelen, weights);
else
... |
eb9cafdd19faebaea3fcc62d978e1f7fa75de38624497e4075d998349ec6661c | MATLAB | 2,294 | 142 | D = imread('D-Pine_Black.jpg');
Dflat = ~any(D, 3);
[n, k] = size(Dflat);
t = 25;
% X = (1:n)';
%
% for i = 1:(k-1)
% X(:, end+1) = [X(2*i:end, 1); X(1:2*i-1, 1)];
%
% end
X = zeros(n, k);
X(:, 101:300) = repmat((1:n)', 1, 200);
%X(:, k-99:k) = repmat((n:-1:1)', 1, 100);
X(:, 201:400) = repmat((n:-1:1)', 1... |
82a8e2bf2ee427241480d5d4a2c23a262dc2673243a8b226e862a50997b7ff41 | MATLAB | 2,295 | 83 | function [min_subj_per_group, is_boot_samples, boot_samples, new_num_boot] ...
= rri_boot_check(num_subj_lst, num_cond, num_boot, incl_seq)
if ~exist('incl_seq','var')
incl_seq = 0;
end
total_subj = sum(num_subj_lst);
num_group = length(num_subj_lst);
total_rows = num_cond * total_subj;... |
832d46069c36b66b1eeefd680b522d5979df60eb3f3c671cb85ef040e6a0b4b9 | MATLAB | 2,295 | 77 |
%% Profiles across signatures
% Load signature maps
[emotionmasks, netnames, imgnames] = load_image_set('kragelemotion');
emotionmasks.image_names = netnames;
% Riverplot
% ----------------------------------------------------------------
printhdr('Cosine Similarity : All conditions');
% Name the conditions
for i =... |
909f4075ec36ae53971dd6f68e0b1c4873aff317ef1eab9f292a15b0ec6217fc | MATLAB | 2,295 | 57 | %% Joint Mutual Information Demo 1
% This demo goes through calculating the joint mutual information between
% multiple discrete time series.
% Data Type: Discrete
% Number of Variables: 4
% Information Analysis: Joint Mutual Information
% Trial Based or Single Trial: Single Trial
% Significance Testing: Off
% Delays:... |
4d7c33399c04db803be583783dc0cd20696de9e4f7603dfa6d13a673e8473a17 | MATLAB | 2,296 | 83 | function M = stl_read(filename)
% Read STL-formatted data from disk
% FORMAT M = stl_read(filename)
%
% filename - STL-formatted file name
% M - data structure
%__________________________________________________________________________
%
% STL Format Specification:
% https://en.wikipedia.org/wiki/STL_%28file_fo... |
c3f2df41f93c8633c905056cebae8145c32a65b83ec1c222d0e80f918f2ca800 | MATLAB | 2,296 | 82 | function plot_lfp_spectrum(self, TBP, n_tapers, f_range, theta_analysis)
% Plots a spectrogram in jet colormap for root.b_lfp(lfp_ind).
%
% root.plot_lfp_spectrogram(lfp_ind, windowsize, windowsin, bandwidth, f_range);
import CMBHOME.Utils.*
AddChronuxPackage;
if ~exist('TBP', 'var')
... |
e4c12dd5c13de44a489d12505be305af8189288fcef01a3416c4c694920269ea | MATLAB | 2,297 | 74 | function [periods,quiescence] = QuietPeriods(v,velocity,duration,brief)
%QuietPeriods - Find periods of immobility.
%
% Find periods of immobility, i.e. periods of sufficient duration
% where instantaneous linear velocity remains low. Brief movements
% can be ignored.
%
% USAGE
%
% [periods,quiescence... |
a7ea7e4354ecf7642749fe4d2a10198eb38665fa87ce2c5704e5eb417fbd55a3 | MATLAB | 2,298 | 62 | function [im_mask, roi_seed_master, dendriteROI_mask, shaft_flag, dendID, defaultPara] ...
= loadROImaskfile(maskfilepath, maskfilename)
shaft_flag = 0;
dendID = [];
variableinfo = who('-file', fullfile(maskfilepath, maskfilename));
im_mask = []; roi_seed_master = []; roi_seed = []; dendriteROI_mask = [];
if ismemb... |
a8f633e629540074f8dcf151b543494cfc5751a25aad43dc9915e871574e957d | MATLAB | 2,299 | 44 | % Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions
%
%=========================================================================
%
% Copyright (c) 2008 Thomas Yeo and Mert Sabuncu
% All rights reserved.
%
%Redistribution and use in source and binary forms, with or without
%modification, a... |
c5bc15178f6b8fb89b62340839338c518e7a95fb0b0b79a618c6ca5a37fbc6fd | MATLAB | 2,299 | 66 | % std_checkconsist() - Create channel groups for plotting.
%
% Usage:
% >> boolval = std_checkconsist(STUDY, 'uniform', 'condition');
% >> boolval = std_checkconsist(STUDY, 'uniform', 'group');
% Inputs:
% STUDY - EEGLAB STUDY set comprising some or all of the EEG datasets... |
12f6d09db2e6697c94f2bbb7fd54d742a71eb4dc50c870cff566be947825a218 | MATLAB | 2,300 | 92 | %% Batch script to run Constrained NeuroMark ICA on SBM (or PET)
% using external template
% Enter the values for the variables required for the ICA analysis.
% Variables are on the left and the values are on the right.
% Characters must be enterd in single quotes
%
% After entering the parameters, use icatb_batch_fil... |
51409c26d25d293ab19474c8e0fd2d70d0d795baffbc74fc77cdc188718911fb | MATLAB | 2,300 | 68 | % eeg_mergechan() - merge channel structure while preserving channel
% order
%
% >> mergelocs = eeg_mergechan(locs1, locs2);
%
% Inputs:
% locs1 - EEGLAB channel location structure
% locs2 - second EEGLAB channel location structure
%
% Output:
% mergelocs - merged channel locatio... |
52c0315daaf56029ac889720963686a93139315029f3db36d433facbd99118cf | MATLAB | 2,300 | 76 | function zone = DefineZone(s,shape,points)
%DefineZone - Define a restricted zone to which analyses can be circumscribed.
%
% Define a restricted zone in the environment, to which analyses can subsequently be
% circumscribed using <a href="matlab:help IsInZone">IsInZone</a>. Multiple zones can easily be combined (see ... |
69d4642b8871d01d6ca3a0bead696ce6765f3c3628c4afcea61542c5836b1e19 | MATLAB | 2,300 | 71 | function Z_flip = CBIG_MMLDA_brain_to_zscore(vol4D, mask, regressor, refpara)
% Z_flip = CBIG_MMLDA_brain_to_zscore(vol4D, mask, regressor, refpara)
%
% Convert brain 4D volume to zscore with respect to reference cohort.
% 1. Take log10
% 1. Regress out regressors with respect to reference.
% 2. Zscore withe respect ... |
46bec22a506a18b1be25037e4dc4bee15e3edd92b23cfe33bccc436657403a9c | MATLAB | 2,303 | 66 | %% A_SpikeVectorStrength_Plot.m
% Grouping vector strength results from all units
%
%%%%% Version history %%%%%
% V1 : 12/17/2022
% - first released
%
% by Liang-Yin
clear all; close all;
%% Parameters
path2data = pwd;
RewardCondition = 7;
VSfreq = [2 30];
vfMean_group = [];
mycolorm... |
9c6a7e92ae91175e591cbc055cadb839506be2c8d33f9969a8d4ddb2cacd4bc3 | MATLAB | 2,303 | 69 | function [dN,t]=binspikes(data,Fs,t)
% bin spikes at a specified frequency sampling i.e. sampling rate 1/sampling
% eg: 1ms accuracy use sampling = 1000
% Usage: [dN,t]=binspikes(data,Fs,t)
% Inputs:
% data (data as a structure array of spike times; or as a single
% vector of spike times)
% Fs (binning fre... |
32fe312f24b01042d3798a9286f315ca6d13bedf62c1e59fc53603df8af464a4 | MATLAB | 2,305 | 75 | function elstruct=ea_mirrorsides(elstruct)
% function that will duplicate elstruct with mirrored sides
if isstruct(elstruct) % proper elstruct
dim=length(elstruct);
% 1st loop: Aggregate points to warp!! Important, this loop needs to be
% structured exactly as the one below!
cnt=1;
for el=1:dim
... |
a9036fc505cc4e4dfd9e4299ea3b91c6f7f8205de4d0f4181fe07deb2a1a2b8a | MATLAB | 2,306 | 92 | %% Batch script to run Constrained NeuroMark ICA on SBM (or PET)
% using external template
% Enter the values for the variables required for the ICA analysis.
% Variables are on the left and the values are on the right.
% Characters must be enterd in single quotes
%
% After entering the parameters, use icatb_batch_fil... |
26acd4caec01ceb325e61de8538324ca33cfac1bbfeff2d6e12613ef5fe7c30b | MATLAB | 2,307 | 67 | function [nR_S1 nR_S2] = trials2counts(stimID,response,rating,nRatings,cellpad)
% [nR_S1 nR_S2] = trials2counts(stimID,response,rating,nRatings,cellpad)
%
% Convert trial by trial experimental information for N trials into response counts.
%
% INPUTS
% stimID: 1xN vector. stimID(i) = 0 --> stimulus on i'th tr... |
768b482b5e84c078e673fa693e3c0e53409006202aab7ac3070500cde8636b83 | MATLAB | 2,309 | 82 | function str = verbatim
%VERBATIM Get the text that appears in the next comment block.
% Returns the text of the first comment block following the call. The
% block comment delimiters, %{ and %}, must appear on lines by themselves
% (optionally preceded by white space).
%
% If you want a final end-of-line charact... |
7cb08ffe406cca00a8c506df27e1c10ae4a4ceeb592e069437d799e6cedad82a | MATLAB | 2,309 | 69 | function tfce = tfce_transform_3d(stat, H, E, conn, dh)
% tfce_transform_3d Threshold-free cluster enhancement (Smith & Nichols 2009).
%
% tfce = tfce_transform_3d(stat, H, E, conn, dh)
%
% Computes, for each voxel v,
%
% TFCE(v) = sum over thresholds h of h^H * extent(h,v)^E * dh
%
% where extent(h,v) is... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.