sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
84961570847f8fa97b3c7b0e6b2fffab3de6c35bb343b04f07b55fb69478d20d
MATLAB
1,374
34
function process_mat_data(ALLEEG,main_folder_path,PreprocessedDataPath) %% ²»Óù˼Éparams£¬×ªepoch ºÍlabel mat¸ñʽ % clear all; close all; % ´´½¨Ò»¸ö¿ÕµÄ ALLEEG ½á¹¹ % ALLEEG = []; % % µÝ¹é¼ÓÔØÎļþ¼ÐÄÚËùÓÐ .set Îļþ % ALLEEG = load_all_sets(main_folder_path, ALLEEG); % ÏÖÔÚ ALLEEG ½á¹¹Öаüº¬ÁËËùÓмÓÔØµÄ .set ÎļþµÄ E...
9524a9d973a1ec36c961bc997938ea7086c0de0988261a92769d0e8da05eed9a
MATLAB
1,374
78
function [modelfit_path,temp_path,maps_path,IDIF_path, IDIFTemp_path, IDIFVessels_path, IDIFQC_path, MOCO_path, SEG_path, COREG_path]=out_path_preparation(destination_dir) %% ModelFit modelfit_path=fullfile(destination_dir,'ModelFit'); if(not(isfolder(modelfit_path))) mkdir(modelfit_path); end % subdirectories ...
fcddc213a93669a2662b797edce335126118414f7a638bb196f9dcf19a6f3b73
MATLAB
1,374
53
function [IDX,C] = meanShiftPost( X, IDX, C, minCl, forceOutl ) % Some post processing routines for meanShift not currently being used. % % USAGE % [IDX,C] = meanShiftPost( X, IDX, C, minCl, forceOutl ) % % INPUTS % see meanShift % % OUTPUTS % see meanShift % % EXAMPLE % % See also MEANSHIFT, KMEANS2 % % Piotr's Com...
db8fe6fd99444989329ec5be5e4bfefcbba57e44a181f946ebe9cdb7202cbe1f
MATLAB
1,375
48
function nstr = int2str2( n, nDigits ) % Convert integer to string of given length; improved version of int2str. % % Pads string with zeros on the left. For integers similar to % sprintf( '%03i', n ); %for nDigits=3 % If input n is an array, output is a cell array of strings of the same % dimension as n. Works also ...
b62804fa1336565dfd85ea649657844e5f60273790b58e7d6566038ef6e4fade
MATLAB
1,376
62
function [s,param,value] = read_ann_line(fid) s = fgetl(fid); param = []; value = []; if s == -1 return; end if strcmp(s,'end header'), return; end % if isspecial, % sz = str2num(value); % value = fread(fid,sz,'uint8'); % else % tmp = str2num(value); % if ~isempty(tmp), % value = tmp; % end; % end;...
10e5ebca45c5059486a8000c6c526f63acc81a4490c5c2974aa017e8cfdc9d1d
MATLAB
1,377
34
% FT_PREAMBLE_TRACKCONFIG is a helper script that calls ft_checkconfig to switch the % (optional) configuration tracking on. This should be used together with % FT_POSTAMBLE_TRACKCONFIG. % % Use as % ft_preamble trackconfig % ... regular code goes here ... % ft_postamble trackconfig % % See also FT_PREAMBLE, FT_P...
71a3f89c335c66793c0d9540b4163348befe83b7547e5d21d13e968e4ea219e5
MATLAB
1,377
40
function [fpred, insignal] = predictSubGridSubSurrModel(mdlparams, stiminfo, stimorder) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here kt = mdlparams.ktbasis * mdlparams.ktwts; ktsurr = mdlparams.ktbasis * mdlparams.subsurrwt; Nt = numel(kt); Nstim = size(stimorder, 2); %Nsub...
bf7e7c13d0cc8dabeec4009fec458d2714081e6b11cb3249ab010e799c8f501e
MATLAB
1,378
45
function B = betheFreeEnergy(G, nodePots, edgePots, nodeBel, edgeBel) % Approximate the log likelihood for a pairwise MRF % If the model is a tree, this is exact % F = -theta^T tau - sum_{st} H(s,t) + sum_s (d(s)-1) H(s) % where exp(-theta)=[nodePot edgePot] % tau = [nodeBel edgeBel] % H(s,t) = entropy edgeBel(:,:,e) %...
2271ab7080ee369071a98c15a87a516993bb2094f45adcc05a8619d8e786a349
MATLAB
1,379
34
clear all %% %Define Parameters [opt] = ParameterOptions(); %% %Define threshold array PrecisionArray=10.^[-18:-3]; %% %Full distributionan for k=1:length(PrecisionArray) opt.Precision=PrecisionArray(k); %Generate Pathway Amplitude & Gradient Waveform basis set %First Dictionary [PathwaySignalFirstOrder...
343965a1a83ede000f06098dba04ecdc5a8b25e3b0d0dab9c8cdb361e012e8d3
MATLAB
1,379
46
function vec = tangent2vec(M, x, basis, u) % Expands a tangent vector into an orthogonal basis in the Manopt framework % % vec = tangent2vec(M, x, basis, u) % % The inverse operation is lincomb (see below). % % M is a Manopt manifold structure obtained from a factory. % x is a point on the manifold M. % basis ...
6d1a4d14dbd99fb7ce2882f94fc20db6ced4e2c47e5d590fdeb42f27348e0518
MATLAB
1,379
58
%% infocrit % % Calculate Akaike and Bayesian information criteria % % <matlab:open('infocrit.m') code> % %% Syntax % % [aic,bic] = infocrit(L,k,m) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % L maximum log-likelihood % k number o...
a48b3da212dcaa452a0f4ca9b9d3b77597501c1ce2cbb565f44e7224782321d7
MATLAB
1,379
45
function spkPerBin = getBinnedEventSpikes(celldata, riptimes, eventindex, event, modelParam) % spkPerBin = decode.getBinnedEventSpikes(); % % %% Set up sToMsConversion = 1000; tBinSz = modelParam.tBinSz; hpnum = numel(unique((celldata(:,3)))); %% cellsiAll = celldata(find(celldata(:,2)==eventindex(event)),3); [cells...
aee72e9bdfc2ef7663f89631b82c12d17274d1cb741b787a7e7d95dc5a910fec
MATLAB
1,379
55
%% Illustration of the likelihood surface created by a GMM % The GMM has 10 isotropic components in 2d. The centers are marked with a % '+' symbol. The three modes are marked with blue triangles. The green % line is the convex hull of the centers. % %% % This file is from pmtk3.googlecode.com setSeed(39) mu = [0.0...
c4989908821ad38fcd8a400046bcf44ee482248e12c6e18908dacee4c9ee7a01
MATLAB
1,379
54
% crabsort plugin % plugin_type = 'load-file'; % data_extension = 'mat'; % % _ _ % ___ _ __ __ _| |__ ___ ___ _ __| |_ % / __| '__/ _` | '_ \/ __|/ _ \| '__| __| % | (__| | | (_| | |_) \__ \ (_) | | | |_ % \___|_| \__,_|_.__/|___/\___/|_| \__| % % function S = MAT(se...
d4697cd539148b72b6eef503be64f1978b322ee847268745a6ff28a2583d3435
MATLAB
1,379
56
function [mu ul ll] = circ_mean(alpha, w, dim) % % mu = circ_mean(alpha, w) % Computes the mean direction for circular data. % % Input: % alpha sample of angles in radians % [w weightings in case of binned angle data] % [dim compute along this dimension, default is 1] % % If dim argument is specif...
f1a33a85eaa770307034bd79189b4390531dea370adb6bba5e5ce51217d7230c
MATLAB
1,379
52
clear close all %% Input folder paths to data and MRI atlas folder_path = ... '/Users/jstrohl/Data/20240216 Sepsis Fear PET data/20240216 preprocessed nifti files/' addpath('./atlas_functions') addpath('./MRI_template') addpath(folder_path) %% Import % Import MRI atlas MRI_template = niftiread('2011-10-30_MRI...
9d09fae2a05a5f2937a2ee84af7d841b6954b215c7d74d0cfd997ea755e243b1
MATLAB
1,380
47
% - simulate a network of rate-based units dt = 1; % Time step tau = 10; % Time constant T_end = 150; % Total simulation time T = 0:dt:T_end; % Time vector t_trans = 50; % Time for transient responses dp = 1; % Perturbation magnitude W = w; % Connectivity matrix % - baseline vs per...
893090a32be454de731ba904f1b8cba673ea70b891a823420f8ae17e6605bf59
MATLAB
1,381
60
function out = getcfg(cfg,field,default,posible) % <*LAN)<] % v.0.0.4 % get cfg field and set default parameter % Pablo Billeke % 30.03.2012 fix bug in logical default % 20.03.2012 fix bug % 01.02.2012 add posible = {'op1','op2','op3',...} % 25.11.2011 % 21.11.2011 if nargin <4 posible = []; end % get t...
8ea9cd0329b9eefb68153bac222207e9c2049cffb3a7e50b47985d5283d3e396
MATLAB
1,381
67
% deletes data (in .crab format) and associated .crabsort files % if certain conditions are met % % exampple usage % % to purge all data where the LP channel is blank (has a single value) % % use this: % crabsort.purgeData('LP',@(x) length(unique(x),1) function purgeData(ChannelName, FcnHandle, Value) allfiles = ...
8f78e67b633b9d04e23dd97f82b9d4005ffd8a2de188ee574ff5dbe9bcb9d4ad
MATLAB
1,381
57
function [timePlot, freqPlot, dB_powPlot]= plot_dAM_spectrogram(sig, fs, tWindow, fracOVlap, nfft, cbar_range, useDefaultPlot, tStart) if ~exist('tStart', 'var') tStart= 0; end if ~exist('useDefaultPlot', 'var') useDefaultPlot= 1; end if ~exist('cbar_range', 'var') cbar_range= 40; end if ~exist('tWindow'...
98c30ba1c925e254850aa45c989057baa747477a88764c4714c7d599d9268ef2
MATLAB
1,381
33
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This script generates the information excel file for each parcellation % % set based on Seitzman (2020). % % % % Author: ana.tr...
a61beda19967fa7ae72f6a6215e15f79b149b24152319506aa5259335faee4ee
MATLAB
1,381
53
%% Compare inference in a QMR like network (dgm) % This file is from pmtk3.googlecode.com setSeed(0); nfindings = 100; % turn down if you run out of memory ndiseases = 15; nnodes = nfindings + ndiseases; % first and last findings are hidden % first half are positive, second half negative posNdx = ndiseases+2:ndi...
137a79e488d12c8c3ec10a74c8edb59d268ed904b78a444fd2cbfd51654c9ce0
MATLAB
1,382
42
function [DT,bonds] = Triangle(params) a = params.a; n = params.n; a1 = [a,0]; a2 = [a*cos(pi/3),a*sin(pi/3)]; p = []; for i = 0:n-1 for j = 0:n-i p = [p;-j*a1 - i*a2]; end end DT = delaunayTriangulation(p(:,1),p(:,2)); ind = []; for i = 1:size(DT.Conn...
0e32752557a80cd6a0a4611901fb8295cbb4201c53943cc6318ae244c456e382
MATLAB
1,383
56
function j = CBIG_MFMem_rfMRI_diff_PC1(func,para,num) %----------------------------------------------------------------------------- % Function for Complex-step first order derivative approximation % % Im[f(x0+ih)] % diff(f(x0) = -------------- % h % % Input: % ...
7a3ea18d81833a702b336efdeab81f9055356c747e4689f65540815a637b4b58
MATLAB
1,383
64
if ~glmnetInstalled fprintf('cannot run %s without glmnet; skipping\n', mfilename()); return; end if 0 x=randn(100,20); y=randn(100,1); g2=randsample(2,100,true); g4=randsample(4,100,true); fit1=glmnet(x,y); glmnetPrint(fit1); glmnetCoef(fit1,0.01) % extract coefficients at a single value of lambda glmnetPre...
97505edb9a53bff941b8223edb728684662092eba68c79c88fbc6d5c51026863
MATLAB
1,383
73
n=250; eg1=exgausrnd(200,20,100,1,n); nr=normrnd(300,20,1,n); er=exprnd(300,1,n); al=[eg1; nr ;er]'; mean(al) fh=figure(1) set(fh,'Units','inches','PaperUnits','inches'); orient landscape set(fh,'position',[0.25 0.25 8 3]); set(fh,'paperposition',[0.25 0.25 8 3]); clf subplot(1,3,1) br=hist(eg1); hist(eg1) % fb=bar(br...
02ea0deb42e4cfed01a94de2898d9399410cb64f7ac92617b7a8fcc0a4b4af28
MATLAB
1,384
51
clear all; close all; %Load the network: load('results_training.mat'); imDir1 = '/mnt/DATOS2/jvargas/ScipionUserData/projects/RNP_Vargas/Solo_Puntas/IMAGES_FILTERED/'; imds = imageDatastore(imDir1,"FileExtensions", [".mrc",".jpg",".tif",".png"],"ReadFcn",@(x)normy(x)) downsampling = 1; %% for idx = 1:length(imds.Fil...
9e1967e818b75e851e13a5b6c08a456709bbba33ee3cb5d32a0cfa59dff57061
MATLAB
1,384
46
function varargout = xml2mat(xmlfile, matfile) %XML2MAT Convert an XML-file into a MAT-file % XML2MAT(XMLFILE, MATFILE) converts an XML file or an XML string % (as saved by MAT2XML) into a MAT-file MATFILE. % S = XML2MAT(XMLFILE) returns the content of XMLFILE in variable S. % S is a struct containing fields matchi...
3cd867c3822df55ee92ad2accde024fdad33b7d12841508611613b2f2a412aeb
MATLAB
1,385
45
function tf = isfield2( S, fs, isinit ) % Similar to isfield but also test whether fields are initialized. % % A more comprehensive test of what fields are present [and optionally % initialized] in a stuct S. fs is either a single field name or a cell % array of field names. The presence of all fields in fs are teste...
8d6334c92544ee3144d5fb48027ad9ccaf7ea3e1d93707102f9e9ab3a07b806a
MATLAB
1,385
48
function V = LinearVelocity(X,smooth) %LinearVelocity - Compute instantaneous linear velocity. % % Compute linear velocity for a time-varying vector X. % % USAGE % % V = LinearVelocity(X,smooth) % % X the time-varying vector given as a list of triplets [t x y] % smooth optional standard ...
0f120e126e6ed1c423dc0258cc831547f834cafe19d63cd72d6f9f514ae46cd2
MATLAB
1,386
62
function [P] = Conv_Lstm(fz,data_x, target_y,data_test) % Input paramters (arguments) are: % data_x: 4-D double containing the input data in the following form % [128 1 1 numberOfReadings] % target_y: 1-D Categorial containing the signal labels % [numberOfReadings 1] %%%%%%%%%%%%%%%%%%%%%%%%%%...
241724dbf6f5ba3507d7b02c10f3e1b5ee0381516f6938138d174abff8af8071
MATLAB
1,386
47
function y = CBIG_MFMem_rfMRI_simBOLD_downsampling(x,bin) %-------------------------------------------------------------------------- % y = CBIG_MFMem_rfMRI_simBOLD_downsampling(x,bin) % % Function for reducing data samples of x {n x samples} columns , i.e. bin=8, % put 8 points together, only count the first number ...
6114958c546e312333dab64a5038e3a8d475ceb1c6863e620156da1e08397aa1
MATLAB
1,386
41
% Calculate the forward matrix based on the cortical segmentation. % Assume the headmodel was exported from Brainstorm as bs_headmodel assert(size(bs_headmodel.Gain, 2) == length(rm)*3) lfd_free = bs_headmodel.Gain; lfd = lfd_free2fix(lfd_free,bs_headmodel.GridOrient); fwd = fwd_to_rmfwd(lfd, rm); save('../anatomy/...
7ee482aaf78fcbf22535410641127451ee7a42eb6eb281727b738f2d3c663134
MATLAB
1,386
40
function ret = make_links_in_normalization_dir() ret = true; loadParameters; src_dir = relpath(params.normalizedImagesDir,params.colorCorrectionImagesDir); old_dir = pwd; cd(params.normalizedImagesDir); for do_downsample = [true,false] if do_downsample && ~params.DO_DOWNSAMPLE ...
b78046b311333bd138b4895ce82ee7a1a72204f62662d35faf28e5ee29dc5f50
MATLAB
1,386
57
%% Run NaiveBayes on the mnist data % %% % This file is from pmtk3.googlecode.com loadData('mnistAll') % train_images: [28x28x60000 uint8] % test_images: [28x28x10000 uint8] % train_labels: [60000x1 uint8] % test_labels: [10000x1 uint8] seed = 0; rand('state', seed); randn('state', seed); digit = 7; ndx = find(mnist...
30a30f6a3e5fae311179b25eec43378ab9c015326a783f71d34b5a1b52f27492
MATLAB
1,387
32
function spread = generate_spread_values(inp) switch inp case 'wurth_led' dang = [0 10 20 30 40 50 60 70 80 90]*pi/180; % angle for directional radiation - angles in radians drad = [1.0 0.99 0.97 0.90 0.82 0.67 0.50 0.34 0.16 0]; % for the wurth LEDs sz = [0.15 0.15]; case 'visha...
31db6612d7c60ff370fc9d1317634db152e49043bd03199df226a8aee38fc7fb
MATLAB
1,387
43
function a = subsref(t,s) %SUBSREF Subscripted reference for a ttensor. % % Examples % core = tensor(rand(2,2,2)); % X = TTENSOR(core, rand{4,2), rand(5,2),rand(3,2)); % X.core %<-- returns core array % X.U %<-- returns a cell array of three matrices % X.U{1} %<-- returns the matrix corresponding to the fir...
5337459c02c9e9b3efe65f5f7066519274d8d3db4b8fad177d26a32b453eebc7
MATLAB
1,387
50
%% Visualize word-document binary matrix % %% % This file is from pmtk3.googlecode.com loadData('20news_w100'); % documents, wordlist, newsgroups, groupnames X = documents'; % 16,642 documents by 100 words (sparse logical matrix) y = uint8(newsgroups); % class label, 1..4 classlabels = groupnames; %% Visualize ra...
5b1087a51ba2615ba018ec68de84c1b8a06084b61313fe19df93ee75c40b949c
MATLAB
1,387
50
function y = centroid(M, x) % Attempts the computation of a centroid of a set of points on a manifold. % % function y = centroid(M, x) % % M is a structure representing a manifold. % x is a cell of points on that manifold. % This file is part of Manopt: www.manopt.org. % Original author: Nicolas Boumal, Dec....
80831e00a6554c8dce86293b6a38806d59036b433951047286534d5d204fa11e
MATLAB
1,387
33
areatxt{1} = 'lip'; areatxt{2} = 'fef'; timevector = -0.15:0.001:0.05; rgb = [0.1 0.4 0.5; 0.7, 0.4, 0.7]; labels = [{'Singleton distr in RF'}; {'Non-singleton distr in RF'}]; clear h for iArea = 1: 2 figtitle = upper(areatxt{iArea}); xlimToPlot = [-0.15 .05]; figure('Name', figtitle , 'NumberTi...
a239ac3aa79f207d1390649d780e9782904c48f191dfaf588a2e4dccf287b478
MATLAB
1,387
52
function [ENLwFC] = calc_ENLwFC(data) % This function can be used to calculate an explicitly nonlinear functional % connectivity matrix for fMRI time series data. data: time*feature % Cf. Kinsey et al. Networks extracted from nonlinear fMRI connectivity exhibit unique spatial variation and enhanced sensitivity to diffe...
b3280c036d47a9abd09562464a6f90fff7cd738b095ac49215da36ebc49b25c5
MATLAB
1,387
46
% this method adds a data frame to the NNdata function self = addDataFrame(self,raw_data,file_idx,spiketimes,label_idx) % tic assert(iscategorical(label_idx),'label_idx must be a categorical') assert(isscalar(spiketimes),'spiketimes must be a scalar') assert(isscalar(file_idx),'file_idx must be a scalar') assert(is...
321ea11f694edd5943b9b60be15c32f181b1e09b54cfbec879d6af69d17585a4
MATLAB
1,388
44
function insertCopyright(noticeText, file, verbose) %% Insert a copyright notice into the specified file % noticeText is a single string, or cell array of strings, one cell per % line and is written as a comment to the specified file - the % % prefixes are automatically added. It is inserted immediately after the % fir...
a0c5d579db85d777563101f6635936a532f0f2309e3bfc8b08aa60f84c39fa38
MATLAB
1,388
43
function [SNReff,bEff] = DWSSFP_SNREfficiency(x,optSample,optScanner,b) %% % calculates DW-SSFP SNR Efficiency % % input: % x = array with diffusion gradient (mT/m), duration of diffusion gradient (ms), difference between TR & gradient duration (incorporating deadtime) and the flip angle % optSample = T1 (ms), T2 ...
ae89e18e07d5817fadf716265b6da8aae189b0602664601d5fb8761ea76caf4f
MATLAB
1,388
53
Q = load('/groups/branson/bransonlab/mayank/PoseTF/janLegTracking/160819_Dhyey_2_al_retrain20160911_v7_cleaned20161101.lbl','-mat'); %% nmovies = numel(Q.labeledpos); newm = cell(nmovies,1); numLabels = []; flyId = {}; missing = false(1,nmovies); for ndx = 1:numel(Q.movieFilesAll) curmov = Q.movieFilesAll{ndx}; ...
fce81222c9840c6ef0674bfb4eeb12a258287bfe0eaf77b84edd5dfeffafe4f1
MATLAB
1,388
37
% ReorderSources.m % Sarah West % 4/4/22 function [parameters] = ReorderSources(parameters) % Tell user what you're doing. MessageToUser('Reordering', parameters); % Make a holding matrix parameters.sources_reordered = NaN(parameters.yDim, parameters.xDim, parameters.num_new_sources); % For each...
f413bf2510067e8671d9a6002b859f79d8d6b6e2b4ac508e28dfbf6b6da91e58
MATLAB
1,389
39
function [HC,EC] = RFT_expectedTopo(u,L,fwhm,c,type,dof) % derives E[EC] and E[HC] for a Gaussian RF defined on a regular lattice % [out] = RFT_expectedTopo(u,L,fwhm,c,verbose) % IN: % - u: set-inducing threshold % - L: length of the lattice % - fwhm: smoothness of the random field % - c: number of unbroken fie...
396e6674802a9d8d6fafb548f5586d0e903ad05e6a8b945ea85710ac0cfec91f
MATLAB
1,390
43
function y=anastep(N,ti); %ANASTEP Analytic projection of unit step signal. % Y=ANASTEP(N,TI) generates the analytic projection of a % unit step signal. % % N : number of points. % TI : starting position of the unit step. % % Examples : % signal=anastep(256,128);plot(real(signal)); % signal=-2.5*anastep(512,301);p...
8396e9717d18fac7d2497866171dbfa2fb945c93024cda4a735adfebd75726f6
MATLAB
1,390
57
pos = NP2*(ip1-1)+ip2; fs = 8; Xtxt = t1; Ytxt = -80; Xtxt1 = t1; Ytxt1 = -85; figure(1),subplot(NP1,NP2,pos),plot(time,x(:,1),'k','LineWidth',1.); hold on; set(gca,'TickDir','out'); set(gca,'TickLength',[0.02 1]); set(gca,'YTick',[-60 -40 -20 0 ],'FontSize',fs); if ip2 == 1 set(gca,'YTickLabel',[-60 -40 -20 0 ]...
188677c4e7f33cd1c72a5a701411adb7f800f6d2d9f1d8b91336146dda1d92b4
MATLAB
1,391
57
function ns = count_squares(I,x1,y1,x2,y2,win); [ny,nx] = size(I); if ((x1-win <= 0) || (x1+win >= nx) || (y1-win <= 0) || (y1+win >= ny) || ... (x2-win <= 0) || (x2+win >= nx) || (y2-win <= 0) || (y2+win >= ny)) ns = -1; return; end; if ((x1 - x2)^2+(y1-y2)^2) < win, ns = -1; return; end; ...
707e5eac87d55826508b576406b0f8eae9c83c6fb29e9e9438e8284489b6b8fb
MATLAB
1,391
49
shiftX1 = 0.19; shiftX2 = 0.02; shiftY=0.195; posX0 = 0.02; switch iexp case {1,2} model_name = ' intact'; par_min = 0.1; par_max = 1; Npar1 = 5; Npar2 = 10; st_min = 0; st_max = time_max; title_name = 'Intact'; posX = posX0; Xmin = 0.5; Xmax = 1; ...
7d1dbd22c9b3343d045eef9a8dabce7ecc13e216b209e73533e37da93433271d
MATLAB
1,391
43
function badlyClippingChannels = meg_findClips(data) clippingChannelsThreshold = 4; fractionClippingThreshold = 0.1; numberExtraZeros = 0; [timeOfData,numChannels] = size(data); diffOfChannels = diff(data); clips = diffOfChannels==0; newClips = zeros(size(clips,1)+2,size(clips,2)); newClips( 2:end-1, :) = clips; di...
8fd7d7fc28ca0e8cdeb60bec09e9deab06a5381cb2857230b451cc302eedb263
MATLAB
1,391
63
load clab_example; sa=prepare_sourceanalysis(clab_example); % plot potential field=randn(118,1); figure;showfield_general(field,sa.locs_2D); % plot coherence coh=randn(118,118); figure; plot_coherence(coh,sa.locs_2D); % plot cortex figure;show_vc_tri(sa.cortex); figure;show_vc_tri(sa.vc{3}); % plot 4 random ...
a93b969d0e61ea9a2c45e18b34d175a3aff8a6c72d144f4115456db9b11f5cee
MATLAB
1,391
60
function [W, Z, evals, Xrecon, mu, iter] = pcaFitEm(X, k, varargin) %% Principal component analysis using EM % %% Inputs % X - n*d - rows are examples, columns are features % % If k is not specified, we use the maximum possible value (rank(X)) % % * See emAlgo for additional EM related inputs %% Outputs % W -...
1bc1b0d1744959dd694dc736475046a4326d19d6041d5d346e193275d1107bb6
MATLAB
1,392
55
function s = fromarray(lpos,varargin) % s = fromarray(lpos,'lposTS',lposTS,'lpostag',lpostag) % % lpos: [npt x 2 x nfrm x ntrx] % % if lposTS not provided, ts will be 'nan' (default upon Labels.new), % and similarly for lpostag [lposTS,lpostag,frms,tgts] = myparse(varargin,... 'lposTS',[],... ...
35661d31f77a3cbf265ac90aede0f9d62679e8122462308ab3cdab213ee10cd5
MATLAB
1,392
41
function [shape] = read_ctf_shape(filename) % READ_CTF_SHAPE reads headshape points and header information % from a CTF *.shape teh accompanying *.shape_info file. % % Use as % [shape] = read_ctf_shape(filename) % where filename should have the .shape extension % Copyright (C) 2003, Robert Oostenveld % % This file...
4234547273560861fefe6c477cab1a2c6c45e8444b960aaaf4d9dd8fdd83ca71
MATLAB
1,392
43
function disprog(i,N,steps); %DISPROG Display progression of a loop. % DISPROG(i,N,steps) displays the progression of a loop. % % I : loop variable % N : final value of i % STEPS : number of displayed steps. % % Example: % N=16; for i=1:N, disprog(i,N,5); end; % F. Auger, August, December 1995. % from a...
36f7752b97dfd9945299e2980ae88d75d1373262b1d3398cc4683fa580a5a55a
MATLAB
1,393
31
function [mu,sigma] = FitMatrixWeights(A, nBins, showFit) % generates new weights based on the weight distribution of adjacency matrix A % considering that A has Gaussian distributed weights % % 1) fits a Gaussian function to the distribution of weights P(A_ij) to estimate mean and std % 2) generates numel(A~=0) Gaussi...
b9ce1eb868753e55e864ae7bcbfea519f8d18730a54c4bedf167729fa09ac760
MATLAB
1,393
52
% HIFDE_SPDIAG_SV_N Dispatch for HIFDE_SPDIAG with DINV = 1 and F.SYMM = 'N'. function D = hifde_spdiag_sv_n(F,spinfo) % initialize N = F.N; n = length(spinfo.i); P = zeros(N,1); % for indexing D = zeros(N,1); % for output % loop over all leaf blocks from top to bottom for i = n:-1:1 % find act...
c61a4e5608347f941988bf0fc0862fd9d6e083ba7831b73e97ac4f576db9a0e0
MATLAB
1,393
52
% HIFDE_SPDIAG_MV_N Dispatch for HIFDE_SPDIAG with DINV = 0 and F.SYMM = 'N'. function D = hifde_spdiag_mv_n(F,spinfo) % initialize N = F.N; n = length(spinfo.i); P = zeros(N,1); % for indexing D = zeros(N,1); % for output % loop over all leaf blocks from top to bottom for i = n:-1:1 % find act...
77d7901d4550926d134159c8994e2487a7e2191620e63260f37e000f8d83e7d3
MATLAB
1,394
52
% HIFDE_SPDIAG_SV_S Dispatch for HIFDE_SPDIAG with DINV = 1 and F.SYMM = 'S'. function D = hifde_spdiag_sv_s(F,spinfo) % initialize N = F.N; n = length(spinfo.i); P = zeros(N,1); % for indexing D = zeros(N,1); % for output % loop over all leaf blocks from top to bottom for i = n:-1:1 % find act...
8774752c02ba29d1665b6e70f5269d79d0de75b5c2e8bf496340dca8d5ac5b80
MATLAB
1,394
52
% HIFDE_SPDIAG_MV_S Dispatch for HIFDE_SPDIAG with DINV = 0 and F.SYMM = 'S'. function D = hifde_spdiag_mv_s(F,spinfo) % initialize N = F.N; n = length(spinfo.i); P = zeros(N,1); % for indexing D = zeros(N,1); % for output % loop over all leaf blocks from top to bottom for i = n:-1:1 % find act...
a57434dfb966bcd514615f8a0fb792c61e28c87fcb871313ae569568f5ca270e
MATLAB
1,394
57
%% Plot the pareto distribution % %% % This file is from pmtk3.googlecode.com figure; hold on; %ks = [3 2 1 1]; %ms = [1 1 1 0.001]; ks = [1 2 3 3]; ms = [0.001 0.001 0.001 0.1]; [styles, colors] = plotColors(); xs = 0.01:0.01:2; nk = length(ks); legendStr = cell(1, nk); for i=1:nk model.K = ks(i); model.m = m...
fddb02acc4a8322ebc72450d0a2147e0d1b83dace07d446b818fd7f3b6919d39
MATLAB
1,394
22
function result = totalFrameCountFromIntervals(startframes, endframes) % Count the total number of frames covered by the intervals in startframes and % endframes. startframes and endframes should be vectors of the same size, % startframes(i) giving the first frame index of interval i, and endframes(i) giving the...
1907dbaa9213f423302260f42feb0dd69bbe34c94fba889cbaaa255c7d16a67a
MATLAB
1,395
43
function hist = read_ctf_hist(filename) % READ_CTF_HIST % Copyright (C) 2010, Arjen Stolk [p, f, x] = fileparts(filename); if strcmp(x, '.ds') % the filename should point to the hist file, not the ds filename = fullfile(p, [f x], [f '.hist']); end fileline = 0; fid = fopen(filename,'r'); % the hist file ...
bc44cc0a6823540e248534d730bfd7ab0a7673f9de2a0b3db9bb96081510d697
MATLAB
1,395
49
function model = mrf2Train(model, y, varargin) % Fit pairwise MRF using ML/MAP estimation with L2 prior % model = mrf2Train(model, y, ...) % y is Ncases*Nnodes (y(i,n) in 1..nStates(n)) % % Optional parameters % % lambdaNode, lambdaEdge : strength of L2 regularizers % This file is from pmtk3.googlecode.com [lambdaNo...
4e41a75761e392c977faf18d81a093edaf0abe2a632d0a18086443696cd90d93
MATLAB
1,396
52
function r2 = VBA_r2 (pred, data, isYout) % // VBA toolbox ////////////////////////////////////////////////////////// % % r2 = VBA_r2 (pred, data, isYout) % coefficient of determination % % IN: % - pred: predictions of the classifier % - data: predicted data. % - isYout: array of flags to exclude datapoints (def...
aaa580875eb27b961bd43efe34b86810f39fb3a61e30b08f35b459994d3e6a1e
MATLAB
1,396
29
classdef CBIG_Yeo2011_unit_test < matlab.unittest.TestCase % Written by XUE Aihuiping and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md methods (Test) function test_example(testCase) % Create output folder script_dir = fileparts(mfilename('fullp...
b3843eda0280fef12c62635d9bdb955ec884c84aed0d5f7289b65f6e1908482a
MATLAB
1,396
51
function [C,dt] = VBA_getNtuples(k,n,verbose) % gets all n-draws (with replacement) from a k-urn. % [C] = VBA_getNtuples(k,n,verbose) % This function construct all the n-tuples that can be obtained (with % replacement) from an urn containing k marbles. % A couple of examples is worth a long description: % % VBA_getNtup...
12a54eed158b456cacdcfadec9951328a1b7a2649d7c3d5d705aa5f84a43e3d0
MATLAB
1,397
50
function final = NLMS_ecg(ACC,ECG,order,gr) %% =========== ECG Artifact Removal with NLMS and ACC signals ======= %% % ---------------------- Remove offsets -------------------------- % ECG = ECG - mean(ECG); for i = 1: 3 ACC(:,i) = ACC(:,i) - mean(ACC(:,i)); end % --------------------- Initialize -------------...
60b22ac9553241528149b2ee9647876a06182de80c4b83d69cf9788e0fc17ac1
MATLAB
1,397
43
function [Ri,Ai,zzi,ni,Xi,Xzetai,zi] = MkSuffStatsBTDR_IncompObs_uneqvar_S_fast(X,Z,hk) % Calculate the sufficient statistics for Bayesian TDR under the model of % incomplete observations on each trial. % % [Ri,Ai,zzi,ni] = MkSuffStatsBTDR_IncompObs_uneqvar_S(X,Z,hk) % N = # trials % P = # input varaibles % n = # neu...
b55c5846a10727f4ff33ef21443446525c7fb7d75e0cd9bc387e76d5cecd32d6
MATLAB
1,397
42
function y=anapulse(N,ti); %ANAPULSE Analytic projection of unit amplitude impulse signal. % y=ANAPULSE(N,TI) returns an analytic N-dimensional signal % whose real part is a Dirac impulse at t=TI. % % N : number of points. % TI : time position of the impulse (default : round(N/2)). % % Example : % signal=2.5*anap...
086de6e478319d9a15ceed7895d1954d4ba20bcc7083c7d7908cf236614940f2
MATLAB
1,398
46
% Returns a random permutation of integers. % % randperm2(n) is a random permutation of the integers from 1 to n. For % example, randperm2(6) might be [2 4 5 6 1 3]. randperm2(n,k) is only % returns the first k elements of the permuation, so for example % randperm2(6) might be [2 4]. This is a faster version of randp...
54acc1b4c4ab9a27aa596ad24ea6437fcc18119d16cec788aa2837a434dffea4
MATLAB
1,398
72
function [XYZ,XYZmm,val,V] = img2voxel(P,varargin) % Given a mask or filtered image file name, % returns XYZ coordinates in voxels and mm % of nonzero, non-NaN voxels % % and img values at these coordinates in val % % .. % Tor Wager 02/04/02 % Modified 2/15/06 to take raw data as well as image name % % .. XYZ =...
a99864b27f4095fa6b8449bf80c8208093bead5bcdfc637ee06a5e60e5efbdc8
MATLAB
1,398
72
function v = lanversion(r,newr) % % LAN version function % % v.0.1.2 --> 10.01.2012 % v.0.1.1 --> 20.06.2011 % v.0.1.0 --> 11.01.2011 % % Documentation in \tex\lan.pdf % only in spanish % % 04.11.2011 % Pablo Billeke %path path = mfilename('fullpath'); path((end-10):end) = []; % lan vers...
deff0833ab99ad976092f75a8dcaf6925f746cbdde7ae67bca78c160b77f4b2e
MATLAB
1,398
58
% AUTHORSHIP % Primary Developer: Stephen Meehan <swmeehan@stanford.edu> % Math Lead & Secondary Developer: Connor Meehan <connor.gw.meehan@gmail.com> % Bioinformatics Lead: Wayne Moore <wmoore@stanford.edu> % Provided by the Herzenberg Lab at Stanford University % License: BSD 3 clause % function [yes,...
e70f1afbcad9b7ea19f873bcfa38aadac01d92c1783da3ef6918a721d7c141cb
MATLAB
1,398
55
function [exp_var1,exp_var2] = kernel_variance(DCM) if ~isfield(DCM,'plot') DCM.plot = 0; end M = DCM.M; % Model Ep = DCM.Ep; % Parameters %% Convert the model to a bilinear form % This helps because there is a closed-form expression for % the Volterra kernels of a bilinear system [M0,M1,L1,L2] = ...
f70246681748241fc503bceaf0cba767de131c75682c67b33b514a80911abefd
MATLAB
1,398
36
ind = 1; data = dir('/DATAPOOL/ERRORMONITORING/SEM_mri_data/P*'); %% for i = 1:size(data,1) data_func = dir([data(i).folder, '/', data(i).name, '/mri/SEM_', data(i).name, '/nifti/func/run*']); fprintf(data(i).name); for j = 1:size(data_func,1) images = [data_func(j).folder, '/', data_func(j).n...
356ddf31285c8424b938cdbf3fab8b67e1db0432d8aa4da0f3ea3c21eed72bb8
MATLAB
1,399
48
%% xvect2px % Generic method for turning a state signal (1 x M) into a (M x N) array %of 0/1, which corresponds the 'probability' of state, represented as %sequential column vectors. If DIM 1 is > 1, then average over p(x) over t %over the same values. % Copyright (C) 2023 Trevor S. Smith % Drexel University C...
6e27d00b94ecbb034ecff8d8fa21a54e1c0946cca3eca02459d945cf7ed60b2d
MATLAB
1,399
56
function [inspk] = wave_features(spikes, cfg) % NOTA: este script es un PLAGIO % NO DISTRIBUIR BAJO NINGUNA CIRCUMSTANCIA % % ************************cfg************************ % - scales % - feature % - inputs % % ********************DEPENDENCIAS******************** % - wavedec (Wavelet Toolbox) % scales = cfg.scale...
8d9eecef92e0c9fd3f29bc60622ba74d4290493b1b571639d3fcde1ff81f1f64
MATLAB
1,399
37
function [argout] = mxDeserialize(argin) % MXDESERIALIZE reconstructs a MATLAB object from a uint8 array suitable % for passing down a comms channel to be reconstructed at the other end. % % See also MXSERIALIZE % Copyright (C) 2005, Brad Phelan http://xtargets.com % Copyright (C) 2007, Robert Oostenveld ht...
33463354c0e27ac5c6ca2731a2742ffe5aad3365ebc6e3a1abe13a4056dd7502
MATLAB
1,400
44
% Basic demo for fitting mixture of Gaussians % This demo first simulates a noisy MoG density profile, whose mode % position and width are then estimated using VBA. close all clear all clc %---- simulate noisy data % Choose basic settings for simulations sigma = 1e-1; % precision phi = [5;-1;1;3]; ...
6f08b85f1bdb7e8f3a1158d2fc5e6d196e4ffea3aed16fcd44e0992f711fa523
MATLAB
1,400
25
function [Epri, Ppri] = bemf3_inc_field_electric_plain_dipoles(strdipolePplus, strdipolePminus, strdipolesig, strdipoleCurrent, Points) % Computes potential and electric field from the dipole distribution via the FMM % at observation points (Points) % % Define source (pole) positions and FMM pseudo charges ...
773a2ae991332d847086d28edddb5c0be87defdcd641eedd5521766c92809666
MATLAB
1,400
46
function [sx, dsdx] = VBA_sign (x, smoothness) % // VBA toolbox ////////////////////////////////////////////////////////// % % [sx, dsdx] = VBA_sign (x) % smooth (ie. derivable) approximation of the sign() function % % IN: % - x: real value % - smoothness: optional parameter that specify the speed of transition % ...
b65158d85dd086ccb7659ef64f6e0f9bde754528ddea82a9400c469e21e045ed
MATLAB
1,400
45
function posterior_predictive(stimulus, response, rt, spstart) % plot posterior predictive as done in Python % see de Gee et al. eLife 2017, figure 4 if ~exist('spstart', 'var'), spstart = 1; end colors = linspecer(2); % recode RTs to be negative resps = unique(response); rt(response == resps(1)) = -rt(response == re...
f21e8a5b97b8e78cd79c01cff84ce23662199615985e5b03c035f6eae5e89880
MATLAB
1,400
51
function makeGif( M, fileName, prm ) % Writes a matlab movie to an animated GIF. % % USAGE % makeGif( M, fileName, prm ) % % INPUTS % M - Matlab movie % fileName - file name of the output gif file % prm % .fps - number of frames per second % .nColor - number of indexes colors % .scale ...
373b4c316df7b9a98e6a679c773872b93b2fa02204586dc1f1dde84d0fbe79ce
MATLAB
1,401
58
function [T, S] = FitzHughNagumo_OriginalTIStimOptimizedParameters(twidth, freq, amp, Fs) init = [-1, -0.6]; tspan = 0:1/Fs:twidth; % ms options = odeset('MaxStep', 0.05); [T, S] = ode45(@(t, s)FNModel(t, s, freq, amp), tspan, init, options); function ds = FNModel(t, s, freq, amp) ix = sum(diag(amp)*cos(2*pi*freq...
942d6a8da7e06c3ae02e53d52518b4f36d86eb20a263a01108b1ad378944bc26
MATLAB
1,401
48
%% Compute empirical distribution of coefficients drawn from a Gaussian ensemble % Exactly k0 elements are non-zero. The resulting marginal is a good prior % for the weights in a sparse linear regression model % % Based on code by Baback Moghaddam %% % This file is from pmtk3.googlecode.com if ~exist('n','var'), n=12...
fda92a466f0b00139b0d26e3a86f9eec2877829a1cf0a5f062d167ea7c91f93d
MATLAB
1,402
55
%% Compare various optimizers on a binary logistic regression problem % This file is from pmtk3.googlecode.com %PMTKslow setSeed(0); % Use classes 2,3 for simplicity Ntrain = []; [Xtrain, ytrain, Xtest, ytest] = mnistLoad([2 3], Ntrain); ytrain = setSupport(ytrain, [-1 +1]); ytest = setSupport(ytest, [-1 +1]); [N...
0c8f51d2d6a0bff6927d10a39006c7928541d6691acb3d0eabfddb443f989c27
MATLAB
1,403
38
function [ xcorr_scores,shifts ] = crossCorr3D(data1,data2,offsets ) %CROSSCORR3D Summary of this function goes here % Detailed explanation goes here border_mask = zeros(size(data1)); border_mask(1:offsets(1)+1,:,:)=1; border_mask(end-offsets(1):end,:,:)=1; border_mask(:,1:offsets(2)+1,:)=1; border_mask(:,end-offset...
8286d0230ac2e036446c8e5147287ad2e03cca79aaa710b1b819791efbd0305e
MATLAB
1,403
48
function [stacky,stdy,gridg,stdg] = VBA_Bin2Cont(gx,y,maxn) % transform binary data into continuous intervals (for display purposes) % function [stacky,stdy,gridg] = VBA_Bin2Cont(gx,y,maxn) % This function first partitions the data according to percentiles of the % empirical disitrbution of conditional likelihoods. The...
b4a7fac94bd5827a1f743ef95d151f1b82065bb5277d2c05613667d54a9b3dbe
MATLAB
1,403
35
function h_roiQuality3(handles) % [currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles); roiobj = [findobj(handles.h_imstack3,'Tag','ROI3');findobj(handles.h_imstack3,'Tag','BGROI3');... findobj(handles.h_imstack3,'Tag','annotationROI3')]; for i = 1:length(roiobj) parent...
b8b51ebeb370aef6bff5a8092b1aa3cd2e40576c53c2c5d33abb9ad10523de3c
MATLAB
1,403
50
%% Plot posterior on difference in rates given paired contingency table % MC approx to figure 1a of Shi and Bai 2008 % PMTKneedsStatsToolbox ksdensity %% % This file is from pmtk3.googlecode.com requireStatsToolbox setSeed(1); ns = [20 20 10 50 30]; n10s = [0 1 2 20 28]; n01s = [20 19 4 5 0]; figure; hold on; [styles...
e2f71e2a07e0f0580de92d9f38ffcb5c77eea7d1248367b4af0a2081c45a831d
MATLAB
1,403
36
function out = xpathNode(node, path) % XPATHNODE Shorthand for loading node from xml file % % xpathNode(node, path) %--------------------------------------------------------------------- % license %--------------------------------------------------------------------- % Copyright 2015 I...
2543b4868f7c337ef869d017551ed8fe25125bedd3ce4171b633669398092ff1
MATLAB
1,404
46
function TSexporteventcodes(filename) % TSEXPORTEVENTCODES Exports event codes to a textfile. % TSexporteventcodes(filename) exports codes to an ascii textfile. This % file can be imported later by TSimporteventcodes, or set to the default % codeset using TSsetdefaulteventcodes. % % You can use this to send yo...
48c8fa8f39c7971dcd3d8fe4d3bbd8e168fa8bc409eaa8669ea5a6e7c1671013
MATLAB
1,404
45
% AverageData.m % Sarah West % 4/11/22 function [parameters] = AverageData(parameters) % Display progress message to user. MessageToUser('Averaging ', parameters); % Pull out data. data = parameters.data; % If user says to remove outliers if isfield(parameters, 'removeOutliers') && paramete...
2d1e4764fff9162544fb311b5e317da79ffb2d5115eb4ba8edcf80bc8f7fc916
MATLAB
1,405
38
% Written by Einat Peled % einatspeled@gmail.com % % Get a vector of response amplitudes % ImageArray_CorrAmp_norm_InMax: contains images with highest-value pixels at all response locations function Vector_RF_CorrAmpNormValues_AllNMJ = GetRFAmpValues_Array(ImageArray_CorrAmp_norm_InMax, ImageArray_Max, AllBout...
30ec8ceed75572244f6841db7f9d582d934f6357e66bee9be0e475bdebcce065
MATLAB
1,405
42
function [fx] = f_wslsinGame(x,P,u,in) % "win/stay - lose/switch" strategy in a dyadic game % function [fx,dfdx,dfdP] = f_wslsinGame(x,P,u,in) % The "win/stay - lose/switch" strategy is encoded in terms of the % evolution of pseudo q-values, which swap sign depending upon the % feedback. % In a dyadic game, the feedb...
8637161dc0dade91938363393e8b6af5816f7f557dde68ff40732ff413c2750b
MATLAB
1,405
33
function Wbig = interpolateLarsWeights(Wfull,lambdas,X,y) % Wbig(i,j) = w(j) using lambdas(i) for the L1 penalty in lasso % Input: % Wfull is the output of lars; each row is a solution (gets denser) % lambdas - desired range % X: input data, each row is a case % y: input data % % based on code by Skoglund %% % We have ...
58a8f01d9fd7b03732c7bef3e0c3430d8c1bf277b57bea3efa6bb7176acc14d7
MATLAB
1,406
41
function exportsvn(source, dest, exclusions, createEmpty) % Export and zip up a local svn repository ignoring .svn files % SOURCE: path to the root directory of the svn source % DEST: path to destination including zip file name % EXCLUSIONS: a cell array of directories to exclude from the % zip ...