sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
5daa70f5eb143802ff50aff33d9e78d6d7efece82843287ce2498453096d7bb9 | MATLAB | 4,364 | 89 | function [Obj, log] = SOFAcompact(Obj)
%SOFAcompact
% Obj = SOFAcompact(Obj) compacts the unique value to singleton dimensions
% of variables where possible.
% Current limitation: Variables with 3 dimensions will be only compacted
% when the third dimension is the compressible one.
%
% SOFA API - fun... |
1dadc97e348770eeb54b4bd377e73c45c5f6dc9909f61530c219e9cba2335f81 | MATLAB | 4,365 | 114 | function [ sout, slist ] = cvx_solver( sname )
%CVX_SOLVER CVX solver selection.
% CVX_SOLVER <solver_name> or CVX_SOLVER('<solver_name>')
% selects the named solver the CVX uses to solve models. The solver name
% is case-insensitive; so, for example, both 'SeDuMi' and 'sedumi' will
% select the same ... |
99be288c5b733699476696e15cc5f79093222544ea218d1aaa8739bcb983a1b6 | MATLAB | 4,366 | 166 | % You can run this with a new image set by changing only the two lines below:
figtitlebase = 'Kragel Emotion signatures Cosine Similarity';
image_set_name = 'kragelemotion'; % keyword for named set to pass into load_image_set
[mapset, netnames] = load_image_set(image_set_name);
C=hsv(7); C=C([2 5 1 4 7 6 3],:); fo... |
e08783aa1f85300203e241f9fcbba6ed708986f97cfc853e166816568ec2bf5b | MATLAB | 4,368 | 136 | function filtered = Filter(samples,varargin)
%Filter - Filter samples.
%
% USAGE
%
% filtered = Filter(samples,<options>)
%
% samples samples given as a list of (t,v1,v2,v3...) tuples
% <options> optional list of property-value pairs (see table below)
%
% ======================================... |
712a17ce74b0b3bc370d604b5b635d50dca9f72950743655cdbcf7462e2945b0 | MATLAB | 4,369 | 126 | function [pTR, nullTR, cCritical] = simulatePt2BlobColoc(numTarDetect,segmentation,...
cellMask,colocFraction,varargin)
% SIMULATEPT2BLOBCOLOC simulate object positions to be used for colocalization
%
% SYNOPSIS
%INPUT
% numTarDetect: number of target objects
%
% segmentation: binary image ... |
6e60af85cbbc53c2ccffee60aa479449622cd841af06695b81f29975dcb7387d | MATLAB | 4,370 | 103 | function [ field_index ] = field_index_fun( varargin )
% FIELD_INDEX_FUN - Calculated the field index.
%
% Calculates the field index along a trajectory. This function uses the
% pass_index_parser to generate its input structure.
%
% FIELD_INDEX = FIELD_INDEX_FUN(POS_TS,POS,SPK_TS)
% FIELD_INDEX = FIELD_INDEX_FUN(POS_T... |
8049331155f461dd1b2731449356cc5454db31a081fe871d570b8dd2ee2cd45e | MATLAB | 4,371 | 129 | function saveNEVSubSpikes(channelsToRead, fileFullPath, addedSuffix)
% saveNEVSubSpikes
%
% Opens saves a new NEV file that only contains chanenls in channelsToRead.
%
% Use saveNEVSubSpikes(channelsToRead)
%
% channelsToRead: The channel data to be saved into a new NEV.
% DEFAULT: This input is r... |
3240c2f9457b534cf8fd6de7cb868020a405c4c5194f141e91c6e92334725e41 | MATLAB | 4,372 | 80 | function [S,t,f,Serr]=mtspecgramtrigc(data,E,win,movingwin,params)
% Multi-taper event triggered time-frequency spectrum - continuous process
%
% Usage:
%
% [S,t,f,Serr]=mtspecgramtrigc(data,E,win,movingwin,params)
% Input:
% Note units have to be consistent. Thus, if movingwin is in seconds, Fs
% has to be in... |
eaef667c27cfacc732aa6ba9222e3c9c06f104bb069bab44cc301d0162258b0f | MATLAB | 4,372 | 118 | function [anmlROIbyStim,stimTable] = anmlROIbyStimTable(animal,tifFileListStim,moCorROI,tifStimParamTable)
%sort responses from all ROI for a given stim
%into a table of animal ROIs by stim parameters
if isfield(tifFileListStim,'fissaFroi')
FISSA = true;
else
FISSA = false;
end
tifStimParamT... |
b3a58cb052c43c0a1dfa16c1253a29f329c84ebd75d71551bf9df47e1cac4bd0 | MATLAB | 4,374 | 135 | %% Batch MGH to SamSrf MAT conversion (auto-discover subjects)
clear all; clc;
% Set environment
setenv('FREESURFER_HOME','/tools/freesurfer');
setenv('FSLDIR','/tools/fsl');
% Setup paths
p.Home = '/egor2/egor/MovieProject2';
p.FS_subDIR = [p.Home '/bids_data/derivatives/freesurfer'];
p.retinoDIR = [p.Home '/bids_da... |
2701a587fe71f32668337aa48bfa4fb6ec6f4b5bb902b0cfb9b63d2fd7d21a79 | MATLAB | 4,375 | 128 | function ea_synctrajectoryhandles(handles,obj)
% set handles to match obj
% set coordinates
if obj.hasPlanning
set(handles.targetX,'String',num2str(obj.target.target(1))); set(handles.targetY,'String',num2str(obj.target.target(2))); set(handles.targetZ,'String',num2str(obj.target.target(3)));
set(handles.entryX,'Strin... |
93fc4e93307dbaf4ed6c1be8f384fb2f96ac5da77b97e283576808d68e6c0fae | MATLAB | 4,375 | 163 | function varargout=shadedErrorBar(x,y,errBar,lineProps,transparent)
% function H=shadedErrorBar(x,y,errBar,lineProps,transparent)
%
% Purpose
% Makes a 2-d line plot with a pretty shaded error bar made
% using patch. Error bar color is chosen automatically.
%
% Inputs
% x - vector of x values [optional, can be left em... |
e83faca8ba2ca2bad89914efb8834e95dec76d6a5ec16408bbee992b882a29de | MATLAB | 4,375 | 94 | % std_renameclust() - Commandline function, to rename clusters using specified (mnemonic) names.
% Usage:
% >> [STUDY] = std_renameclust(STUDY, ALLEEG, cluster, new_name);
% Inputs:
% STUDY - EEGLAB STUDY set comprising some or all of the EEG datasets in ALLEEG.
% ALLEEG - global ... |
55ed49521269187ddffb78a34952418cb717d96a987f3e94ed332f6b7dd70d4f | MATLAB | 4,377 | 122 | function [status,interval,index,bounds] = InIntervals2(values,intervals,varargin)
%InIntervals - Test which values fall in a list of intervals.
%
% USAGE
%
% [status,interval,index] = InIntervals(values,intervals,<options>)
%
% values values to test (these need not be ordered)
% intervals list ... |
50cabba78c9bb1de26a8c3d7d8d4b655ac10578f5a62791ac284361b835a425e | MATLAB | 4,379 | 130 | % Name: Robert Kim
% Date: 11-15-2023
% Email: robert.f.kim@gmail.com
% plot_one_modality.m
% Description: Render the 4x4 lesion-effect boxplot grid for the one-layer
% one-modality (instr) RNNs (Fig. 5). Reads the per-lesion .mat files written
% by one_modality_one_layer_lesion_across_models.m and runs a Wilcoxon
% si... |
c85208502b04fa4704e5cff95e4de30b3013dc07c6557d005e6e9444c9272e34 | MATLAB | 4,379 | 135 | function [confC,phistd,Cerr]=coherr(C,J1,J2,err,trialave,numsp1,numsp2)
% Function to compute lower and upper confidence intervals on the coherency
% given the tapered fourier transforms, errchk, trialave.
%
% Usage: [confC,phistd,Cerr]=coherr(C,J1,J2,err,trialave,numsp1,numsp2)
% Inputs:
% C - coherence
% J1,J2 -... |
f4e009f04d71ca966fcae8e7623a3be7ca8444dac0aa9026839d708f0acf397d | MATLAB | 4,380 | 142 | function maxb = palm_maxshuf(Ptree,stype,uselog)
% Computes the maximum number of possible permutations given
% a tree that specifies the depencence between the observations.
%
% Usage:
% maxb = palm_maxshuf(Ptree,ptype,uselog)
%
% - Ptree : Permutation tree, generated by palm_tree.
% - stype : Shuffling type to cou... |
0b7727448d054f9f825e480d7f0809922d79ea8ff322468b867c3d8fc4afc1d6 | MATLAB | 4,381 | 121 | % eeg_oldica() - report, return or add to oldicaweights and oldicasphere
% stored in cell arrays in EEG.etc of an EEGLAB dataset
% Usage:
% >> eeg_oldica(EEG); % report number of stored oldicaweights
% >> [EEG,icaweights, icasphere] = eeg_oldica(EEG,N); % return matrices
% >> EEG... |
4af5c4e6c0fa58d17be2a7e02a5dd92a0f15ff4035eb3e3d2520ed41962585f5 | MATLAB | 4,381 | 127 | % std_readspecgram() - returns the stored mean power spectrogram for an ICA component
% or a data channel in a specified dataset. The spectrogram is
% assumed to have been saved in a Matlab file,
% "[dataset_name].datspecgram", in the same
% direct... |
e52f72d7c71a8278f58600280d255d5798e35e8035445392e04eff8b78c1064d | MATLAB | 4,381 | 136 | function [a,varargout] = Insets(location,s,varargin)
%Insets - Create insets in current axes.
%
% Create insets (= small figures) in current axes. Insets are laid out side
% by side from left to right. The number of insets is determined by the
% number of output parameters.
%
% USAGE
%
% [a,b,...] = Insets(loca... |
212ffed5f52542b667f0b1c7bb6a390bbbe8ff23b9aaae13f20b2da17bbf41ef | MATLAB | 4,382 | 108 | % std_prepare_neighbors() - prepare Fieldtrip channel neighbor structure.
% Only prepare the structure if necessary based
% on statistical options in STUDY.etc.statistics.
% Use the 'force' option to force preparing the
% ... |
ddc62665eb7fd2bf23b6aede0ab58ae105c76140e68f9aeadb5cd01172254327 | MATLAB | 4,382 | 132 | function CBIG_pMFM_step5_generate_STDFCD_correlation_Schaefer100()
% This function is used to generate the correlation between the empirical
% and simualted SWSTD of timecourse. The results corresponds to the figure
% S9A, S9B and S9C in the paper.
%
% There is no input for this function as it can automatically get th... |
ad3974f8dde89e6323b0cc7abf95e0b7c497af9516970553ba315c987303d3b6 | MATLAB | 4,383 | 89 | function ephysProperties = computeAllEphysProperties(spikeTimes_samples, spikeTemplates, templateWaveforms,...
templateAmplitudes, pcFeatures, channelPositions, paramEP, savePath)
ephysProperties = struct;
% get unit max channels
maxChannels = bc.qm.helpers.getWaveformMaxChannel(templateWaveforms);
% extract an... |
f51126cf1d9adae0a924fdc6751ab84efaf8663d7b16106ad85e04acb3d81aa0 | MATLAB | 4,383 | 141 | function f = DBGetFigures(query,varargin)
%DBGetFigures - Get all figures that match given criteria.
%
% Open figures and get related information such as code used to generate them.
%
% USAGE
%
% f = DBGetFigures(query,<options>)
%
% query optional figure list query (WHERE clause; see Example)
% <op... |
1b9fde99c2c39e52a7959d83e89a1c3c0bdbc068cf5fe864dc88f0d7f95c4776 | MATLAB | 4,385 | 112 | function [T1d_val, fit_info] = cal_T1d_analytical(R_dosl, B1, B0, varargin)
% FIT_T1D_SINGLE_POINT - Single-point T1d parameter fitting
%
% Input Parameters (Scalar):
% R_dosl - Observed R_dosl value (numeric)
% B1 - B1 correction factor (numeric, 1.0 = nominal)
% B0 - B0 offset (numeric, Hz, ... |
8c79c9526d5805b3f1d7d1dd27144ebe5355d97179d7c887f66490c883e555e7 | MATLAB | 4,385 | 128 | % FEASCPX Generates a random sparse optimization problem with
% linear, quadratic and semi-definite constraints. Output
% can be used by SEDUMI. Includes complex-valued data.
%
% The following two lines are typical:
% > [AT,B,C,K] = FEASCPX;
% > [X,Y,INFO] = SEDUMI(AT,B,C,K);
%
% An extended version is:
% > [AT... |
52200b79cd8869f8883cf90d1263e0652837d4d630b59fb7a3812d1192dd2b1b | MATLAB | 4,387 | 76 | function [S,t,f,R,Serr]=mtspecgramtrigpb(data,E,win,movingwin,params,fscorr)
% Multi-taper event triggered time-frequency spectrum - binned point process
%
% Usage:
%
% [S,t,f,R,Serr]=mtspecgramtrigpb(data,E,win,movingwin,params,fscorr)
% Input:
% data (single channel data vector) -- required
% ... |
b57b61d1d40489955a9dc498401a4de309846e37c6e9621243bb12cbd03598da | MATLAB | 4,387 | 86 | % same as demo.m and demo_1p.m but using the MotionCorrection object. Scroll at the end
% to the 1p example
clear
gcp;
name = 'granule_love2.tif'; % two photon dataset
if ~exist(name,'file') % download file if it doesn't exist in the directory
url = 'https://www.dropbox.com/s/mjmtwn4pdgydkny/gran... |
ac538dbd05e92d5ab8d0f90f29cef8b663ba887e98a9358db747f723ed81d7cf | MATLAB | 4,388 | 103 | function [ft_struct] = RFT_clean_asr_combined_trials_ftstruct(ft_struct,eeglab_template_file, ft_template_file, cutoff,windowlen,ref_maxbadchannels,ref_tolerances)
%%% From a fieldtrip structure (with N trials), concatenates all trials,
%%% create an eeglab structure with this 'single concatenated trial',
... |
4313e39067d7f2e8dde9a0b714eacf3ef26d00627d7e3f598ab4c4906a29f9b8 | MATLAB | 4,389 | 117 | function varargout = attributes(varargin)
% XMLTREE/ATTRIBUTES Method (handle attributes of an element node)
% FORMAT varargout = attributes(varargin)
%
% tree - XMLTree object
% method - 'set','get','add','del' or 'length'
% uid - the UID of an element node
% n - indice of the attribute
% key ... |
edd7496a6d8283c218eab146ab2c7bca586a47e889b9e756d4daae93a294fbc6 | MATLAB | 4,389 | 131 | function affinefile = ea_brainsfit(varargin)
% Wrapper for BRAINSFit
fixedVolume = varargin{1};
movingVolume = varargin{2};
outputVolume = varargin{3};
if nargin >= 4
writeoutmat = varargin{4};
else
writeoutmat = 1;
end
if nargin >= 5
if isempty(varargin{5}) % [] or {} or ''
otherfiles = {};
... |
ee1153ff3cf5c208cbd248109605b0eedfea6454ce669ff11a8a3f5d828ec9fb | MATLAB | 4,390 | 122 | clc
clear
close all
% -------------------------------------------------------------------------
% Script description:
% This script performs a bootstrap analysis comparing multiple time points
% of neural data between two conditions (e.g., control vs. test).
%
% Input requirements:
% - Two Excel files (one for each g... |
5706eddbed2ba39c3158435bcf90aa6c688e69046421db282042bc4e95b033b3 | MATLAB | 4,395 | 140 | function [legend_h,object_h,plot_h,text_strings] = ea_columnlegend(numcolumns, data, str, varargin)
%
% columnlegend creates a legend with a specified number of columns.
%
% columnlegend(numcolumns, str, varargin)
% numcolumns - number of columns in the legend
% str - cell array of strings for the le... |
d6f375e7ad42e04986ff90a4973824f5d3ca167dcde4d3c8454297cea0ed23e3 | MATLAB | 4,395 | 90 | function done = ea_coregpostopmr(options)
% Entry function to coregister post-op MRI to pre-op MRI
done = 0;
% Set fixed anchor image
anchor = options.subj.preopAnat.(options.subj.AnchorModality).coreg;
% Post-op MR modalities
postopModality = fieldnames(options.subj.postopAnat);
% Set moving and output image
movin... |
63ca722c8b07fdbf3d9f2165af0f48bb66f6e530c9c11a748e4d8af5baa81afe | MATLAB | 4,398 | 111 | function out = LaBGAScore_pdm_report(pdm, dat_template, condir, varargin)
% LaBGAScore_pdm_report Report thresholded PDM maps the way c2a reports GLM maps.
%
% The PDM toolbox writes weight images and little else: plotPDM gives a bare
% montage with no labelling, no region table, and no per-region detail. Second
% lev... |
d4b6f8637b9f5dd731c5991939e6fa44d6e608d0155d82cf92adb35a112d5ee0 | MATLAB | 4,402 | 136 | function obj=stat_bin2d(obj,varargin)
% stat_bin2d() Makes 2D bins of X and Y data and displays count
%
% Parameters as 'name',value pairs:
% - 'nbins': Array in the form of [nxbins nybins] to set the
% number of bins in each dimension
% - 'edges': Cell in the form of {[x__edges] [y_edges]} to set
% custom bin edges fo... |
9d579811137dbf9849bdef6fbf9346c00d0b1c85d278f08cfc7a142056b80dd8 | MATLAB | 4,403 | 130 | % Minimize order of a linear phase lowpass FIR filter
% "Filter design" lecture notes (EE364) by S. Boyd
% (figures are generated)
%
% Designs a linear phase FIR lowpass filter such that it:
% - minimizes the filter order
% - has a constraint on the maximum passband ripple
% - has a constraint on the maximum stopband a... |
42472734452639013d4f285c86d2ba3531c474bdafcf00c14156cdae014d1a74 | MATLAB | 4,406 | 129 | function [reduced_binned_data, reduced_binned_labels] = reduce_data_to_particular_trials(binned_data, binned_labels, labels_for_determing_which_trial_to_use, label_names_to_use)
% This function will reduce the binned_data and binned_labels so that only trials that match particular criteria are used.
% In particular... |
540f9d378c2822fe5bf0929e8261f91e7212ee24ae18712313f8f34ea6b41cf3 | MATLAB | 4,406 | 97 | function [S,t,f,Serr]=mtspecgramc_slow(data,movingwin,params)
% Multi-taper time-frequency spectrum - continuous process
%
% Usage:
% [S,t,f,Serr]=mtspecgramc(data,movingwin,params)
% Input:
% Note units have to be consistent. Thus, if movingwin is in seconds, Fs
% has to be in Hz. see chronux.m for more information.
... |
595f58950737e045630a755767688b7d74bb340b911269879bee3e02f6cfdb84 | MATLAB | 4,406 | 125 | function [h,c]=parsePrairieXML(dname,config_flag)
% Usage ... header=parsePrairieXLM(fname)
% Requires xml_io library
% Returns a simplified structure that serves as a header
do_ver=5;
if nargin<2, config_flag=0; end;
%disp(sprintf(' config_flag= %d',config_flag));
if ~(strcmp(dname(end-3:end),'.xml')|str... |
88da3773e561d39715e23df86923baba31f9d9ddef05179cc01c7336da057b75 | MATLAB | 4,406 | 129 | function s = convert(tree,uid,varargin)
% XMLTREE/CONVERT Convert an XML tree into a structure
%
% tree - XMLTree object
% uid - uid of the root of the subtree, if provided.
% Default is root
% s - converted structure
%
% Convert an XMLTree into a structure, when possible.
% When several ide... |
ecd91ab39edc01f588b1db0f3d8c30175e6091fea421409c1a379bdb787c9639 | MATLAB | 4,406 | 144 | function hpol = draw_polar_axes(cax,maxrho)
%Modified version of Matlab's internal polar axis creation function
%that draws the polar axes at the back of an existing figure
% get hold state
%cax = newplot;
next = lower(get(cax, 'NextPlot'));
%hold_state = ishold(cax);
% get x-axis text color so grid is in same color... |
433719532e180642dc4a4aec035064b291da0b07160425a0f883acb536d44802 | MATLAB | 4,408 | 107 | function [slice,boundbox,boundboxmm,sampleheight]=ea_sample_slice(vol,tracor,wsize,voxmm,coords,el)
% function samples a slice from nifti image based on coordinates and the
% wsize parameter (will use coordinate and sample a square that is 2xwsize
% long in distances). wsize can be given as mm or voxel distance (defin... |
9101f1a913637d0acce7b68e1336640b89c9dcbb805c9a7882124cfd809d3b53 | MATLAB | 4,414 | 125 | function [NiiFileOut,FlipB] = LeG_rotateImg2Standard(NiiFile,varargin)
%Performs 90 deg rotations to place image in standard space with dim1 (x ->
%saggital plane), dim2 (y -> coronal plane), dim3 (z -> axial plane). Finds
%matrix to transform nifti affine matrix to identity matrix with 1st dim
%mirrored ([-1 0 0; ... |
ba4e49fe98d611df876dd379870ecfa2d5a2dc9faaf18f77ddac4fdec8f1daf9 | MATLAB | 4,416 | 93 | function [S,t,f,Serr]=mtspecgramc(data,movingwin,params)
% Multi-taper time-frequency spectrum - continuous process
%
% Usage:
% [S,t,f,Serr]=mtspecgramc(data,movingwin,params)
% Input:
% Note units have to be consistent. Thus, if movingwin is in seconds, Fs
% has to be in Hz. see chronux.m for more information.
% ... |
73ecaf5de8b69268bc0b605cb54943bc98b1accdbd472f8cccafc6a9fbb7e931 | MATLAB | 4,422 | 97 | function DTI_data_name = ea_prepare_DTI(options,outputPaths)
% Warp and recompute DTI for native space modeling, otherwise just copy for
% templates/.
% By Butenko and Li, konstantinmgtu@gmail.com
arguments
options % Lead-DBS options for electrode reconstruction and stimulation
outputPaths % various paths ... |
bb123424f330711ad0a39429049cb0cb369e0e1db434ed96ef3339f10e300e4d | MATLAB | 4,422 | 114 | function [relativeShift,absoluteShift,xc] = FieldShift(control,test,varargin)
%FieldShift - Estimate firing field shifts between two conditions.
%
% For each place cell, the absolute field shift between the two conditions is
% estimated as the mode of the spatial cross-correlogram between the
% respective firing fi... |
22553d7207de429f38fbd41d45084ff52be08a8400298b9b800b49efe0fe8bd0 | MATLAB | 4,425 | 178 | function [cor, lags] = CrossCorr(ts1, varargin)
% [acor, lag] = CMBHOME.Spike.CrossCorr(ts1)
% [xcor, lag] = CMBHOME.Spike.CrossCorr(ts1, ts2, varargin)
%
% Calculates cross correlation (or auto correlation) for vectors ts1 and
% ts2 of spike times. ts1 and ts2 are not binned, or binary, spike trains but
% rather the t... |
f20a582d9d2573b27a5b43c0028f84a251ab8b626b31f21ac2755929eee8ef86 | MATLAB | 4,425 | 155 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% creates the c-code of the modelsignal correlation
% and returns the matrix needed to map the signal onto approaximation
% coeffcients
function Bm = createModelSignalLUT(ten,Pstruc,fixedTissuePrior,sinterp,fid,verbose)
maxorder = Pstruc.ordermax(3);
pp = P... |
7276aba7ea1a910f3bb87d9b29510ea7c4fe887ac980e56eb262cd960ed616f8 | MATLAB | 4,426 | 79 | function [vatfv,vatvolume,source_efield_side_source,source_vta_side_source] = ea_convert_ossdbs_VTAs(options,settings,side,multiSourceMode, source_use_index,outputPaths)
% Prepare Lead-DBS BIDS format VATs.
% By Butenko and Li, konstantinmgtu@gmail.com
arguments
options % Lead-DBS options for electrode... |
fee7742610866bd3e9cd7db0fa05b53d86241d100c7b8e241ecaf603d8c85414 | MATLAB | 4,428 | 141 | % anova1_cell() - compute F-values in cell array using ANOVA.
%
% Usage:
% >> [F df] = anova1_cell( data );
%
% Inputs:
% data = data consisting of PAIRED arrays to be compared. The last
% dimension of the data array is used to compute ANOVA.
% Outputs:
% F - F-value
% df - degree of f... |
c623e089d3ee17a7dbd9d8d716184ec83271efb5e16c56c55d92effe1cc54733 | MATLAB | 4,429 | 138 | function [count edges mid loc] = histcn(X, varargin)
% function [count edges mid loc] = histcn(X, edge1, edge2, ..., edgeN)
%
% Purpose: compute n-dimensional histogram
%
% INPUT
% - X: is (M x N) array, represents M data points in R^N
% - edgek: are the bin vectors on dimension k, k=1...N.
% If it is a... |
13657461e105b55bcacb4356d6592ab0fce2d93c115fc36549b978bbf0f72c1c | MATLAB | 4,432 | 136 | function [pnt, tri, nrm] = read_stl(filename)
% READ_STL reads a triangulation from an ascii or binary *.stl file, which
% is a file format native to the stereolithography CAD software created by
% 3D Systems.
%
% Use as
% [pnt, tri, nrm] = read_stl(filename)
%
% The format is described at http://en.wikipedia.org/wi... |
753e86340a51fc6c376aeecee21e72de4bc6bfda1e0dfaf2e99c7d43a413e467 | MATLAB | 4,433 | 123 | function [X,Z,eCm,eCx] = palm_partition(M,C,meth,Y)
% Partition a design matrix into regressors of interest and
% nuisance according to a given contrast.
%
% Usage
% [X,Z] = palm_partition(M,C,meth,Y)
%
% Inputs:
% M : Design matrix, to be partitioned.
% C : Contrast that will define the partitioning.
% meth : ... |
6bbd72c1495b5fe07764d779c1cb05fdf966a04c4433972ddfe4b313edb3f490 | MATLAB | 4,434 | 110 | function [otu_scale,X,F_hat_prime,growth_mean_p,growth_std_p,self_reg_mean_p,interact_std_p,deriv_std,perturb_std_p] = estMatricesHyperparameters(f,df_dt,intervene_matrix,rescale,perturbations)
% This file is a part of the MDSINE program.
%
% MDSINE: Microbial Dynamical Systems INference Engine
% Infers dynamical s... |
0e049d89c705ffb25c929396e0b09be215ff37a5c4bf697dbfe6bcf7876ce904 | MATLAB | 4,435 | 92 | function [p, ADJ, NULL] = CBIG_ASDf_FCDiffInSubgrp_NBS(tThresh, id_asd_subgrp_file, ...
id_con_subgrp_file, id_asd_file, id_con_file, Nperm, output_name)
% [p, ADJ, NULL] = CBIG_ASDf_FCDiffInSubgrp_NBS(tThresh, id_asd_subgrp_file,
% id_con_subgrp_file, id_asd_file, id_con_file, Nperm, output_name)
%
% This function co... |
4b5ecbc6d20efb6278e8f6adff56043e2462b2ff3fb5840c12ca8fa2ed4780a8 | MATLAB | 4,436 | 185 | function y=getStkMaskTC(stk,mask,norm,dparms,fparms)
% Usage ... y=getStkMaskTC(stk,mask,norm_or_#ims,dparms,fparms)
%
% Get time series from STK based on Mask
% Use range in norm for normalization
% dparms=[dord drange]
% fparms=[fco fw];
if nargin<5, fparms=[]; end;
if nargin<4, dparms=[]; end;
if nargin<3... |
4175acd5eed3b3a2bc907be4e7b7cdf29030853828f4678aef81f51cdc4c5e02 | MATLAB | 4,437 | 140 | % varimax() - Perform orthogonal Varimax rotation on rows of a data
% matrix.
%
% Usage: >> V = varimax(data);
% >> [V,rotdata] = varimax(data,tol);
% >> [V,rotdata] = varimax(data,tol,'noreorder')
%
% Inputs:
% data - data matrix
% tol - set the termination tolerance to ... |
7e3762578b2bcdbebb88ce2e163726f721bc0d14433c6915302b1ed7dfabf3d8 | MATLAB | 4,437 | 174 | function gmsh_mesh3d_write ( gmsh_filename, m, node_num, node_x, ...
element_order, element_num, element_node )
%*****************************************************************************80
%
%% GMSH_MESH3D_WRITE writes 3D mesh data as a Gmsh mesh file.
%
% Discussion:
%
% The node ordering for the 20 node el... |
033045878937bd9f25dc3862521326110ea59448fbf5fa8dfffab78b67bd2303 | MATLAB | 4,438 | 114 | % Name: Robert Kim
% Email: robert.f.kim@gmail.com
% plot_svm_decoding.m
% Description: Plot the SVM-decoding time courses for the intact vs.
% lesioned two-layer one-modality (instr) RNNs, averaged across the layer-1
% (sensory) population. Adds shaded SEM bands and overlays cluster-corrected
% significance markers (v... |
fbbce366f1c503054a34cc67d2322c8804c6dc514b6b3b986d2bc3cde0fa07a8 | MATLAB | 4,439 | 128 | function obj=geom_polygon(obj,varargin)
% geom_polygon Create reference polygons in each facet
%
% This function allows to draw polygons in the background of each facet.
% Inputs are given as 'name',value pairs:
%
% 'x' Cell array of vectors containing x coordinates
% 'y' Cell array of vectors containing y c... |
96c226b0b2120a77dc4e027c73bcb37893fe555404972ed079c24220c049ef0b | MATLAB | 4,441 | 143 | function [mode_activity, sim_activity] = model_neural_waves(eig_vec, eig_val, ext_input, param, method)
% model_neural_waves.m
%
% Simulate neural waves on a surface using eigenmodes.
%
% Inputs: eig_vec : eigenvectors (eigenmodes) [V x num_modes]
% V = number of vertices
% ... |
1bcffcb346600e2efa06fa08a3e49276ff867f5ab18bcc2e8ac2edf20cf452f5 | MATLAB | 4,442 | 136 | function [spk_xcorr, lags, epoch, std_error] = spk_xcorr(self, cells, max_lag, t_bin, average_epochs, norm)
% Returns the unbiased crosscorrelation, or autocorrelation
%
% ARGUMENTS
% cells a Nx2 (N=1 or 2) array of cells for which to
% calculate xcorr. if N=1,... |
a47bf07ef271582fb73f296dbdb4a720a12ef41c33b108d307d7bdd249f9dedf | MATLAB | 4,443 | 83 | function [S,f,R,Serr]=mtspectrumpt(data,params,fscorr,t)
% Multi-taper spectrum - point process times
%
% Usage:
%
% [S,f,R,Serr]=mtspectrumpt(data,params,fscorr,t)
% Input:
% data (structure array of spike times with dimension channels/trials;
% also accepts 1d array of spike t... |
ccfd15b6faf21b5fe82172daadd5959e5ed1cdf338791bc8a3f090c03c94e492 | MATLAB | 4,443 | 127 | function thresholdValue = thresholdFluorescenceImage(imageIn,showPlots,noisy)
%
% thresholdValue = thresholdFluorescenceImage(imageIn)
%
% thresholdValue = thresholdFluorescenceImage(imageIn,showPlots,noisy)
%
% This function selects a threshold for the input fluorescence image by
% analyzing the image's int... |
3c7e517298f739e895980ec41f0bf9a025d325a8f1b5515e35e7dc9c56eb90e8 | MATLAB | 4,444 | 86 | % eegplugin_dipfit() - DIPFIT plugin version 2.0 for EEGLAB menu.
% DIPFIT is the dipole fitting Matlab Toolbox of
% Robert Oostenveld (in collaboration with A. Delorme).
%
% Usage:
% >> eegplugin_dipfit(fig, trystrs, catchstrs);
%
% Inputs:
% fig - [integer] eegla... |
9c270ef45281a3e65dd1f6c8bf517c060a35ff1ad2502c1fbef40ae59a3a8f7e | MATLAB | 4,445 | 104 | % 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... |
a6e40e4a7d060f26dae0c164b506817ebf5fae7b09a08fd28eb3d9b917e34eea | MATLAB | 4,447 | 130 | function ea_compute_pathways_recruitment(connectome_name,stim_prot_file,pat_folder,stim_folder,side,VAT_thresh)
%% Compute pathway recruitment based on VAT
% The results are used to train ANN
% Iterate over Current_protocols_' + str(side) + '.csv
% Save results in Activations_over_StimSets
% Currently, OSS-DBS file st... |
17f3ba5a7616573c7e4a7338b4e73114ae692c7921432b866e8a3a6e2ba50954 | MATLAB | 4,452 | 129 | function y = polyval( p, x )
% Disciplined convex/geometric programming information for POLYVAL:
% POLYVAL can be used with CVX variables in two ways:
% -- If P is constant and X is a variable, then POLYVAL(P,X)
% represents a polynomial function of X, p(X). If p(X) is affine
% then t... |
9139f364f71f7257539592d0a7e1078ce918109cf4ab75fd3e2b54d68e6e7068 | MATLAB | 4,452 | 115 | function [Sc,Cmat,Ctot,Cvec,Cent,f]=CrossSpecMatpb(data,win,params)
%
%
% Multi-taper cross-spectral matrix - another routine, this one allows for multiple trials and channels
% Does not do confidence intervals.
% Also this routine always averages over trials - binned point process
%
% Usage:
%
% [Sc,Cmat,Ctot,Cvec,C... |
3d043dc379646d283af193bf94ac631c46741c82c53e83bd87d11bf4128c5038 | MATLAB | 4,454 | 163 | function M = quickCV_PLSDA_core(X, Y, C, opts, metric)
% quickCV_PLSDA_core Fast tuned cross-validated AUC for PLS-DA.
%
% M = quickCV_PLSDA_core(X, Y, C, opts, metric)
%
% Single (non-repeated) stratified K-fold cross-validation with train-only
% preprocessing and inner-CV selection of the number of latent vari... |
5bcd70c9540011b393cb351a1423efaa63be5d20fae519a78d3f736db1bb94ea | MATLAB | 4,454 | 109 | function [spatialDecaySlope, spatialDecayFit, spatialDecayPoints, spatialDecayPoints_loc, estimatedUnitXY] = ...
getSpatialDecay(templateWaveforms, thisUnit, maxChannel, channelPositions, linearFit, normalizePoints, computeSpatialDecay)
% QQ need to change this to be an exponential fit !
% Set default values and va... |
1d39563148618560649cef07928cc3fb78f1b6333a308840b04cf3aac5490469 | MATLAB | 4,458 | 125 | function [behavior] = bz_getJumpBehav(pos)
if nanstd(pos(:,8)) < 10
pos(:,8:10) = pos(:,8:10)*1000;
end
p = pos(:,[8 10]);
behavior = pos2behav(pos,'behavType','jump');
p(:,1) = smoothts(p(:,1),'b',40);
p(:,2) = smoothts(p(:,2),'b',40);
% subplot(2,2,1)
% scatter(pos(:,10),pos(:,8),'.')
% [x y] = ginput();
... |
c5049fa0a6fc85016ea981f2d2159cba6dfbb711a1a147b9d0293907e9fb656a | MATLAB | 4,459 | 133 | % projtopo() - plot projections of one or more ICA components along with
% the original data in a 2-d topographic array. Returns
% the data plotted. Click on subplot to examine separately.
% Usage:
% >> [projdata] = projtopo(data,weights,[compnums],'chan_locs',...
% ... |
8eeb35f82baafbedd7c365f557ded55ac5bce5becb13c25676d28a8aaea20905 | MATLAB | 4,460 | 119 | function [fps, w1, w2] = call_gaussfilt(handles)
mainfig_pos = get(handles.mainfigure, 'Position');
defaultPara = handles.defaultPara.Denoise.gaussfilt;
fps = defaultPara(1);
w1 = defaultPara(2);
w2 = defaultPara(3);
% fps = 10;
handles = loadtrace(handles, 1);
[trace_stamp, trace_num, t... |
b9931f2bb9e2624382a71ce3eea313903657976b3807c9ef80028f21b2d2fa65 | MATLAB | 4,461 | 104 | function varargout=ea_ft_globaltracking_reisert(options)
% __________________________________________________________________________________
% Copyright (C) 2014 Charite University Medicine Berlin, Movement Disorders Unit
% Andreas Horn
if ischar(options) % return name of method.
varargout{1}='Global Fibertrackin... |
bff0d84ac4d45ef8419d1996489ea8cae77b8c2da50320049347c0c47afe017d | MATLAB | 4,462 | 129 | function distanceTable = cellDistances(compiledData, outputFolder, options)
% CELLDISTANCES Calculate distance metrics for each tracked cell from
% compiled tracking data produced by compileResultsFromCSV.
%
% For each cell track, computes cumulative path length, average
% frame-to-frame displacement, net displacement,... |
3bf11d089e3d822444a8739f048db629b32567360714783ea13cce6a3cfafe7e | MATLAB | 4,463 | 140 |
function [digitalIn] = bz_getDigitalIn(ch,varargin)
% [pul, val, dur] = getPulses(d,varargin)
%
% Find digital In pulses
%
% INPUTS
% ch Default all.
% <OPTIONALS>
% fs Sampling frequency (in Hz), default 30000, or try to
% recover for rhd
% offset Offset subtracted (in seco... |
d052c9fe277eaff46e17011b0d3a05bebdf325ec9a7bfdc42bf1066bbbbb038f | MATLAB | 4,463 | 161 | %% Planar graphs in MatlabBGL
% In version 1.35.0, the Boost Graph Library added a large suite of planar
% graph algorithms.
%% Planarity testing
% Two functions help test if a graph is planar. The algorithm is the
% Boyer-Myrvold planarity tester.
K5 = clique_graph(5);
test_planar_graph(K5)
%%
% Of course K_5 isn... |
06d044c1d930f933599d10c8c2dc8ca9b1188829d9322a4db0c7ff2349934551 | MATLAB | 4,470 | 165 | function [ output_args ] = bz_LFPPowerDist( LFP,varargin )
% bz_LFPPowerDist(LFP) calculates the power distribution of an LFP signal.
% NOTE: THIS FUNCTION IS UNDER DEVELOPMENT. Feel free to chip in.
%
%INPUTS
% LFP [nt x 1] vector of the LFP signal -or- basename
% (optional)
% sf sampling frequen... |
eb8071d7ec9850f554ed4d7fe41631b6308c4e8a31c7d772c56956aff9a0dba3 | MATLAB | 4,473 | 140 | function z = power( x, y )
% Disciplined convex programming information for POWER (.^):
% When used in CVX expressions, either X or Y must be constant. Only
% certain convex or concave branches are accepted as valid:
% --- if both X and Y are constant, then Z = X.^Y is interpreted
% pre... |
35f8953ac694d5e8fcfc0a46f07ba4dbeb6a8f29c251cd8e2c88671698486260 | MATLAB | 4,475 | 138 | function [unsrtR,S,srtR] = palm_competitive(X,ord,mod)
% Sort a set of values and return their competition
% ranks, i.e., 1224, or the modified competition ranks,
% i.e. 1334. This makes difference only when there are
% ties in the data. The function returns the ranks in
% their original order as well as sorted.
%
% U... |
e398438e6dcc95b2299ef2eb667822153bc88c3d13d0d6310643f052b29def08 | MATLAB | 4,477 | 105 | function [counts,x_inds,y_inds] = histxy(x, y, varargin)
%HISTXY 2-Dimensional Density Histogram.
% COUNTS = HISTXY(X,Y,D), where X and Y are matrices of the same size,
% returns a D x D matrix COUNTS containing the numbers of points in a
% binned scatter plot of the entries of X vs the corresponding e... |
a3eecbd8902566052935e89dd17d2aa51103bcd05584e81f199b80ca2b349536 | MATLAB | 4,480 | 103 | function [vals,pvals] = ea_explorer_calcstats(obj,voxelsORfibers,patientselection,Outcome)
switch voxelsORfibers
case 'voxels'
myvals = cellfun(@full, obj.results.efield, 'Uni', 0);
case 'fibers'
myvals = cellfun(@full, obj.results.(ea_conn2connid(obj.connectome)).(ea_explorer_method2methodid(ob... |
0740769bc0a62388bbba4bf53453537fb9bb2cb0e2dce81cd6d528ab6b7d8931 | MATLAB | 4,487 | 105 | function [d, v,vfrm,y,y0, R] = sdinit(At,b,c,dense,K,pars)
% [d, v,vfrm,y,y0, R] = sdinit(At,b,c,dense,K,pars)
%
% SDINIT Initialize with identity solution, for self-dual model.
%
% ********** INTERNAL FUNCTION OF SEDUMI **********
%
% See also sedumi
% This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Rom... |
d60699dde968be164726d00ff77bbdea953f24ad81f375da6653964067b4105c | MATLAB | 4,487 | 119 | function [output]= CNMF_noparpoolAM(input, session)
%% load structure
foldername = input.foldername;
files = input.image;
listhdf5 = input.list;
ROI = input.ROI.file;
a = input.ROI.a;
FOV = input.param.FOV;
options = input.param.options;
tau = input.param.tau;
p = input.param.p;
merge_thr =input.param.merg... |
3ed4b07e7aead9a310ef5bb9f9b524748e13e5aee8041cd3fb85172647d4f917 | MATLAB | 4,493 | 189 | % Generate X Y Z coordinates of a 3D Bresenham's line between
% two given points.
%
% A very useful application of this algorithm can be found in the
% implementation of Fischer's Bresenham interpolation method in my
% another program that can rotate three dimensional image volume
% with an affine matrix:
% http... |
a79faa13ff686c2527c1d6a83794074c9750cbb7aefa2416da8adcc9c93b4be4 | MATLAB | 4,495 | 135 | function [rawfeatmaps, motionInfo] = getFeatureMaps( img , param , prevMotionInfo )
%
% this computes feature maps for each cannnel in featureChannels/
%
load mypath;
%%%%
%%%% STEP 1 : form image pyramid and prune levels if pyramid levels get too small.
%%%%
mymessage(param,'forming image pyramid\n');
levels = [ ... |
514729f83b9c9c57019a12f1e25276df910800dc211ecea55d61ab597f90f28b | MATLAB | 4,497 | 91 | function ClincFreq_WeiCentStat(outdirCent,OutWeiCentdir,SetUpPara,Para,AtlasTempU,dbmask)
IndirCent = [outdirCent,'sVolWeiCent',filesep];
[V,D,namelist] = Dynamic_read_dir_NIFTI_sparse(IndirCent);
D(isnan(D)) = 0;
D(isinf(D)) = 0;
dbmaskindn = find(dbmask==0);
% D = D>0;
for i = 1:length(SetUpPara.ParaOut)
... |
967396e97fef151bd2b0807ad6e916d2f0677011c86ba0d1468d59ec924f2528 | MATLAB | 4,497 | 111 | function varargout = nii_stc(nii, out, timing)
% Perform slice timing correction to the input NIfTI data.
%
% Syntax:
% nii_stc(filename_in, filename_out);
% nii_out = NII_STC(filename_in);
% nii_out = NII_STC(nii_in);
% nii_out = NII_STC(nii_in, [], FSL_slice_timing);
%
% The mandatory first input is a ... |
38f42f19a6d317ec35fdb42c260d6a494707137d2780de98dbcd2753f87ea86e | MATLAB | 4,498 | 157 | function [pval table] = circ_wwtest(varargin)
% [pval, table] = circ_wwtest(alpha, idx, [w])
% [pval, table] = circ_wwtest(alpha1, alpha2, [w1, w2])
% Parametric Watson-Williams multi-sample test for equal means. Can be
% used as a one-way ANOVA test for circular data.
%
% H0: the s populations have equal means
%... |
f9d8300b127e5e0397aed61ae2a9f0857fb32cd5cdfc626845c84817656b1a7a | MATLAB | 4,498 | 44 | function rval = rtest_3_cojocaru()
% The regression test for the bug reported by Radu Cojocaru on 9 November
% 2006. The error is getting erroneous edges in the minimum spanning tree.
% The cause of the error is that mst outputs exactly n-1 edges for the
% minimum spanning tree. However, if the graph is disconn... |
10dfc73c77c47f665041624e1b355f08da86831acfd6ffb108968507116b1cf6 | MATLAB | 4,499 | 137 | function [mask, weight]=mesh2mask(node,face,xi,yi,hf)
%
% [mask weight]=mesh2mask(node,face,Nxy)
% or
% [mask weight]=mesh2mask(node,face,[Nx,Ny])
% or
% [mask weight]=mesh2mask(node,face,xi,yi,hf)
%
% fast rasterization of a 2D mesh to an image with triangle index labels
%
% author: Qianqian Fang <fangq at nmr.mg... |
bf20f492cb0f37aeabd585cda104ff1470b56b1013bb24c7569348a9f1b223c9 | MATLAB | 4,499 | 88 | function SOFAinfo(Obj)
% SOFAinfo(Obj) gathers information about the SOFA object and display it.
% 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 E... |
00ec241c24c08a2261024f62151faf80a744445006cd5bb39a6dd6a61924f4fd | MATLAB | 4,503 | 97 | function [S,t,f,Serr]=mtspecgramc_slow(data,movingwin,params)
% Multi-taper time-frequency spectrum - continuous process
%
% Usage:
% [S,t,f,Serr]=mtspecgramc(data,movingwin,params)
% Input:
% Note units have to be consistent. Thus, if movingwin is in seconds, Fs
% has to be in Hz. see chronux.m for more inform... |
41ca303b672d8f5766388ce901ed3cf8af3c71239baeaed2164a08bc67e3b745 | MATLAB | 4,503 | 109 | % Preprocessing of the ear-EEG recordings.
%
% Requires the BBCI toolbox (https://github.com/bbci/bbci_public).
%
% For one recording day and one binary task pair, the script band-pass filters
% the continuous data, down-samples it, keeps the eight retroauricular
% channels, re-references each channel against the mean ... |
0e3e1c669be9e3b0af08f40b6610b626da5b518a9d83a4cd4bd678e94951f935 | MATLAB | 4,504 | 115 | % Name: Robert Kim
% Date: 05-12-2023
% Email: robert.f.kim@gmail.com
% fnc_instr2_neus.m
% Description: Identify task-selective (anti / pro) and cue-selective
% (cued / uncued modality) neurons in a trained two-modality (instr2) RNN.
% For each unit, runs Wilcoxon rank-sum tests on both axes and sorts it
% into one of... |
f3c3d3a2d1289c7f10cf7a5bba60d423bab1f3d77a7057dc15cd2bd0b46953f0 | MATLAB | 4,506 | 160 | function PlotCircularDistribution(dist,a,s,varargin)
%PlotCircularDistribution - Plot phase distribution and statistics.
%
% Plot one or more phase distributions as histograms and polar plots
% showing circular mean and resultant length. Dotted vectors indicate
% that the data is not significantly clustered around ... |
7804a0c678f3a0e88d7f07b5611ae4ea5a275112e627b0d097ea6765e20cc2ce | MATLAB | 4,509 | 93 | function [S,t,f,Serr]=mtspecgramc(data,movingwin,params)
% Multi-taper time-frequency spectrum - continuous process
%
% Usage:
% [S,t,f,Serr]=mtspecgramc(data,movingwin,params)
% Input:
% Note units have to be consistent. Thus, if movingwin is in seconds, Fs
% has to be in Hz. see chronux.m for more information... |
18cd4b9c83fb520db4afbaff1b1649da0f747cde6b6372151b552f575c81110d | MATLAB | 4,510 | 166 | function [dt1,dt2,Travel,index] = FitCCG(t,ccg,varargin)
%FitCCG - Fit dampened sinewave to the cross-correlogram of a pair of theta-modulated cells.
%
% USAGE
%
% [dt1,dt2,index] = FitCCG(t,ccg,<options>)
%
% t time bins
% ccg cross-correlogram
% <options> optional list of pr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.