sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
6f221925deffcf07051c6aa497099f9419fb11d2d4530e9df0f4b0d43caad397
MATLAB
2,517
84
function [gx,dG_dX,dG_dPhi] = g_fullDCM4fmri(Xt,Phi,ut,inG) % full DCM observation function (embedding dynamic Ballon model) % function [gx,dG_dX,dG_dPhi] = g_fullDCM4fmri(Xt,Phi,ut,inG) % This function evaluates the observation function of the neuronal level in % DCM for fMRI. Note that this "generalized" observation...
7244898bd427e859f19f47e66af8520d3dc02e354f542bd7444574b4d747ec5c
MATLAB
2,517
82
function Draw_ROIs_on_Cortex(Anat,ROI) % % This function will draw ROI spheres on a model of the cortical surface. % Anat is a structure that describes the anatomy. % ROI is a structure that describes the regions of interest. % % Anat fields: % CtxL mesh for left cortex. mesh includes 2 fields, nodes and % ...
01629be0ee705ca077930a70569a795e616e02e47e1174b18ac4024911e07e6c
MATLAB
2,518
76
% Code taken from Paul Scovanner's homepage: % http://www.cs.ucf.edu/~pscovann/ % Calculate 3D Sift % img is the input in question. % keypts is an Nx3 matrix of keypoints function keys = calculate_3DSIFT(img, keypts,skipDescriptor) %By default, we calculate the descriptor if nargin<3 skipDescriptor=false; end...
05a7b9206eb44d192e74aeb1b884a8a6c66ee9831c11446be97124056dce4256
MATLAB
2,518
55
function isom = calcIsomPerWatt(deviceSpectrum, photoreceptorSpectrum) %CALCISOMPERWATT Calculates the rate of photoreceptor isomerizations per watt. % This function computes the isomerization rate (isom) in photoreceptors % induced by a given light source, integrating the product of the device's % spectral power distr...
0dd81e9521cca63add4fb8d739b14d7bfec5fb2ee7b0e958e8d358e2a6f000cd
MATLAB
2,519
68
function [dat] = read_nihonkohden_m00(filename, begsample, endsample) % READ_NIHONKOHDEN_M00 reads data Nihon Kohden EEG system and converts the % floating point ASCII values to 16-bit signed integers from *.m00 file % format. This function is an adaptation of convert_nkascii2mat.m written % by Timothy Ellmore % % Use...
f078a5a82938b72801f5f50c87149c30d79e9987bd427cb0e02a338c538ab28c
MATLAB
2,519
80
clear;clc; %% parameters % -2e-3,-2e-3 % -2e-3,2e-3 params = struct('a',1.6e-2,'n',4,'beta',10,... 'ind_input',[11],'ind_output',[13,14],... 'u_input',[0,-0.005*9.8],'u_output',[0,1;0,0]); [DT,bonds] = Triangle(params); n_spring = size(bonds,1); w1 = 1.5*10^(-3);w2 = 2.5*10^(-3); thickness = 2*10^(-3); Y = 5.5...
e0b6a4392db7c646f7fccf848debeca7003728d2a418e3f86d74d72a16b10646
MATLAB
2,520
90
function simulatedAnnealingDemo2d() [XX, YY]=meshgrid(1:49,1:49); f = exp(-energySurface); % 49x49 grid % find maximum peak by exhaustive search M = max(f(:)); % 8.0752 [row,col] = find(f==M); % max row 38, col 25 fprintf('Search: max height = %5.3f at (%d, %d)\n', M, row, col); % simulated annealing setSeed(2); x...
f11d1037c53847ffedb38f7a38fe98f86825f9bae74673a5f35f29e6fd833bd6
MATLAB
2,520
73
% PadContinuousData.m % Sarah West % 8/4/22 % Pads continuous data to have speed, accel, duration, pupil diameter in % first - 4th entries of data, respectively. function [parameters] = PadContinuousData(parameters) MessageToUser('Padding ', parameters); % Make default empty data padded output = data. ...
47a9bddcdb26a66d20d14602b2035d096552efb2efa432bcb2599a12b40df29e
MATLAB
2,521
68
function visualizeGridPlot(puncta,transcript_object,params,fignum) figure(fignum); clf('reset') ha = tight_subplot(params.NUM_ROUNDS,params.NUM_CHANNELS+1,zeros(params.NUM_ROUNDS,2)+.01); subplot_idx = 1; for exp_idx = 1:params.NUM_ROUNDS punctaset_perround = squeeze...
a0da9fc121501bed8b925c0686ae470218e7d4b0aa0e0cc071dcde1b07be22f9
MATLAB
2,521
91
function swave=smoothwavelet(wave,dt,period,dj,scale) % Smoothing as in the appendix of Torrence and Webster "Inter decadal changes in the ENSO-Monsoon System" 1998 % % used in wavelet coherence calculations % % % Only applicable for the Morlet wavelet. % % (C) Aslak Grinsted 2002-2005 % % -------------------------...
ffa32b31d99dd0cf6880b52de1804db1ea76322df4dfd10e32bd97a6e4338657
MATLAB
2,521
95
% darkgreen and purple go together function out_color= get_color(col_name) if ~exist('col_name', 'var') co= get(gca, 'colororder'); col_num= get(gca, 'ColorOrderIndex'); out_color= co(col_num+1, :); elseif ischar(col_name) switch col_name case {'r', 'red'} out_color...
2c66b4e6d6b28b14d34373254066e05db7bfff5e3dadb41acbec9ec9e24edcdc
MATLAB
2,523
94
function [data_out,scales_out]=mri2mristandardori(data,ori,scales); % % transforms MRI-tensor data % into standard form, i.e. first index is % from right to left ear, second index from % front to back, and 3rd index from bottom to top. % % INPUT: % ori is a vector containing the 3 numbers 1,2, 3 % (eventually also...
ee5080735a12d367dee4e4403762e68b170a5f5f209264781dc71fd36cba11c8
MATLAB
2,523
42
function doc_log_likelihood = CBIG_EM_doc_log_likelihood_wc(w, paradigm, params, q) % doc_log_likelihood = CBIG_EM_doc_log_likelihood_wc(w, paradigm, params, q) % % Compute log likelihood of a single experiment (document) given the updated auxillary parameter q. % Note that compared to CBIG_EM_doc_log_likelihood_wc....
292b9728902c3b7a462840409e0172c5d5261fb0755089185232e64af895f762
MATLAB
2,524
71
% Handling for probability data/Samplings % common uses for the pxtDataCell, sdoMat, any use of the stirpd estimation %_______________________________________ % Copyright (C) 2024 Trevor S. Smith % Drexel University College of Medicine % % This program is free software: you can redistribute it and/or modify % it und...
dd86849a8258dcd4dbd605ae02947ecea0f790f844f8d4e601c6e02b57d02fc4
MATLAB
2,524
50
function [gx,gy_blips,gx_pre,gy_pre,gy_blip_up,gy_blip_down,adc,params] = create_epi_adc_pulseq(params) lims = params.gen.lims; gy_pre_area = -(params.gen.del_k(2)*params.gen.n(2)/2/params.epi.ry)*params.epi.pf; if params.epi.pf ~= 1; gy_pre_area = gy_pre_area+(gy_pre_area/4*-1); end gy_pre = mr....
6f46bc7cc7097dd67a032ba42ed067b3ee6f9287b623d2906c323b8f6fc5e0b7
MATLAB
2,525
76
%{ Copyright (c) 2025 Axion BioSystems, Inc. Contact: support@axion-biosystems.com All Rights Reserved %} classdef LedPosition %CHANNELMAPPING represents the Position and color of an LED on an %optical stimulation device. % % WellRow: Numeric representation of the well row (e.g....
e4019097c67695981536056393b40253845456b5279d62a163683dff1bc7f3c9
MATLAB
2,525
84
function data = load_data( filename, options ) % *SPONTANOEUS WAVES DEMO* % % LOAD DATA load LFP and spikes from SNL-R Utah array recordings % % INPUT % filename - /path/to/file % options - options structure (cf. spontaneous_waves_demo.m) % % OUTPUT % data(trial).x - datacube (rows,cols,timepts) % data(trial).spike...
e4c1e51cdd6dec61017f10dc460e1ee922e2cda29878b4c52b6bc5c70b9febff
MATLAB
2,525
88
% RSKELF_SPDIAG Extract diagonal using recursive skeletonization factorization % via sparse apply/solves. % % This algorithm computes each diagonal entry by multiplying from the left % and right by unit coordinate vectors, taking advantage of the sparsity of % each such operation. % % Typica...
6e5db77fdd4e1f7f89af7ab8621d915cbd726a646e1b9b1850580dbbf467df50
MATLAB
2,526
77
function [rho] = SourceAdvecDiff(rho0,u,r,nt,dt,par) % Created by Xinan Chen % This function returns the dynamic intensity rho(:,1~nt) following PDE % rho_t + grad(rho*u) = sigma*Laplacian(rho) + rho*r*K % rho(:,0) = rho0 % if K (chi) is not loaded, then assume K = identity %% rho(:,1...T) = transport (rho0 - initial ...
a3b39adaf29b72788939bf21dfe8b2f50784ea1d2d0510d2783495b91ea423d0
MATLAB
2,526
86
function [datacomp, minres2, bestiter, minconc2, mincomp2, minconc22, ... number_of_comp, List_of_Max_W, res_spec] = unmixing_components(numflur, wl, Y, iterations, fixedSpec) % Initialization and setting optimization parameters Y(isnan(Y)) = 0; opt = statset('Maxiter', 5000, 'Display', 'iter', 'TolX', 1e-6); min...
87c376c475da03c6fb5ea0f5df5e4ae3691bec3bfc83cabcf58ab85bab753ffc
MATLAB
2,527
80
function [frac_overlap,nnz1_all,nnz2_all] = analyze_AB_synapse_coloc(params,roi,chs) %created by M.E. Schroeder on 7/27/23 %calculates fraction of mutually overlapping volume for specified synaptic %and beta-amyloid channels WITHIN cropped beta-amyloid nanoclusters %calculates the fraction of channel 1 volume mutually ...
9aec937e44f240038f52b73f26e01a99fc51976cac2eba025b63d1e55695ec93
MATLAB
2,527
49
% Statistical Parametric Mapping % Version 7771 (SPM12) 13-Jan-20 %__________________________________________________________________________ % ___ ____ __ __ % / __)( _ \( \/ ) % \__ \ )___/ ) ( Statistical Parametric Mapping % (___/(__) (_/\/\_) SPM - https://www.fil.ion.ucl.ac.uk/spm/ %______________...
0f2e89397109ac97559b7a13b600babfae7fb4ea14009e544682c15f948bd255
MATLAB
2,528
118
function m=plotMarker(ind,LM) % plotMarker -- provide different marker % function m=plotMarker(ind) % % [Inputs] % ind: index for differnt marker % LM: index for line/marker change order (default=1: line fixed marker change) % % [Outputs] % m:marker % % % % Tomoyasu Horikawa horikawa-t@atr.jp 2012/11/28 % if ~ex...
456bab49a9679291265461564dac8148f3836ea95bb29644d8fc135fdabf27eb
MATLAB
2,529
92
function [CenterOfMass] = y_CenterOfMass_Surf(AtlasFile, SurfFile) % function [CenterOfMass] = y_CenterOfMass_Surf(AtlasFile, SurfFile) % Extract Eccentric Center of mass on surface % Input: % AtlasFile - the Atlas File % SurfFile - the Surface File % Output: % CenterOfMass - the Altals region table %____________...
30e947db2a4f94bca214d94053bf1e23fef1f92fbc735eee92aa56fb1e33fc1f
MATLAB
2,530
106
%% parameters x0 = 0; y0 = 0; theta0 = 0; T = 1000; dampen_pos = .25; dampen_theta = .5; sigma_pos = 10; sigma_theta = .05; % these are the parameters I use for tracking flies velocity_angle_weight = .03; max_velocity_angle_weight = .18; %% initialize x = nan(1,T); y = nan(1,T); theta = nan(1,T); x(1) = x0; y(1) =...
59e5e0f93c80f34b8320d67db958a4c4efd3505b532b031ac68bb89e4e852646
MATLAB
2,530
125
function event = read_micromed_event(trcfile) % reads the events of the Micromed TRC format files fid=fopen(trcfile,'r'); %------------------reading patient & recording info---------- fseek(fid,64,-1); surname=char(fread(fid,22,'char'))'; name=char(fread(fid,20,'char'))'; fseek(fid,128,-1); day=fread(fid,1,'char');...
a238aa9728cf7d90485a3e8b08bcb4bf2e74397dab43a3eb2b1152b5a6a3e480
MATLAB
2,530
60
function [ titlestr, settings, results ] = createNNGraphFromLabels( dataview, settings ) % Creates a nearest neighbour graph based on the given labels. % % This graph is computed using the Euclidean distance. % % See also dspace_graphs.RealtimeLabelBasedNNGraph. % % % %<PRE> ...
2d2c3566e45aae90b9f4d6312088bbf279bf5e0d4671748c2cb010ee37087929
MATLAB
2,531
77
% Purpose: Calculate network for each MS-HBM network % Inputs: Hungarian-matched individual network parcellations % Outputs: rh_labels and lh_labels containing overlap values for % each network % % Written by M. Peterson, Nielsen Brain and Behavior Lab, under MIT License % 2024 % To run: % 1. Claim computing resourc...
522855b96356ec7eea2f60fd1482622e20e67e37f8de37fe9043ac4e8c3600a0
MATLAB
2,531
172
clear clc close all rat='P100'; rat=rat(2:end); rat=str2double(rat); load data/combined_kernels.mat %%% (generated by combine_neural_kernels.m) data=data_all_trials; data.centers=-1:0.02:2; vecx=0.01:0.02:0.66; data.vecx=vecx; load data/rat_for_each_neuron ind=find(rat_numbers==rat); wddall=data.glm_dd(...
3b87687683b4f31958d0b7f1e8c2d4428eec4a24f28ec9120dfd0827e5b2778b
MATLAB
2,532
85
function [scan_ids, subj_ids, subj_info, tab_hdr] = read_subject_ids(subj_file, varargin) % _ % Read Scanner IDs and Subject IDs from Excel file % % subj_file - an XLS or TXT file containing subject information % property - (optional) property to select sub-set of subjects % value - (optional) propert...
95d2211e0884415d0cb36261e746d1d40b57fc41b0ed5bee470264f32ee1474a
MATLAB
2,532
79
function [varargout] = splint_gh(varargin) % SPLINT_GH implements equations (3) and (5b) of Perrin 1989 % for simultaneous computation of multiple values % Copyright (C) 2004-2009, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the documentation and details. % % Fie...
da32374184f3cd6c33749c517b77ff5247c68995956d3a8f0a8dba70da09c8d0
MATLAB
2,532
64
function [s_Trans, s_Rotation, s_Scale, s_Shear]=affine_parameter_scaling(sizeI) % This function gives scaling values for different parameters, such as % rotation and shear of an affine matrix. This scaling make the influence on % pixel changes in registration of for instance a rotation value % approximately equal ...
dc73ed283d5b71e447da7f30324d8b6470ca4dff68d1e3df6a53cb7861e1fe42
MATLAB
2,532
75
function [xyz,T,ypr,Uo,Vo,Z] = DLTcameraPosition(coefs) % function [xyz,T,ypr,Uo,Vo,Z] = DLTcameraPosition(coefs) % % Computes the camera position in the calibration frame coordinate system. % This is useful because it allows you to recreate the scene perceived by % the camera in a 3D modeling and animation prog...
ebcd78a43661fe079370b66d18c40dc925db075068fa0c8fc6e813ffe7a528b4
MATLAB
2,532
90
% meg_runAnalysisMultiSession %% Setup expt = 'TA2'; % sessionDirs = {'R0817_20181120','R0817_20190625'}; sessionDirs = {'R1187_20181119','R1187_20190703'}; user = 'mcq'; paramType = 'Analysis'; % params p = meg_params(sprintf('%s_%s', expt, paramType)); nSessions = numel(sessionDirs); saveAnalysis = 0; saveFigs = ...
13cd89cee3c05e2446aea984dc7b3e0fa1732110a9a48e2fcb42f10ecc667f23
MATLAB
2,533
105
% This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful,...
389458def005ae314d24824d17594d0404baf05b61ee3877dec3a0b9946c52e2
MATLAB
2,533
71
function [ut] = svdfft_c(c, n, trltapcnt); % SVDFFT computes a rotated FFT matrix, using the real part of the % cross-spectral density matrix. This rotation ensures that the phase % relationship of the underlying sources does not change, while rotating % the channels such that the first channel contains the maximal am...
7cb30127171414644998213b1f5def872e4b36c28ce61134b631038a822ebec1
MATLAB
2,533
80
function [nrm] = normals(pnt, tri, opt) % NORMALS compute the surface normals of a triangular mesh % for each triangle or for each vertex % % [nrm] = normals(pnt, tri, opt) % where opt is either 'vertex' or 'triangle' % Copyright (C) 2002-2007, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fiel...
3551e3900a0fb65038d3c906546b5ff2246bc8aa0764e1f7160e2517c0ac3c0e
MATLAB
2,534
53
function cellmdl = paramsToStructFlicker(mdlparams, gridcent, ktbas, dgrid, multfac) %PARAMS_TO_STRUCT_FLICKER Converts model parameters to a structured format for flicker stimuli. % % This function takes a vector of model parameters (mdlparams), % information about the subunit grid (gridcent, dgrid), temporal % ...
645f49ed583ae1f14108d199abd851ad696bf2a451786062b6942371c5298283
MATLAB
2,534
60
function params = prepare_add_parameters(seq,ks_traj,gx,rf,adc,te0,te1,tr0,tr1,params) % Update resolution and mtx size with effective resolution rx = 1./(abs(max(ks_traj.kx(:,1)))+abs(min(ks_traj.kx(:,1)))); if params.gen.ro_type == 'c' ry = 1./(abs(max(ks_traj.ky(:,1)))*2); else ry = ...
3e46cee9711a7f26887d3ccb2faf41ded121114786371a01d020f0ef14cf1688
MATLAB
2,536
92
loadExperimentParams; % LOAD IMG VOLUME filename = fullfile(params.INPUTDIR,sprintf('%sround%d_%s.tif',... params.SAMPLE_NAME,params.MOVING_RUN,params.REGISTERCHANNEL)); img = load3DTif(filename); % LOAD KEYS output_keys_filename = fullfile(params.OUTPUTDIR,sprintf('globalkeys_%sround%d.mat',params.SAMPLE_NAME,p...
84d286554e07cd2098ae3e5e0ac432f7547087eaff011c935241e3c53750a861
MATLAB
2,536
96
%load net; load('results_training.mat'); rng(0); %% Evaluation of the network %https://es.mathworks.com/help/vision/ug/semantic-segmentation-using-deep-learning.html %% Calculated over all images: pxdsResults = semanticseg(imds,net, ... 'MiniBatchSize',20, ... 'WriteLocation',tempdir, ... 'Verbose',false)...
18b4f3dc7678654ef50e6f1bcbd873e6004022cfd5dd79515baa2f03d0983969
MATLAB
2,537
81
function stats=ModularityHSB(clrs,rmat0,rth,params) % % This function calculates the modularity for a set of clustering % assignments for a given rmatrix. This metric is based on Newman, 2004. % It is assumed that the clrs per kden/rth are along each column on clrs. % Ignore modules set to zero (unclassified). ...
25478b7fae94664982ef26fcf4174c46c9d604be8621a0497880bf75f4cd00b4
MATLAB
2,537
73
function strainStruct = metricStrainFromG(M) % get a strain structure from the metric at a point % % metricStrainFromG(M) % % M: 2x2 matrix %--------------------------------------------------------------------- % license %----------------------------------------------------------...
3c32aab362dd46fc5cb79dbf4da400704c4ab02b7882673efe31eb361358cf02
MATLAB
2,537
69
function h_dragZoomInBox3 point1 = get(gca,'CurrentPoint'); % button down detected point1 = point1(1,1:2); % extract x and y % % roiobj = findobj(gcf,'Tag','HROI'); % set(roiobj, 'Selected','off'); % bgroiobj = findobj(gcf,'Tag','HBGROI'); % set(bgroiobj, 'Selected','off'); % % roeobj = findobj(...
91894d982f761f7e1acaefc328e831fdd08fa49058a323cfbfd5ed9db439d0ed
MATLAB
2,537
84
%% Test for run_main.m % Setup clear; basefolder = fileparts(fileparts(mfilename('fullpath'))); codefolder = [basefolder,'/code']; toolsfolder = [basefolder,'/tests/tools']; addpath(genpath(codefolder)); addpath(genpath(toolsfolder)); % Setup needed variables and test if it fails without them testError(@() rmain(...
b929aff9c465030e52b5022f235b662c13e789af68cfc3b3c1ba2720ad10190c
MATLAB
2,537
97
% SOFA API - test script % Test some of the SOFA API functionality % 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 u...
5441156f0812b98d7aa03b5545875f6f5c403df2a48abd9ce812d453f81156ba
MATLAB
2,538
76
function CBIG_ASDf_mean2mat(inputDir, outputDir, k, r, scalelim) % CBIG_ASDf_mean2mat(inputDir, outputDir, k, r, scalelim) % % This function computes factor-specific RSFC patterns (i.e., E(RSFC patterns|Factor)), % plot it and save it as a 419x419 matrix. % % Input: % - inputDir: % Absolute path to the d...
84a80ca5a0c150dd5eb47db2a795054e8f92d8d049df8fde9c8648ade4196966
MATLAB
2,538
179
clear clc close all rat='P049'; rat=rat(2:end); rat=str2double(rat); load data/combined_kernels.mat %%% (generated by combine_neural_kernels.m) data=data_all_trials; data.centers=-1:0.02:2; vecx=0.01:0.02:0.66; data.vecx=vecx; load data/rat_for_each_neuron ind=find(rat_numbers==rat); wddall=data.glm_...
c08cfb4fa62e91b3baf10733498e01a51f71b37a12518de91993917e3e864c1c
MATLAB
2,539
83
function redrawCuboidSurfaces(src,~,v) lambdatext = [955 ' [nm]']; % The 955 is the unicode number for the lambda character. Because the editors of MATLAB versions prior to 2020a do not support unicode, we have to make the lambda in this sneaky way. if src == v.h_centerbutton set(v.h_slider,'Value',(numel(v.l)-1)/2 ...
c9ed78d724287b07410cd3caa8a26ac1903fd74746116d4fb36eb032f8238003
MATLAB
2,539
94
function cMap = makeColorMap(varargin) %% MAKECOLORMAP makes smoothly varying colormaps % a = makeColorMap(beginColor, middleColor, endColor, numSteps); % a = makeColorMap(beginColor, endColor, numSteps); % a = makeColorMap(beginColor, middleColor, endColor); % a = makeColorMap(beginColor, endColor); % % all colors are...
f61f7f460aac20f271dd7383e4c3015e71b2ae0f8a668c45d34f09c01da0ff48
MATLAB
2,541
83
% Author: Birgit Nierula % nierula@cbs.mpg.de function bad_channels = prepro_check4badChannels(epo, trigger_name, wait4input, auto_badchan_labels) %% check for bad channels % input: epoched data if ndims(epo.data) == 2 cnt = epo; clear epo load([getenv('CFGDIR') 'cfg.mat'], 'iv_epoch', 'iv_baseline') % in ms ...
31a639c0c7dc252c21fd6f0b1aa7ba464ece2ddcd82f733493ecc56b22927d84
MATLAB
2,542
47
% SphericalMidPoint - Determine a point on a unit sphere by assuming % equal distance to two spherical points % % (published in appendix of Kayser J, Tenke CE, Clin Neurophysiol 2006;117(2):348-368) % % Usage: [P] = SphericalPoint( Pl, Pr, Pm, P1, P2, lab); % % Implementation of simple linear...
544f87b40cb8122a8e40320e54095c521fde5bd6d93f7362be6eda93e0ac38b5
MATLAB
2,542
68
function imData=read_file(path_to_file,sframe,num2read,options) % Reads uncompressed multipage .tiff, .hdf5, .avi or .raw files % Usage: my_data=read_file('path_to_data_file, start frame, num to read); % INPUTS: % path_to_file: location of file to be read % sframe: first frame to read (optional, defau...
4393d7e69b2222ea7bd6c0aafa129adf36e60fb89be5e17305c939923ad04eba
MATLAB
2,543
71
%% SDO Optimization Wrapper % Ad-hoc re-optimization of the SDO matrices, using the current SDOs as the % initial values for optimization (sdo7). %_______________________________________ % Copyright (C) 2023 Trevor S. Smith % Drexel University College of Medicine % % This program is free software: you can redistribute...
51d2ba7fb0fefe777329555809589386ebb7977b79369f85962f4be8da2a5205
MATLAB
2,543
86
function [elem, points, surf_elem nnpe] = read_abaqus_inp_3D(mesh_fn) % Reads abaqus mesh files exported by Mimics V.13 % % Written by Hamid Ghadyani, Apr 2010 % The old version which is very slow is now called read_abaqus_inp_line % if(nargin~=1) [fname,pname]=uigetfile('*.inp','Please pick the inp file'); else...
9ec02f0734fc434cdfcac9be9b12849374a1d391d2f82e004bffabc65baa01df
MATLAB
2,543
81
function [event] = read_nexstim_event(filename) % Use as % [event] = read_nexstim_event(filename) % Written by Vladimir Litvak based on the function nxeGetTriggers % provided by Nexstim % % Copyright (C) 2007, Vladimir Litvak % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org % for the document...
9209e3335f7e07d751a7ef59b3eacdf349d0334903f9d2d5705e0e81bf0ca004
MATLAB
2,544
53
function modelParam = set_depedent_parameters(modelParam, varargin) % set_depedent_parameters.m % % Takes in "parameters" structure of initialized independent parameters and % sets (or updates) all dependent parameters. % % Input: % A parameters structure % % Output: % The parameters structure with the dependent pa...
fd9fc45f1c486cc54212235b809b3d7b315007a6531b5a3acfe3a85f8e54a7d3
MATLAB
2,544
87
function fstats = lme_F(stats,C) % fstats = lme_F(stats,C) % % Inference for the fixed-effects in the linear mixed-effects model(Depends % on the Statistics toolbox). % % Input % stats: Structure obtained from any of the model fitting functions: % lme_fit_EM, lme_fit_FS and lme_fit_NR. % C: Contrast matrix. % % Out...
5c83c9e3bf1703d5c09260262c68d81c4a711faa57aad42901b1f362e59f261c
MATLAB
2,545
100
% Demo of factor analysis applied to binary newsgroups bag of words % We compute 2d embedding %PMTKreallySlow % This file is from pmtk3.googlecode.com requireStatsToolbox; % cmdscale setSeed(0); loadData('20news_w100'); % documents, wordlist, newsgroups, groupnames wordocc = double(full(documents))'; % 16,642 docum...
85a5f940d774e0b84ed1deaa71568b89365f91049641abf78c92aa17e9f1b91b
MATLAB
2,545
85
function [sel1, sel2] = match_str_lan(a, b); % MATCH_STR looks for matching labels in two listst of strings % and returns the indices into both the 1st and 2nd list of the matches. % They will be ordered according to the first input argument. % % [sel1, sel2] = match_str(strlist1, strlist2) % % The strings can be stor...
457e86308a1639e6676f228bb5ed95faebf510db47e5d5a73da62de5130b36b1
MATLAB
2,546
122
load camera_results; string_global = 'global n_ima'; for kk = 1:n_ima, string_global = [string_global ' x_' num2str(kk) ' X_' num2str(kk) ' xproj_' num2str(kk) ' x_proj_' num2str(kk)]; end; eval(string_global); %----------------- global optimization: --------------------- load projector_data; % load the proje...
97abccf015d6380a6fb409c90857b5b7a55ba14c0085bad8943da623ce6fec80
MATLAB
2,546
75
% Author: Birgit Nierula % nierula@cbs.mpg.de % Code adapted from Sencer Melih Deniz function new = proc_tf_plots(epo, min_freq, max_freq, num_frex, chan_names, ... color_range, is_normalized) if ~isempty(chan_names) %% select channels chan_idx = find(ismember({epo.chanlocs.labels}, chan_names )); epo...
ca1a62bbd950403f13853c295f56a9c01928de25082cfc6a3295764f5798899d
MATLAB
2,546
93
function [ ival, pint ] = plane_normal_line_exp_int_3d ( pp, normal, p1, p2 ) %% PLANE_NORMAL_LINE_EXP_INT_3D intersection of plane and line in 3D. % % Discussion: % % The normal form of a plane in 3D is: % % PP is a point on the plane, % N is a normal vector to the plane. % % The explicit form of a li...
f121d8ff55bc8ff926327cde0ce55976afe36d0890bc87ded53fc53f650cc12b
MATLAB
2,546
101
% Measurement Error Compiling %% ===== Data Compiling ===== % Use the first 3 sections to compile RMS error data from separate samples % Then, run the following code to get RMS curve with SD shading. %% Initialization: Run this section once clear; measData = struct([]); %% Compiling: Run this section N times, for e...
668b593bf014886e09a0d0db3dd9778030dabae9688a38f99331903ed7617e6f
MATLAB
2,548
84
function fig = plot_path(behavior,session,varargin) % plots path in behavior.position by trial. % LB 12/2022 % Input parser p = inputParser; p.addParameter('exclude_epoch', {'y_maze','sleep'}); p.parse(varargin{:}); exclude_epoch = p.Results.exclude_epoch; if ~isfield(behavior,'trials') error('No trials field ...
ac8ffcc0a5e23e1aaf66672b735533369526a2b60f9a80d15b054ad561912c05
MATLAB
2,548
89
function mergeDat = MergeTest2(spkDat, refClust, varargin) spkDat.waves = double(spkDat.waves); [wL, nChan, ~] = size(spkDat.waves); pk = spkDat.peakLoc; wP = spkDat.wavePad; wL = wL - 2*wP; clustList = setdiff(unique(spkDat.id), 0); refIdx = find(clustList == refClust); nClust = length(clustList); win = 1000 * [1 - p...
0aa91aab3b51596d3c8c8f66c07ac957e7013b621cd8704ecc8132c4bb150002
MATLAB
2,549
64
function EWsig=McNemar_Figs3(dataOut,Bxname,IM,B,params) % Plot network pairs meeting significance if ~exist('B','var'),B=1;end Pth=0.05./B; PthMcN=0.05; [NNidx,Tidx,TNidx]=IM2idx(IM); Npairs=length(TNidx); Nnets=max(IM.key(:,2)); NetKey=[[1:Nnets]',[1:Nnets]']; %cMap=[1,1,1;0,0,0]; %% Significant stats by network b...
637ed6895af76cf065ef98c9b8c112ffae73c550c9ca0aca6417569ccc8ad25e
MATLAB
2,549
101
function proc_createMixedLong(epo, fname, fpath, trigger_name, cond_name) %% set max events max_events = 2000; % mixed condition % mixed epo_long = get_getEpoStruct(epo, max_events, trigger_name{1}); %% save d_idx = strfind(fname, cond_name); ll = length(cond_name); new_fname = [fname(1:d_idx+ll-1) '_long' fname(...
15fec8998ab7100cfaee03567605173dcc71c342902b7fbc585ddc77d613b850
MATLAB
2,550
105
%% Find Saccades and Microssacades in EyeLink Data % Written by: Sharif I. Kronemer with open access scripts % Last Modified: 9/22/2023 %% Saccade detection % Calculate velocity/acceleration using 5-sample window % (https://github.com/sj971/neurosci-saccade-detection/blob/master/analyzeEyeData.m) % See Engbert and ...
baca4c2deb6878d50700618206274dcb6d8928537c1c972df5b9dbd53055c488
MATLAB
2,550
93
% Field Trip-related test scripts - Synthetic FT data - "Custom" - Detection. % % % Includes. % Assume that the parent called _init and _config. % % % Event detection. disp('== Detecting events using custom function.') disp(sprintf( '-- (%dx%d patches)', ... length(threshsweep_xy), length(threshsweep_xy) )); d...
3606fbb4c55e619b5269301b8dd78d772befa5bb6e0221093b4b2b58992569be
MATLAB
2,551
84
function [st,res,warningstr] = run(obj, varargin) % Run a command using Matlab built-in system() command, but with some handy % additional capabilities. (This is a replacement for the apt.syscmd() % function, which dealt in raw strings.) % % Optional args allow caller to specify what to do if the command fails. (Can ...
de23514200f66f4cbab85b72042754a15f92545ffa6c50b27e1470542a0813fe
MATLAB
2,552
81
% distribute the convolution function, chunking to avoid GPU memory errors function J = conv2_dist(filter, J, chunk_cols, gpu_strategy) % FIXME gpu_chunks chosen arbitrarily to split convolution up if ~gpu_strategy gpu_strategy = 'single' elseif ~strcmp(gpu_strategy, 'multi') && ~strcmp(gpu_strategy, 'single') ...
8ce388b8ac1eb1ea4d1e753eb1d0e0dcb5010e5f46b9839f081d5ad6c6cd2f20
MATLAB
2,553
78
function demoClassify %DEMOCLASSIFY A demo used to test and demonstrate the usage of classifiers (clf*) % % To change the demo parameters alter this function. Note that the % visualization of the train and test data may look different due to % different 2D projections (see visualizeData). % % USAGE % demoClassify % % ...
9bfbb21ee2296b247f15b65b06efaccf4cd4004ad5c1e1c8374c45ede7b627a9
MATLAB
2,553
106
function [E, yhat] = meg_objectiveFunction1_freeFreq(x,data,t,Fs,paramNames,fitType) % Define objective function to minimize for fconmin/bads % November 2023 KT % Inputs: % data: values by t, vector % x: initial coefficients for search % t: time vector % Fs: sampling frequency, if not defined default to 1000 ...
1d03227f647d86edc8d54e868f38e802db987faace25afef383c3a6423cc0786
MATLAB
2,554
67
%----------------------------------------------------------------------------------------- % Raster plot of amygdala neuron responding stronger % to odors rated as liked vs. disliked % % Kehl et al. 2024 (DOI:XX) % Single-Neuron Representations of Odors in the Human Brain % Figure 4c % Author: Marcel Kehl % License...
7da020100133869c0abd9856a2b206ab56764d38ac255167eb643fdbc186ea80
MATLAB
2,555
69
%%Plots and calculates the mean bin value of all laps for data in each given task %Chad Heer; Sheffield Lab function [mean_lap_pupil, h, j] = plot_with_errorbars(lap_pupil, tasks, range, x_units) %lap_pupil = pupil or fluorescence data organized in this format {task}(laps, mean pupil area in each bin) %tasks = string...
118f076d1da61e62041368f85de76d2765903b5c2d662dce3b05e6590f18031e
MATLAB
2,556
85
function [ data ] = shiftoffset_timelock( data, trials, offset, prestim, poststim, fsample, baseline) % [ data ] = shiftoffset_timelock( data, trials, offset, prestim, poststim, fsample, baseline)% Anne Urai warning off; ft_defaults; pupilchan = find(strcmp(data.label, 'EyePupil')==1); if baseline == 2, % t...
6aec860e22081c2b479b2a0921772ec25d31e043a665b1837887892f1fb8e073
MATLAB
2,556
50
function r = calc_mouse_estimate_all_stages(all_learning_stages,simParam,nbootstrap_samples,rescale_to_target_distance,start_site,target_site) if (nargin < 3) || isempty(nbootstrap_samples) nbootstrap_samples = 10; end if (nargin < 4) || isempty(rescale_to_target_distance) rescale_to_target...
f3bb0d0b995455a51c9bd592bd43746a85425653f117020296a14bc431eef8b3
MATLAB
2,557
56
function test_autotune_no_duplicate_align_entry() % Test that the "Align using tail->head body axis" parameter % (ROOT.MultiAnimal.TargetCrop.AlignUsingTrxTheta) appears exactly once % in the Auto-tune tab of the training-parameters dialog for a bottom-up % multi-animal project. It used to be rendered twice: once as a...
889fe71e5b2888986f08c3a3ba6cc7372e4f1d739947ed2dd1981d8eff984dfe
MATLAB
2,558
82
thresh_hold_percent_0 =0.15; fititing_profile = 0.8; intensity_profile_max = 0; for kk = find([stitching_queue(:).max_direction] == 1) intensity_profile_max = max([intensity_profile_max,intensity_profile{kk}]) ; end shifting_key = {}; for kk = find([stitching_queue(:).max_direction] == 1) temp...
b0f95674376c8890855e4698f03ff61645862ca89e546341ee2706ec596911ed
MATLAB
2,560
102
function varargout = unitTest(fname, varargin) %% Run all of the demos that depend on fname. % %% Inptus % % fname - the name of the function, e.g. 'minFunc'. % %% Optional named inputs [default] % % 'run' - [true] run the demos instead of just returing their names % 'recursive' - [true] include long ra...
c722a42ad897ff068f9e89eeffa4e9a02a27bd6bb1801669da0a80487c10cdba
MATLAB
2,560
99
%%% This script alets the user enter the name of the images (base name, numbering scheme,... % Checks that there are some images in the directory: l_ras = dir('*ras'); s_ras = size(l_ras,1); l_bmp = dir('*bmp'); s_bmp = size(l_bmp,1); l_tif = dir('*tif'); s_tif = size(l_tif,1); l_pgm = dir('*pgm'); s_pgm = siz...
f06c38b058e778a65a075118de53a35b5a5183ae6ec5450153db31e197656ba1
MATLAB
2,560
63
function EWsig=McNemar_Figs2(dataOut,IM,B,params) % Plot network pairs meeting significance if ~exist('B','var'),B=1;end Pth=0.05./B; PthMcN=0.05; [NNidx,Tidx,TNidx]=IM2idx(IM); Npairs=length(TNidx); Nnets=max(IM.key(:,2)); NetKey=[[1:Nnets]',[1:Nnets]']; %cMap=[1,1,1;0,0,0]; %% Significant stats by net...
70a0be3794ce66c6797b686667cbb36d760c12923232faf90f1e2784d5b128e7
MATLAB
2,561
90
function [out] = get_VolterraInGames(u,tau,param) % estimate 1st-order Volterra Kernels of agents engaging in games % FORMAT: [out] = get_VolterraKernels(u,tau,param) % Volterra kernels can be either estimated in a non-parametric way, or in a % parametric way (where kernels are assumed to be exponentially decaying % wi...
5d02e005e1f61479917c1fe0c67f3606a6bdba3f4cfc1c01ca141ea9df123373
MATLAB
2,562
96
function [zones] = createZones(origin, diameter,varargin) %This function creates pie shpaed quadrants for beahvioral testing in circular apparatus %by LB & MG March 2019 %Input: % origin: 1x2 matrix of xy coords for origin, ex: [0,0] for % coordinates centered at 0,0. % diameter: scalar quantity that...
10db8ec5489cdba6e79ee82667d7d17ba5f235bce125a619b75385bbf33489b1
MATLAB
2,564
80
function result = doinheritance(r, tr) import yaml.*; if ~exist('tr','var') tr = r; end; result = recurse(r, 0, {tr}); end function result = recurse(data, level, addit) import yaml.*; if iscell(data) && ~ismymatrix(data) result = iter_cell(data, level, addit); elseif isstruct(data) r...
888a614f940b9313a0b326f929e26ddc2d629c7e33189fa1cc462f2114fa3794
MATLAB
2,564
70
%% 2D Gaussian contour plot along with its 1D marginals and conditionals. % %% % This file is from pmtk3.googlecode.com function gauss2dMargCondPlot() fig = figure('Color','w'); mu = [0.5 0.5]; sigma = [0.018 0.01 ; 0.01 0.011]; plot2d(); plotMarginal(); plotConditional(); annotate(); function plot2d() ...
9dca916b83609c877b6bf70da49e3ab7ff5b8f87d959c3218f0de659881be76b
MATLAB
2,564
77
function [MergedStack] = StackMerge(FileID,Stack1_Input,Stack2_Input,Limits) %this will load in two stacks and merge them vertically and help avoid %memory loading issues if large stacks if length(Limits)~=1 Stack1=load(FileID,Stack1_Input); Stack1_Name = fieldnames(Stack1); Stack1 = Stack1.(Stack1_Na...
255b1f3c33e5ec62b084183dd08531a329a54bc558be348d69a917d8161b18f6
MATLAB
2,565
95
% This script gives the creation of the gaussian spheres used in the % example, as well as its chi functions. addpath('utilities', 'Sensitivities','Inverse'); do_save = 1; % 1 if save the data to .mat %% ====== 'gauss1' ====== tag = 'gauss1'; cfg = getParams(tag); if cfg.mask_number == 0 % no mask is used in this cas...
3e0fe5e175d26f689d831621c49c24d8d0294b6f20596f86b3cf1ee0e6669090
MATLAB
2,565
101
clear close all clc %% Load data addpath('/Users/jstrohl/Desktop/20231108 Strohl Sepsis fear network/materials/') [num,txt,raw] = xlsread('20240519 PET LS data for ML.xlsx') %% Import data group = categorical(raw(2:end,1)); pet_data = cell2mat(raw(2:end,4:end)); pet_labels = raw(3:end); % Label dataset true_label...
f48ef4a0fd24f99b89ddfcd259514bea351539745be00b8c72f16871968ac488
MATLAB
2,566
73
% FT_POSTAMBLE_SAVEVAR is a helper script that optionally saves the output % FieldTrip data structures to a *.mat file on disk. This is useful for % batching and for distributed processing. This makes use of the % cfg.outputfile variable. % % Use as % ft_postamble savevar data % ft_postamble savevar source mri % % ...
8cdd477b8aed6b115c286bc3c540a9442d6b52d3329a61e99026d69289810b9a
MATLAB
2,567
103
%% demo of mixture of linear regression experts in 1d % This file is from pmtk3.googlecode.com clear all close all setSeed(0); %data = load('mixexp_data.txt'); % data from Mike Jordan's homework datasource = 3; switch datasource case 1, xtrain = linspace(-1,1,200); Ntrain = numel(xtrain); ndx = (xtra...
8cefa525b93cf81e16ca8b6a871dae559a046114c8c8bd8ab19fc3770c6b7bb7
MATLAB
2,567
76
%% pipeline from MB modelling analysis: % from calcium imaging timeseries to kenyon cells timeseries % by A. Wystrach and M. Paoli, eLife 2024 close all, clear all, clc % FUNCTIONS REQUIRED: create_MB, use_MB %% load and extract database load('examplary_bee.mat') bee = database.bee; bee = squeeze(mean(...
275a13b0af7aa799113814e2e50b144e8abf71d56252fb8483ec9820039f209a
MATLAB
2,568
89
%% autocov_to_mvgc % % Calculate conditional time-domain MVGC (multivariate Granger causality) % % <matlab:open('autocov_to_mvgc.m') code> % %% Syntax % % F = autocov_to_mvgc(G,x,y) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % G autocovariance...
52dd8f0dd5a6faaa874f3c910111ba02416ed3341ffcd1fa9c96c709117535ae
MATLAB
2,568
103
function [mask_cluster_bg,centroids] = generate_BG_tissue_mask(anatomy,PET_dyn_path,hemi_scan,K,out_path, qc_path, mask_path, options) if nargin<7 options=get_default_options(); end NII_mask = load_nii(fullfile(mask_path,[anatomy '_mask.nii'])); mask = NII_mask.img; %loading dynPET [~, PET2D,...
89af5f5209bcebcb8217631e9168c571e2d0f07acf7a292b893a606c5f2efd55
MATLAB
2,568
60
function [ titleStr, settings, results ] = deleteLabels( dataview, settings ) % This function removes one or more variables from the datasource. % % % %<PRE> % This file is part of dspace-core. % % Copyright (C) 2020 University Zurich, Sepp Kollmorgen % % This program is free...
f1c1195e8b5b05d43b9b5abbabfaea3276a1d9176accc2d0edd59df7b3b64581
MATLAB
2,568
107
% This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful,...
0e16cae69049efe55a1906e269595626fe05ecda20b236f890e955ffd42a53da
MATLAB
2,569
72
function [total_ST_resolution, total_power_captured, txt_han]= get_STresolution(stim_env, fs, dam_traj_Hz, tWindow, do_plot_boxes) stimdur= length(stim_env)/fs; freq_res_default= 1/tWindow; nSegs= floor(stimdur/tWindow); min_power_ratio= 0.95; current_pow_box= nan(nSegs, 1); current_pow_total= nan(nSegs, 1); all_fre...
2815b745456e96f902f971398bb2ab36fc1a60520cfdfc866b77003ffa7b218d
MATLAB
2,569
118
function [X_ind, X3d] = dummyEncoding(X, nStates) % Convert a matrix of categorical features to binary form % Each X(:, j) is expanded into a binary matrix of size n-by-nStates(j). % These matrices are then concatinated horizontally forming an % n-by-sum(nStates) binary matrix. % if requested. % X3d has form X(n,j,v) w...
4de49c914309f8846f98254f5bcbe03ccd603dcfb894faaf970938a2bba182a4
MATLAB
2,569
100
function [model, path] = logregFitPathCv(X, y, varargin) % Fit a regularization path for logistic regression model % using L1 or L2 regularizer and then pick best model. % Also return params on the path. % (This is a wrapper to the glmnet package.) % INPUTS % X ... N*D design matrix % y ... N*...