sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
17k
content
stringlengths
1
200k
db26769df4a983883f30b447311cc0ad366e496a072adc747dc9ae11aa8a9b83
MATLAB
1,303
27
function [all_valid_reaction_times, all_reaction_times, all_hit_reaction_times] = tc_get_reaction_times(parameters) %% all_valid_reaction_times = tc_get_reaction_times(parameters) [... ~, ... all_trigger_values_vec, ... all_reaction_times,... sampling_rate] = tc_get_event_times_from_eeg(... paramete...
8772754539b0797853b4c6869bfc4f8c2d2cdfd323fa783649c7477af5b5d235
MATLAB
1,308
26
function points = genArcSegment(origin, angles, radius, n) %GENARCSEGMENT Generate n points on an arc segment of a given radius % from angle A to angle B around the given origin point % origin: x and y coordinates point the arc is centered around (the % center of the circle the arc is a segment ...
7cde94ebaad0448ab7dde6179f569dda7ba8e3aeaa42bdaa6e01c82a5a386fde
MATLAB
1,312
41
% CURRY 8 M-file, Platform: PCWIN, Created on: 3/2/2018 5:20:36 PM % % curryloc contains mesh locations % currytri contains triangle vertex indices % currylfd(1:3,:) contains leadfield locations % currylfd(4:6,:) contains leadfield orientations % currylfd(7:end,:) contains leadfield % % load mat file load ('LFD_Fxd_Ver...
bd9f2beacbf9c9728e9da1a53ffb410ae9d8c9a0a5ca12adaaa55b6f6eb4aa02
MATLAB
1,312
41
% CURRY 8 M-file, Platform: PCWIN, Created on: 3/2/2018 5:20:24 PM % % curryloc contains mesh locations % currytri contains triangle vertex indices % currylfd(1:3,:) contains leadfield locations % currylfd(4:6,:) contains leadfield orientations % currylfd(7:end,:) contains leadfield % % load mat file load ('LFD_Rot_Ver...
8795c1a809fb857b449c97dcbfec794963930904f367145a7b1a248afe64b9a8
MATLAB
1,318
31
clear data_cube = nan(2,2048,100); % initiate empty 3D matrix for j = 1:100 % Set the pseudo-EEG signal data_cube(1,:,j) = [zeros(1,1024) linspace(0,-4,1024)]; % set the exact same pseudo-RP for all trials % Set the phase signal per trial % At each if-statement the last item added inside the circshif...
cfc61d6a037a3d592af10e8f610bedcf4c60ec19a5421420b75439d1d5fb57a4
MATLAB
1,318
33
function data_load = spt_simulate_confined_brownian_motion() input_values = inputdlg({'number of particles:','time step:','number of time steps:','diffusion coefficient: (um^2/s)','size:','trap diameter (um)'},'',1,{'100','0.05','200','0.001','5','0.05'}); if isempty(input_values)==1 data_load = []; else n...
8cbf4beba36c3fce555d676cf72af8fcc0b2719e97277d6af3c95a3bd6e14148
MATLAB
1,321
50
function [ Dofl ] = extracting_data_LBPD_D( listfl ) % Extracts data from each subject (SPM objects) and store it (with a % corresponding label) in a single file. % The SPM object should be a 2D or 3D data (channels x time-points x % trials). % This function is thought to be used before preparing_baseline_from_resting...
57118f345b4c5ea20c249fc1825322db422851397ad85e17da643da562e9d84e
MATLAB
1,322
32
function Show_GC_coef_subfun(R,P3,NROI,colormapshow,enhanind,outdir,outname,width1,width2) Hsize = get(0,'ScreenSize'); Bsize = min(Hsize(3),Hsize(4))*0.9; Bsize2 = Bsize; POSm1 = [20,20,Bsize2,Bsize2]; Hm1 = figure('pos',POSm1); R(isnan(R)) = 0; R(isinf(R)) = 0; maxv = max(abs(R(:))); axHm1_1 = axes('parent',...
86e68a01b0648224241b7c1284a5ce3c0e61bf8ffdba55ade376be0d7c78cb49
MATLAB
1,333
25
function [data_above,data_below] = loc_list_voronoi_seperate_based_on_percentile(data) answer = inputdlg({'Voronoi Area Percentile Value (%):'},'Input',[1 50],{'40'}); if isempty(answer)~=1 percentile = str2double(answer{1}); for i = 1:length(data) threshold_val = prctile(data{i}.vor.vorono...
c01c96f81fb8ef481f22a1c513d29fe52d7e6b6d61f1cf2dbe1ddb58627838f3
MATLAB
1,339
45
function [v,data,namelist] = Dynamic_read_dir_NIFTI(sub_dir,filter_str) if nargin==1 filter_str = ''; end flag = 0; [fpath,name,ext] = fileparts(sub_dir); if strcmp(ext,'.nii')||strcmp(ext,'.img')||strcmp(ext,'.hdr') if strcmp(ext,'.hdr') niiname.name = [name,'.img']; else niiname....
04fa9beea26ee806aa0b6f1b4939c0cdd1df8103edd9891344ca08d746b43fd3
MATLAB
1,340
44
function surf = SurfStatAvSurf( filenames, fun ); %Average, minimum or maximum of surfaces. % % Usage: surf = SurfStatAvSurf( filenames [, fun] ); % % filenames = n x k cell array of names of files. % fun = function handle to apply to two surfaces, e.g. % = @plus (default) will give the averag...
6a16eae64490b6016f0dcdd48509cca7d127c1fe992e95bc287a058848c3473c
MATLAB
1,341
49
function [CIJ,K] = makefractalCIJ(mx_lvl,E,sz_cl) %MAKEFRACTALCIJ Synthetic hierarchical modular network % % [CIJ,K] = makefractalCIJ(mx_lvl,E,sz_cl); % % This function generates a directed network with a hierarchical modular % organization. All modules are fully connected and connection density % decays ...
5e0ccde4048f1f6195d36c9d001eb446290bb2c9e199f1f1506033e212808fe4
MATLAB
1,342
39
function fig = createFigure(w, h) %CREATEFIGURE Create and return a figure, with appropriate title, %toolbar, etc. settings. % w: width in pixels % h: height in pixels fig = figure('Color', 'w', 'Resize', 'off', 'Name', 'NLA Figure', 'NumberTitle','off'); %fig.Icon = [findRootPath() 'th...
6d0784d17370a1a5f94c0bb706f8240807d8e1c0c259f611d19504d08de18126
MATLAB
1,345
50
function [t,p]=emart2(I,NI, m1, s1, m2, s2, m0, s0) w0=0.001; w1=0.6; w2=0.399; N=sum(NI); %disp([m1, s1, m2, s2, m0, s0, w0, w1, w2]); iter=0; while iter<80, p0=exp(-1/2*((I-m0)/s0).^2)/sqrt(2*pi*s0^2); p1=exp(-1/2*((I-m1)/s1).^2)/sqrt(2*pi*s1^2); p2=exp(-1/2*((I-m2)/s2).^2)/sqrt(2*pi*s2^2); p0o...
7e8e3c12b37c889d1424dec7179b18efe5ac3359993d484efbcd931542dbfb5b
MATLAB
1,349
46
track(:,1) = [3,9]; track(:,2) = [10,50]; image = zeros(50,50); track_intp = interpolate_track_inside(track); track_intp = unique(track_intp,'rows'); tracks_image = zeros(size(image,1),size(image,2)); for i = 1:size(track_intp,1) tracks_image(track_intp(i,2),track_intp(i,1)) = 255; end figure() x = 0:...
27951090c5498e58ed8ffa848251b22f5006829b01fdfc810ea35d416124da43
MATLAB
1,352
46
%%%% EXTERNAL FUNCTION % function taken from the LiNGAM package % complete software may be downloaded from http://www.cs.helsinki.fi/group/neuroinf/lingam/ function [Bopt,optperm] = sltprune( B ) % Finds an identical row and column permutation so that the permuted % B is approximately strictly lower triangul...
b2de630f87b95b11410525203f8b1b8ba8969eeb6b47916e73b99909c53966c1
MATLAB
1,359
44
function filepath = getPathToFileContainingString(folderPath, searchStr, extension, omit) % Author: Milena Capiglioni % Check if an extension is provided if nargin < 3 extension = ''; % Default to empty string if not provided end if nargin < 4 omit = ''; end % List all fi...
955f36883539aa9ab2aaaf0f1f575386e4dd52405cdbf18abdab24c33f57aff4
MATLAB
1,368
42
%% Make results files for all subjects if ~exist('mainpath','var') clearvars % current working directory needs to be /path/to/scripts mainpath = pwd; else clearvars -except mainpath end addpath([mainpath filesep 'toolboxes' filesep 'fieldtrip']) addpath([mainpath filesep 'toolboxes' filesep 'tc_functio...
e260469d32fd6cc4d807a0aeb5d982f14d67bd12a4c560a269829484aaacf677
MATLAB
1,371
39
function loc_list_clusters_scatter_no_of_locs_area(data) counter = 0; for i = 1:length(data) data_to = unique(data{i}.area); if length(data_to)>1 counter = counter+1; data_to_send{counter} = data{i}; end end if exist('data_to_send','var') scatter_locs_area(data_to_send) el...
6b9d7ec11a238a264250dfef53c6c54f0a248f53728b288ac0f5c70c48ecae83
MATLAB
1,372
50
%% IDENTIFICATION OF STRICTLY CAUSAL MVAR MODEL: Y(n)=A(1)Y(n-1)+...+A(p)Y(n-p)+U(n) % makes use of autocovariance method (vector least squares) %%% input: % Y, M*N matrix of time series (each time series is in a row) % p, model order % Mode, determines estimation algorithm (0:builtin least squares, else other m...
555d50fa3871875948e64e3b59d13365800fdaad9999676be1cbae19fa82dacd
MATLAB
1,381
33
function s_counts = getGeneCounts(s_sam_file, genes, chrs) % Return a cell array of vectors containing the read counts. % s_sam_file - Sorted SAM file name % genes - DataMatrix object containing these columns in such order: % gene names or ids, % chromosome name, % gene ...
98da523799f5e2c6b76c2ae728ab0828a7d33001e5f774bedd4b866837029661
MATLAB
1,381
48
% Expand a multiple-scan NIFTI file into multiple single-scan NIFTI files % % Usage: expand_nii_scan(multi_scan_filename, [img_idx], [path_to_save]) % % NIFTI data format can be found on: http://nifti.nimh.nih.gov % % - Jimmy Shen (jimmy@rotman-baycrest.on.ca) % function expand_nii_scan(filename, img_idx, n...
e32019c0db95ebf1f68ba056302a124023bc57b1b0c1d4d794147673131ada60
MATLAB
1,381
33
function [cellMap,nROI] = cellDetectFun(tiffData,minSiz,Tbin) % This function takes a TIF stack in input and detects the active ROIs % (such as astrocytes or neurons) present over the entire recording. % ----------------------------------------------------------------------- % % *** Inputs *** % * tiffData * = TIF file...
a34513d4e334cdd2e085c69f7a06743151256e942a4e5a5d57d03a8064b72a09
MATLAB
1,382
52
%% generation of vector FT surrogates (phase randomization) % Note: the length of the series should be not be odd %%% input: % Y, M*N matrix of time series (each time series is in a row) %%% output: % Ys, M*N matrix of surrogate time series (each time series is in a row) function Ys=surrVFT(Y) Y=Y'; %tra...
a861136aa9f3ccd46533aba507bbc0ab829e85f1c699a00011630200e3e46098
MATLAB
1,383
58
function imagesc_all_units=Ripple_Colorplot(Ripple_Variable, Treatment, bins) if strcmp(Treatment,'RGS') a=2; b=3; else a=4; b=6; end imagesc_all_units=[]; numbin=bins; % start loop here for index=1:length(Ripple_Variable) disp(index) Unit=Ripple_Variable(index).Ripple_Spike_Tim...
9b07c2ef657409642d2eed06a0c79db3f144f41e0e135cb87d68bb24562f9f7f
MATLAB
1,385
38
function loc_list_save_bin(data) path = uigetdir(pwd); if path~=0 for i = 1:length(data) f = waitbar(0,['Saving .bin File',num2str(i),'/',num2str(length(data))]); save_to = fullfile(path,[data{i}.name,num2str(i),'.bin']); data_save(:,1) = data{i}.x_data; %x data_save(:,2) ...
f4f43652d980807fca77014f3d745ad1dd0fa1aadb1a9ab9e125c5c19a0385cb
MATLAB
1,386
33
function plotNetTriMatrix(fig_h, net_atlas, plot_data, sig_matrix, plot_settings) % color_map: [1001×3 double] % statistic_plot_matrix: [1×1 nla.TriMatrix] % p_value_plot_max: 0.0500 % name_label: "Welch's T-test Full Connectome Method↵Network vs. Connectome Significance↵Unco...
71e8ca2cc22afece1029f9e56ecd1808003090ca9d588a4d004224c9f8460975
MATLAB
1,389
40
%% run time figure loglog([1 10 100 1000 10000 100000],[64/60 104/60 129/60 141/60 8 111],'b-o') hold on loglog([1 10 100 1000 10000 100000],[90.8/60 102.4/60 103.8/60 138.7/60 48 144],'r-o') % waiting for original results title('COMET: Running Time') xlabel('# Spectra'); ylabel('# Minutes'); legend('Classic',...
a149af6b6471c0fe84fca1d45488118693553403b2be9bfdeeccc6aa6f1af27e
MATLAB
1,389
37
%% read pep=xlsread('L:\Qexactive\Ani\PepMixWJPT.xlsx'); prot=xlsread('L:\Tony\121116_CSR_SILAC_Qexactive\SILACproteinGroupsQE.xlsx'); lfq=pep(:,[16:20]); ibaq=pep(:,[21:40]); int=pep(:,[1:4]); %% protein abundance hist((prot(prot(:,33)>0,33)),[100]) % raw intensities, area under curve? hist(log2(prot(prot(:...
02c6bd5ba4fe9ba1cfac49cefc50fbd0dae21fa32c9de46369eea4cdac375e65
MATLAB
1,391
37
function viewSilhouetteCoeff(fig, input_struct, remove_index) prog = uiprogressdlg(fig, 'Title', 'Generating figures', 'Message', 'Calculating silhouette coefficient'); prog.Value = 0.02; %% Remove selected network (usually, the 'None'/unspecified network) plot_label = 'FC Average (Fisher Z(R)...
500df8e6ca8f50c5b64a7a488e8fb19d0114dec6c5a13b89598bbd2c7657ca05
MATLAB
1,397
48
function [info, data]=read4dfp(filename) % % Program to read 4dfp format data. % % Yi Su, Jan 2011 %Processing filename [path,name1,ext1]=fileparts(filename); [dum,name2,ext2]=fileparts(name1); if (isempty(ext1)) name=[name1 '.4dfp.img']; nameroot=name1; elseif (isempty(ext2)&&strcmp(ext1,'.4dfp')) nam...
98cad35962f680d91dc0ec3fee9060268a2bc971ffbc247a71a4408ddabe995e
MATLAB
1,397
53
classdef ArFitTest < matlab.unittest.TestCase properties sigma N end methods(TestMethodSetup) function setup(testCase) testCase.sigma = sqrt(0.2); testCase.N = 1024; end end methods(Test) functi...
58c8582a1a93ffd0d4ca9f939034abbfadf8a42031cb467d98b98425bc607089
MATLAB
1,402
52
function varargout = process_memo( varargin ) eval(macro_method); end function sProcess = GetDescription() %#ok<DEFNU> sProcess.options.text.Comment = 'Text: '; sProcess.options.text.Type = 'text'; sProcess.options.text.Value = 'the text'; sProcess.options.flag.Comment = 'Check box'; sProcess.options.flag.Type...
cb29f67d089eb96ddc0a87de182febabe303156c4972d018543826338e6af783
MATLAB
1,402
41
% % perform a quick sanity check % uint64(4) + uint64(2) uint64(4) - uint64(2) uint64(4) ./ uint64(2) uint64(4) .* uint64(2) %% read prot=xlsread('L:\Elite\LARS\2014\juni\Pseudomonas\PesudoSproteinGroups.xls'); prot=prot(:,5:8); %% check plot(prot) histfit(prot(~isnan(prot))) data=dataset('XLSFile','L:\Results\I...
abcfaa000dad97956a967b815145406d1445920e4e700a38e5fb1e2734977bfc
MATLAB
1,403
38
function v=dynamicBC_Reslice_forshow(PI,hld,TargetSpace) % PI - input filename % PO - output filename % NewVoxSize - 1x3 matrix of new vox size. % hld - interpolation method. 0: Nearest Neighbour. 1: Trilinear. % TargetSpace - Define the target space. 'ImageItself': defined by the image itself (correspon...
16536ce0c2accd2fcba0181e4a9bc1301ac307f2936bd77de34a6c674a1a5ec1
MATLAB
1,404
45
function [Erange,eta,Eshort,fs] = erange(CIJ) %ERANGE Shortcuts % % [Erange,eta,Eshort,fs] = erange(CIJ); % % Shorcuts are central edges which significantly reduce the % characteristic path length in the network. % % Input: CIJ, binary directed connection matrix % % Outputs: Erange, ra...
13072b3b03d1bf261cd26ee722828324be9d6a1fb2335e19d14b2c8db7fda124
MATLAB
1,417
48
function shape_classification_save_results_selected_clusters(data) classes = data.classes; for i = 1:size(classes,1) colors{i} = unique(cell2mat(classes{i,4})); end colors = unique(vertcat(colors{:})); c_map = colormap(jet); c_map = interp1(1:256,c_map,linspace(1,256,max(colors))); path = uigetdir(); ...
3b367a69be7659e43058dc5f4693f7cd78b4fd488db51ed3b6e7f6a7b42f3f52
MATLAB
1,422
43
function MCmoduleStream = Pick_MCModuleStream(dFCstream, Modules, m) % FUNCTION MCmoduleStream = Pick_MCModuleStream(dFCstream, Modules, m) % % This function takes as input: i) dFCstream is a dFCstream object generated by % TS2dFCstream, in either stream or 3D formats (with N regions); % ii) a vector Modules of size N...
dd90962cd06f949d237f2129bce11034c02ff8cd225cb9dcc4308b578efe511a
MATLAB
1,424
64
function demo_lcmv(sim,type) path_ = pwd; addpath(genpath(strcat(path_,'/MVAR_simu'))); addpath(genpath(strcat(path_,'/two_step_est'))); addpath(genpath(strcat(path_,'/misc'))) meas_snr=5; bio_snr_vals=[1 3 5 10]; bio_snr_arr=repmat(bio_snr_vals, [50 1]); T=5000; num_bio_ns=1000; num_sources = 3; dist_thr = 30; %loa...
f78464e5b11eca026e734a26f8c8569701328cdde0cca00f2c7d348f5cf38bc4
MATLAB
1,425
37
function shape_classification_filter_area(data) classes = data.classes; input_values = inputdlg({'Area Filter Value:'},'',1,{'10'}); if isempty(input_values)~=1 min_area = str2double(input_values{1}); for i=1:size(classes,1) for j = 1:length(classes{i}) area(j,1) = classes{i,2}(j,2); ...
da605d3552e8ea8fe7d51d4785d906309626b2cbd9007def27995ac012bc530f
MATLAB
1,426
37
function shape_classification_filter_mass(data) classes = data.classes; input_values = inputdlg({'Mass Filter Value:'},'',1,{'100'}); if isempty(input_values)~=1 min_mass = str2double(input_values{1}); for i=1:size(classes,1) for j = 1:length(classes{i}) mass(j,1) = classes{i,2}(j,1);...
9d57e7e192efecfea24b7e7c23d2539f7c4c705fb7d27461aeab404029d7bfa6
MATLAB
1,428
59
%% PORTMANTEAU TEST FOR AUTOCORRELATION [from Luetkepohl 2005, New introduction to multiple time series analysis] % null hypothesis: joint whiteness % if pp<alpha, reject -> non white function [pp,Qh,critlo,crithi,crit1tail,C0,stringout,stringflag]=test_whiteness(u,p,h,alpha); % %%% input: u, p, alpha, h % u: ...
a3000717032cc5b354e0c6a5097cc6724b983f3e929c351c27a2bad9a94f8f48
MATLAB
1,428
34
function [si_vals] = silhouetteCoeff(fc_avg, networks) %SILHOUETTECOEFF Calculate silhouette coefficient % fc_avg: TriMatrix of average functional connectivity values % networks: Vector of objects which must implement IndexGroup, ie: % have a name, color, and a vector of indices corresponding ...
6d2b85ed27423189ca8f7ca65a6764fc2823fe5ef29d8db28b5487936afa8038
MATLAB
1,430
65
function [t] = fl_cell_tstat(Cell,w) % Computes a 1-sample t-statistic using cells % % The variables are expressed in cells for speed % This function is part of the permutationlab software: % Author: Dimitrios Pantazis % The code is currently under development, please do not share wflag = exist('w'); %w is ...
4a60bb42cd2e64498009db3510468e7c3755cf6966be6e9e844ba3c87783fb36
MATLAB
1,433
33
function shape_classification_features_box_plot(data) clf(figure()) set(gcf,'name','Features Info','NumberTitle','off','color','w','units','normalized','position',[0.1 0.2 0.4 0.6],'menubar','none','toolbar','none') no_of_classes = size(data.classes,1); slider_one_value = 1; if no_of_classes>1 slider_one_st...
06aec7dbff8cbb27b269e1cc3fa9419635771965dd8d414307137b1394d40dba
MATLAB
1,436
68
function [T, m_vol] = mipp_time_2_commonTime_v2(T, refID) % function [T, m_vol] = mipp_time_2_commonTime(T, refID) % % Creates a t_shift that is the time that matches starting-time volumes. % Set t from start uID = unique(T.ID); T = addvars(T, ones(size(T.Vol_cm3)),'NewVariableNames', 't_from_start'); for i = 1:numel...
0dbad4f5f41e4644df277cdae2a76ab25b2179c1e103fe9e2b0133f88c13dcd2
MATLAB
1,438
48
function [J,J_od,J_id,J_bl] = jdegree(CIJ) %JDEGREE Joint degree distribution % % [J,J_od,J_id,J_bl] = jdegree(CIJ); % % This function returns a matrix in which the value of each element (u,v) % corresponds to the number of nodes that have u outgoing connections % and v incoming connections. % % Input...
891fbc7960fb889d217e2edac5ff8ae0df755957eba7f8fe05bfbb4e35777a66
MATLAB
1,445
35
function C=clustering_coef_bd(A) %CLUSTERING_COEF_BD Clustering coefficient % % C = clustering_coef_bd(A); % % The clustering coefficient is the fraction of triangles around a node % (equiv. the fraction of node's neighbors that are neighbors of each other). % % Input: A, binary directed c...
11c5a0081e3af32fe4ebcf4536d7108321a931af1225f86ace6476ed02ff6c17
MATLAB
1,448
44
function maskROI = SurfStatROI( centre, radius, surf ); %ROI on the surface or volume with a given centre and radius. % % Usage: ROImask = SurfStatROI( centre, radius, surf ); % % centre = id number of vertex, or % 3 x 1 vector of [x; y; z] coordinates in mm. % radius = radius, mm. %...
2597b4fe43e49d4ede3eb5de61735382eba3bd162f707be40feb8ea559173ce2
MATLAB
1,452
36
function []=Writeifh(filename, ifhdr) %Processing filename [path,name1,ext1]=fileparts(filename); [dum,name2,ext2]=fileparts(name1); if (isempty(ext1)) name=[name1 '.4dfp.ifh']; elseif (isempty(ext2)||~strcmp(ext2,'.4dfp')||~strcmp(ext1,'.ifh')) error('Invalid File'); else name=[name2 '.4dfp.ifh']; end ...
2d6b0e1b0e667ccbe08df4eaec6307dc3a877d326b6f43476f03747b7f7dee63
MATLAB
1,454
48
function [data_crop,data_outofcrop,Int] = loc_list_roi_DualChannel(data,Int) global Int if isempty(Int) Int = 0; end try coordinates = getline(); data_crop = cell(1,length(data)); data_outofcrop = cell(1,length(data)); for i = 1:length(data) [data_crop{i},data_outofcrop{i}] =...
8e18cde18824a31b7aa705c11678707b8670c8f240a1e0fdf10d74cfe59b0bff
MATLAB
1,454
31
classdef PermutationTree < handle %PERMUTATIONTREE Base class for permutation groups. This just bundles all the permutation nodes % together for ease. % % tree = PermutationTree(input_data, permutation_groups) % tree = The tree object. Consists of the raw permutation groups along with the raw data ...
1dec4938389b0f03a0e9e992baba9fd92b02c3ae2f41f1099d3dcfdd254514e6
MATLAB
1,457
53
% current working directory needs to be /path/to/scripts mainpath= pwd; addpath([mainpath filesep 'toolboxes' filesep 'fieldtrip']) addpath([mainpath filesep 'toolboxes' filesep 'tc_functions']) ft_defaults %% close all for subject=1:52 %% tfData = dataTF; figure %load([mainpath '/../subjectData/S' num2...
fbb4645d0b59252d1061657a87dd786e1c0831d4cf2209909166b8e423d2ebd3
MATLAB
1,458
49
function data_out = calcArea(data) clusters = extract_clusters(data); xRef = cellfun(@(x) x(:,1),clusters,'UniformOutput',false); yRef = cellfun(@(x) x(:,2),clusters,'UniformOutput',false); shpRef = cellfun(@(x,y) alphaShape(x,y),xRef,yRef,'UniformOutput',false); CritAlpha = cellfun(@(x) criticalAlpha(x,'one-r...
51ce6b5003c2eda5b4d1db803be3db7e7422ef017f75466e0598de6d1d584405
MATLAB
1,460
35
function conn_matrices = load_group_fc(name,parcel_number,group) % LOAD_GROUP_FC loads group level connectivity matrices. % % conn_matrices = LOAD_GROUP_FC(name,parcel_number,group) loads sample % group level connectivity matrices of the HCP dataset. Name can be set % to 'vosdewael' for a subparcellation of the...
a4c8f6bcfbe821ab1aca2f82205b4f1003faaef30fcf8923b1425952293cf9d1
MATLAB
1,471
40
function spm_batch = tc_make_spm_fmri_batch %% spm_batch = tc_make_spm_fmri_batch % creates spm_batch which is a template file for running spm_jobman() % creat SPM batch file (note that some fields must be present in order to make SPM tun even tough they are not used here) spm_batch = {[]}; spm_batch{1}.spm = []; spm_...
ffef8575ed01018ad08f7dc3f95c66a6fd9378ed0d1925597799efb8cd59e23f
MATLAB
1,471
50
function M=find_motif34(m,n) %FIND_MOTIF34 Motif legend % % Motif_matrices = find_motif34(Motif_id,Motif_class); % Motif_id = find_motif34(Motif_matrix); % % This function returns all motif isomorphs for a given motif id and % class (3 or 4). The function also returns the motif id for a given % ...
b12ba64a36b88475e846a0aa2b3175cbd144d1cdde93a460db308a0223fbae15
MATLAB
1,472
39
classdef BaseTest < nla.Test %BASETEST Base class of tests performing edge-level analysis % The intended behavior of the run function of an edge-leve test is that % it creates a new result object on the nonpermuted run and accepts % said result as previous_result on all subsequent permuted runs, % m...
480806a4bfbb812beac9b1cded624600343ad2e08e77379de5cdc1ed2d83a5ef
MATLAB
1,476
48
function shape_classification_save_results_jpg(data) classes = data.classes; path = uigetdir(); if path~=0 mass = classes(:,3); mass = vertcat(mass{:}); mass = mass(:,1); [~,I] = mink(mass,size(classes,1)); classes = classes(I,:); for p=1:size(classes,1) mkdir(fullfile(path,num...
dd9cb9d15e29ce5b26a6397f45d4fa474a4e7afd90ad6211b1d37a1faeecbbb2
MATLAB
1,477
32
function [cr,corrCurve,corThresh] = pairCrossCorr(diffToBaseAll,varList,dT) % This function builds the correlation curve based on the pairwise Pearson % correlation coefficient (computed by the Matlab function corr) of all the % corrected signals in *diffToBaseAll* % ----------------------------------------------------...
d6b985dfa0513e5ae82d4cda44f8619d3169ec1e8d83380db0606b1cb1d1dec5
MATLAB
1,478
56
classdef Button < nla.inputField.InputField properties name display_name callback = false plot_figure = false label = false field = false end properties (Constant) padding = 12 end methods function obj = Button(name, display_nam...
d345db198e35ef0a8862d88b9224e0684a9f28d1936a8bcfad8e7a8bde12d2d6
MATLAB
1,480
41
function [prop, error_list] = nst_get_tissues_optical_properties(tissues, wavelength, FilesTissuesProperty) if nargin < 3 || isempty(FilesTissuesProperty) FilesTissuesProperty = fullfile(fileparts(which('nst_get_tissues_optical_properties')), 'tissues_property.json'); end % [mua, mus, g, n]...
b6b1bbcb0945e1980bb53e0259964333d5eca9ace50ac1246f2e30b991a7b714
MATLAB
1,491
48
function ind = SurfStatCoord2Ind( coord, surf ); %Converts a vertex index to x,y,z coordinates. % % Usage: coord = SurfStatInd2Coord( ind, surf ); % % coord = c x 3 matrix of coordinates for finding indices thereof. % surf.coord = 3 x v matrix of coordinates. % or % surf.lat = 3D logical array, ...
1cd84284ce4510b79d48f3559de9b5aee9beb43fd981d80ea17bed69d38268ed
MATLAB
1,493
54
clear all clc %% NEW GSH FILE TESTER [fname,pathname]=uigetfile('*.gsh') filename=[pathname,fname] fid=fopen(filename,'r','b') fstr=fread(fid,'int8=>char'); %string of chars held in .rsh file fstr=fstr'; fclose(fid); fstr; %% get info from header file k = strfind(fstr,'Data Size =') xs=str2num(fstr(...
861bd24af3bf1c7bb925b08dd0380a44847c7f41759ed31e1031ee12d71464a3
MATLAB
1,494
55
function [pdc_delta, pdc_theta, pdc_alpha, pdc_beta, PDC,f] = get_significant_pdc_mr(x,Am,S, numsurr, nfft, fc, Ns, p) %function [pdc_mean, PDC,f] = get_significant_pdc_mr(x,Am,S, numsurr, nfft, fc, Ns, p) %generate surrogates for is=1:numsurr % surrogates for DC and PDC for ii=1:Ns for jj=1:Ns ...
a0b04b7d98a13f49aebeb855a61ec64178830ed67aef9637d2ca2b44a69070ec
MATLAB
1,495
48
function [ ] = LBPD_startup_D( pathl ) %It adds some required paths and startup OSL.. % INPUT: -pathl: path to functions (character) % % OUTPUT: -starting up.. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % leonardo.bonetti@clin.au.dk % Leonardo Bonetti, Aarhus, ...
621dc5761e93c384d49b862cf40b6f8734dd81986196a676277be8e809f936a5
MATLAB
1,498
36
function loc_list_voronoi_clusters_boundary_points_plot(data) figure() set(gcf,'name','Voronoi Segmentation Clusters','NumberTitle','off','color','w','units','normalized','position',[0.3 0.2 0.4 0.55],'menubar','none') set(1,'defaultfiguretoolbar','figure'); if length(data)>1 slider_step=[1/(length(data)-1),...
604fbc7fc86662e29a2c6eef03f3469981b7ad4b9702c77de9a8a567cf6aeb55
MATLAB
1,503
47
function [Ppos,Pneg]=participation_coef_sign(W,Ci) %PARTICIPATION_COEF_SIGN Participation coefficient % % [Ppos Pneg] = participation_coef_sign(W,Ci); % % Participation coefficient is a measure of diversity of intermodular % connections of individual nodes. % % Inputs: W, undirected connect...
0cb4fe7d38cdd25c2ea25d2a71579eb80da3665f1a0d5f8a5645218be76c91a2
MATLAB
1,510
39
function loc_list_density_plot_voronoi_areas(data) answer = inputdlg({'Maximum Number of Localizations for Down Sampling:'},'Input',[1 50],{'1000'}); if isempty(answer)~=1 num_points = str2double(answer{1}); f=waitbar(0,'Please wait...'); voronoi_data = cell(1,length(data)); for i=1:length(data) ...
9573887241a13b7754a28327bbb74b526db7aee40db2c5809971f2c380ac8265
MATLAB
1,513
53
function t=tquant(n, p) %TQUANT Quantiles of Student's t distribution % % TQUANT(n, p) is the p-quantile of a t distributed random variable % with n degrees of freedom; that is, TQUANT(n, p) is the value below % which 100p percent of the t distribution with n degrees of freedom % lies. % Modified 13-Jul-06 % ...
5e0eb09abc502759c4c8ae674ebfc7e7a72932a02538870fd83225a428524e1a
MATLAB
1,515
50
function [view_angles,surf_id] = process_views(obj) % Converts the input views character arrays to actual view angles and % defines which surfaces to include. Valid views contains the view angle(s) % in the top row, and the surface index (1,2, 3 for both surfaces) in the % bottom row. % % View priority is as follows: %...
de9b99007bbe2476f67e7aed17d4da27b9fda0a89a53a36cab4ffeaadf23f70c
MATLAB
1,515
49
function P=participation_coef(W,Ci,flag) %PARTICIPATION_COEF Participation coefficient % % P = participation_coef(W,Ci); % % Participation coefficient is a measure of diversity of intermodular % connections of individual nodes. % % Inputs: W, binary/weighted, directed/undirected connection ...
94d0889c00f7cda62dc8da9c30ed7fb2b20a1a9bbced786e9446e113e84d0fff
MATLAB
1,517
33
prot = tblread('L:\Elite\Camilla\2016\juni\log2LFQvalues.txt','\t'); [data,id,idx]=xlsread('L:\Results\Ishita\Log2abs0.5.xlsx'); data=dataset('XLSFile','L:\Results\Ishita\Log2abs0.5.xlsx'); prot = tblread('L:\Results\Ishita\Copy of Log2abs0.5 GO.txt','\t'); idx(:,1) protcl=data(:,8:19); clustergram((protcl), 'Col...
8cb253ddae13bde0a63f58678b949e90b45f5c37f2c128348a95a8fc9c92bf01
MATLAB
1,520
50
function nii_path = create_nii__(data_path,output_folder,varargin) aux = strsplit(data_path,filesep); % Default values for your optional parameters name = aux{end-1}; dummy_scans = 0; % Parse the varargin input for i = 1:2:length(varargin) param_name = varargin{i}; param_value...
dbc1b600702ed4338f9c43fd812c6db8d33776b85ed8298004701a17e9f496da
MATLAB
1,522
59
clear all parpool(60) tic Gm = .01:.01:.45; % basline connectivity Gn = 0.005:0.002:0.05; fs = 1; % Preallocate an array for storing results (flattened for compatibility with parfor) num_combinations = length(Gm) * length(Gn); feat = ones(num_combinations, 9); parfor idx = 1:num_combinations % Convert linea...
c252f0108d9080e60b5cafd1b6bf5348e5d0ca1685cd0ad896bf0506e684b850
MATLAB
1,525
52
function piled_data = pile_data(data,name,delname) delname = cellfun(@(x) append("_",x),delname,'UniformOutput',false); delname = horzcat(delname{:}); x = cell(1,length(data)); y = cell(1,length(data)); area = cell(1,length(data)); Channel = cell(1,length(data)); for i = 1:length(data) if ~isempty(data{...
d13ffc3994bad0782674b53e5fb6d7d7e113020d549c573dee0a33725fac13d8
MATLAB
1,538
53
function [X,Y,Z] = adjacency_plot_und(aij,coor) %ADJACENCY_PLOT_UND Quick visualization tool % % [X,Y,Z] = ADJACENCY_PLOT(AIJ,COOR) takes adjacency matrix AIJ and node % spatial coordinates COOR and generates three vectors that can be used % for quickly plotting the edges in AIJ. If no coordinates are sp...
4106690107823384bc677a17b265d33c283285b1a92aed6d9b9d14b7df2ef99b
MATLAB
1,539
59
classdef CheckBox < nla.inputField.InputField properties name display_name default_value = false plot_figure = false label = false field = false end properties (Constant) BOX_WIDTH = 12 end methods function obj = CheckBox(name, disp...
30a4218b444e2f71588b67e6639bc795efe58c9b8433ce0c794aba2bcc8b6824
MATLAB
1,542
59
load('svm_mat555'); [s v t]=size(svm_mat); sn=Design_Para(:,6)'; mn=Design_Para(:,4)'; corrcoef(mn,sn) for i = 1:size(svm_mat,1) for j = 1:size(svm_mat,3) %svm_mat_norm(i,:,j)=mat2gray(svm_mat(i,:,j)); svm_mat_std(i,:,j)=(svm_mat(i,:,j)-mean(svm_mat(i,:,j)))/std(svm_mat(i,:,j)); end end voxmode_std=resh...
2e6448d0103b3edc6d5290661acdb411ae7ab78bbacfe446de8f7d3ee1c3a200
MATLAB
1,556
41
function full_data = parcel2full(parcellated_data,parcellation) % PARCEL2FULL Upsamples parcel data to vertex data. % % full_data = parcel2full(parcellated_data,parcellation) takes n-by-1 % vector parcellated_data and creates a new m-by-1 vector full_data, % where each value in full data corresponds to the parc...
0916d7e03ab5e61508dfdd71ab37aa9dc27a51c13a6ced31b94eb92a0bce0e6c
MATLAB
1,557
45
function [fcyc,pcyc] = cycprob(Pq) % CYCPROB Cycle probability % % [fcyc,pcyc] = cycprob(Pq); % % Cycles are paths which begin and end at the same node. Cycle % probability for path length d, is the fraction of all paths of length % d-1 that may be extended to form cycles of length d. % % Input: ...
e67145a53cef38c565168f2c8fa71d516ef64984d047086f44b578779d6d04cc
MATLAB
1,558
45
function [conv_regs, all_conv_regs_raw] = tc_conv_regs(regs, reg_names, config, inds) %% conv_regs = tc_conv_regs(regs, config, inds) % % regs: cell array with different regressors % config: configuration to be forwarded to spm_jobman in order to perform % the convolution % inds: indices of volumes to be selected (e.g....
30efaa4c46f2fe2cf78f1a318372b441437d3a61f6d7d6b1702a3a57dc59e1a5
MATLAB
1,560
48
% plot thresholds as function of week if ~exist('DATA_ROOT','var'), run(fullfile(pwd, 'matlab', 'config.m')); end load(FIG2_DATA); weeks = []; thresholds = []; for animal_index = 1:6 dayThresholds = daysThresholdsAll{animal_index}(:); daysTrained = ones(3, 1) * daysTrainedAll{animal_index}; daysTrained = d...
a0357a271eb67575f513b746fce28156116c3e830e5fa98446a91b33d79e380a
MATLAB
1,566
46
function [X,Y,indsort] = grid_communities(c) % GRID_COMMUNITIES Outline communities along diagonal % % [X Y INDSORT] = GRID_COMMUNITIES(C) takes a vector of community % assignments C and returns three output arguments for visualizing the % communities. The third is INDSORT, which is an ordering of the ...
a69313ecdac44af3265ea32b0b972b938acf744e24d51c4ff2e8beff2495f705
MATLAB
1,572
49
function new_scout_sel = bst_create_scout(subject_name, surface_type, scout_name, scout_seed, scout_size, atlas_name) assert(isvarname(scout_name)); if strcmp(surface_type, 'scalp') s_isurf = 'iScalp'; elseif strcmp(surface_type, 'cortex') s_isurf = 'iCortex'; else disp('ERROR: surf_type must either be "sc...
ca7b76494c62ecbeac859aab4ccda42039601c8b863ffb10eb471ee61bde834c
MATLAB
1,572
31
function GloEvMat = globalEvtActiv(GlobalEventsTime,realEvts,varList) % This function builds a cell array containing the list of active ROIs and % their peak time for each global event based on *GlobalEventsTime* from % the function globalEvSeg % ----------------------------------------------------------------------- %...
60281829fc2996d33e2d431c6211b37c7d5350e65889ba80a57f55fa4e2131a1
MATLAB
1,575
68
clear maindir =[path_ludisc 'Data\MIPCART pilot\Pilot MRI\\']; % maindir = '\\uw.lu.se\research\msf_fsz\Data\MIPCART pilot\Pilot MRI\MouseReference_Pilot_Feb2023\230206\'; % NOTES dir_name = 'analysis_perWf_'; fnl = fix_findFiles(maindir, '*mcw_DWEpiWavev7_MAGNITUDE_dn_mc.nii.gz'); %% opt = mdm_opt; opt = mio_opt...
84a373a5ee2e4805de28e18ad620dc9d4eb82bee708e4e302d238f63edfdf08f
MATLAB
1,576
53
function A = randomize_graph_partial_und(A,B,maxswap) % RANDOMIZE_GRAPH_PARTIAL_UND Swap edges with preserved degree sequence % % A = RANDOMIZE_GRAPH_PARTIAL_UND(A,B,MAXSWAP) takes adjacency matrices A % and B and attempts to randomize matrix A by performing MAXSWAP % rewirings. The rewirings will avoid...
a0efc2fabda1ab63982daeaf1ce54f2f7388a6ce75e1ef70dc2c1bc3429c3f49
MATLAB
1,576
62
S1= {[1:240], []}; S2= {[1:60] []}; S3= {[] [149]}; S4= {[55] []}; S5= {[105:109] []}; S6= {[61 223:240] [5 61 167 218 227 230 ]}; S7= {[] []}; S8= {[1:9 18 61:73 102:107 169 236] []}; S9= {[1:11 36:52 72:118 134:178 197:239] []}; S10= {[] [18 26 46 167]}; S11= {[239] []}; S12= {[] []}; S13= {[19:48 70:190 163:180] [98...
e03e41ee1260c028f72f63015332234e303138e88348f5058fff169439977fd9
MATLAB
1,587
38
function [count_off,duration_off,rate_off,count_on,duration_on,rate_on,NonREMdur]=find_off_period(BI,fn,duration_min) %BI: Binary vector representing continuous timestamps with 1 meaning a %spike was detected for this timestamp. % fn: sampling rate NonREMdur=length(BI)/fn; %sec [spikes]=myFind...
f91159abad41b1db3e617efb011c6b5571cf32c4a247a1c5637ab6fd8e332ab5
MATLAB
1,588
60
function f = gl( varargin ); %Generates levels for a factor. % % Usage: f = gl( levels, m, n ); % % levels = a single scalar, p, or % = a cell array of p strings {'F1', 'F2', ..., 'Fp'} for the level % names, or % = a string 'F', followed by a single scalar p, so that the call is % ...
6f762c524f66db1eaa1b977c1f13c114ef020bf844468c7e2a6ee3f5ccf7885a
MATLAB
1,589
53
function Substream = Pick_SubgraphStream(dFCstream, links) % FUNCTION SubgraphStream = Pick_SubgraphStream(dFCstream, links) % This function takes as input: i) dFCstream is a dFCstream object generated by % TS2dFCstream, in either 2D or 3D formats; % ii) list of links to include in the subgraph, in either vector ---fr...
f5c223aea65a5850db92867d1868073a8615a50402394c28f321ef1b93284dde
MATLAB
1,594
51
function [tracks_image,track_intp] = spt_convert_tracks_to_image(tracks,image,pixel_size) tracks_norm = cellfun(@(x) x(:,2:3)/pixel_size,tracks,'UniformOutput',false); track_intp = cell(length(tracks),1); for i = 1:length(tracks) track_intp{i} = interpolate_track(tracks_norm{i}); end track_intp_all ...
6447296acc8b3dcc9abc61da8641951bbd05e487935abe4439e850cb7fdc5b96
MATLAB
1,598
42
function C=clustering_coef_wd(W) %CLUSTERING_COEF_WD Clustering coefficient % % C = clustering_coef_wd(W); % % The weighted clustering coefficient is the average "intensity" % (geometric mean) of all triangles associated with each node. % % Input: W, weighted directed connection matrix % ...
cffc306e020ab12936f4a6c1aec32956c6980c961ba4d9c095f05b33806d38ed
MATLAB
1,599
57
function Y = SurfStatReadData1( filename ) %Reads data (e.g. thickness) from a single .txt or FreeSurfer file. % % Usage: Y = SurfStatReadTxt( filename ); % % filename = .txt or FS file name, either new version binary or ASCII. % % Y = n x v vector of data, v=#vertices. [pathstr,name,ext] = fileparts(file...
e7cccb86e2e8690fb3c77b62b61d9d039c80b3585e10e349e73a50586af02788
MATLAB
1,600
36
clc;close all;clear % Do not change from this point on Continue = 1; % Ignore this while(Continue) [file,path] = uigetfile('*.mat','Select the file you want to load'); % Open a dialog so you can specify how to save it. For safety, we don't show any mat files so there is no confusion during loading/sav...
821a11bc570ff84e030e59f81b6c3d279dca993076b36ccb58a8d624ce93abf0
MATLAB
1,603
37
function drawNetworkROIs(net_atlas, ctx, mesh_alpha, ROI_radius, surface_parcels) %DRAWNETWORKROIS View ROIs on cortex mesh, colored by network, 3 views % net_atlas: relevant NetworkAtlas object % ctx: MeshType object determining what mesh inflation value to use % mesh_alpha: transparency of corte...
806f1f8072655b88191e755d2c275a00db363cd693b6a90cbfd74b6198c77e54
MATLAB
1,611
51
function [fc,FC,total_flo] = flow_coef_bd(CIJ) %FLOW_COEF_BD Node-wise flow coefficients % % [hc,HC,total_flo] = flow_coef_bd(CIJ) % % Computes the flow coefficient for each node and averaged over the % network, as described in Honey et al. (2007) PNAS. The flow coefficient % is similar to betweenness c...
5987049380d19fe13a8ffb2e5cb84ba72217bda7635d1b8269420af1ecf3f67e
MATLAB
1,613
53
function Starstream = Pick_StarStream(dFCstream, region) % FUNCTION Starstream = Pick_StarStream(dFCstream, region) % This function takes as input: i) dFCstream is a dFCstream object generated by % TS2dFCstream, in either 2D or 3D formats; % ii) region is the index of a region which is the center of the sequence of st...
fe29df9742d2743aabadd3c82f234dda9a4ef9242bae7962337e8c3fc168941d
MATLAB
1,621
41
function varargout = split_surfaces(S) % SPLIT_SURFACES splits disconnected surfaces into separate variables. % % varargout = SPLIT_SURFACES(S) takes the surface in S and returns all % connected components in separate variables. Order of the output % surfaces is identical to their order in the coordinate matrix...