sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
17k
content
stringlengths
1
200k
d6b1897107d2d54f9ee43248d0b41307e23ec505a2323a252f45a57664f27681
MATLAB
1,067
43
function t=emab(I,NI, m1, s1, m2, s2) w0=0.001; w1=0.6; w2=0.399; N=sum(NI); %disp([m1, s1, m2, s2, w0, w1, w2]); %while (dm1>.1 || dm2>.1 || ds1>.1 || ds2>.1) iter=0; while iter<80, p0=1/I(end); 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); p0old=w0*p...
37c17696292490ab9d2423fe23b33571daeb7e57f91db63d8efa334257ea646d
MATLAB
1,068
31
classdef PermutationMethodsTest < matlab.unittest.TestCase properties variables end methods (TestClassSetup) function loadTestData(testCase) testCase.variables = load("edgeTestInputStruct.mat"); end end methods (TestClassTeardown) function clearTestData(...
8f1a910171b40c44b6e90ba4b726ddd15d1d134f10eb9436853177dee4526cf8
MATLAB
1,072
16
function w = widthOfString(str, h) % Approximate the display width of a given text string c_total = strlength(str); c1 = count(str, ["i", "j", "l", "I"]); c2 = count(str, ["t"]); c3 = count(str, ["f", "r", "-", "(", ")", "*"]); c4 = count(str, ["a","c","d", "e", "g", "h", "k", "n", "o", "p", "q"...
8febf060fc6a0a8b47cbd435e59cf6d7c67577c0f52405fd460ef69bf1159b6a
MATLAB
1,073
39
function fmriLayerMakeMovie(subject) %% % current working directory needs to be /path/to/scripts mainpath = pwd; addpath([mainpath filesep 'toolboxes' filesep 'OpenFmriAnalysis']) addpath([mainpath filesep 'toolboxes' filesep 'spm12']) tvm_installOpenFmriAnalysisToolbox basepath = [mainpath '/../subjectData/S%d']; %% ...
de634af82fc89f5c62dacac52e2116ecf808767aa408ef796768ab1cdab29d06
MATLAB
1,074
29
function squareFc = reshapeFlatFcIntoSquares(flatFc) [numSubj, numFcEdges] = size(flatFc); fcEdgeSize = (1 + sqrt(1 + 8*numFcEdges)) / 2; if mod(fcEdgeSize,1) ~= 0 error(['\nFirst dimension of input flat FC is not consistent with size of a square fc.\n',... ' %i unique edges res...
8d2e3b9c12bb4815931da429ec81be7fdbc971ab63ba306c7d5c0c57afe6adee
MATLAB
1,078
33
function data_load = load_SpotOn() [files,path] = uigetfile('*.mat','select SpotOn .mat Files(s)','MultiSelect','on'); if path~=0 if iscell(files) f = waitbar(0,'Loading Files'); for i=1:size(files,2) trackedPar = load([path,files{i}],'trackedPar'); data_lo...
2c45bb41d2cc5db0a0c4c4315cd4dea049618ed423ef0cfc6977bf765cf433a8
MATLAB
1,081
34
function [mapping] = check_diploc(pos) %-------------------------------------------------------------------------- % Till Habersetzer (25.01.2022) % Communication Acoustics, CvO University Oldenburg % till.habersetzer@uol.de % % Dipole locations of a 2-dipol-fit are checked in terms of their mappings % to the left and...
b537289e7bb9bd6741c516f41b9d68e0f68778ee4af192f11e152d92cdf9e860
MATLAB
1,081
21
function arc = genArcSegmentHandlePoorlyDefined(arc_origin, arc_origin_rad, arc_radius, r1_center, r2_center, n) %GENARCSEGMENTHANDLEPOORLYDEFINED Wrapper around genArcSegment that % handles poorly-defined arc segments - those with radius = 0 or arc of % infinite radius (aka. straight line segment) % fr...
1c1bbe2259d3281c05fe6498eb0554ce2e659006a7b7cfcc6701628fd8a96d45
MATLAB
1,083
28
function shape_classification_filter_aspect_ratio(data) classes = data.classes; input_values = inputdlg({'Major Axis to Minor Axis Aspect Ratio Threshold:'},'',1,{'1.5'}); if isempty(input_values)~=1 min_aspect_ratio = str2double(input_values{1}); for i=1:size(classes,1) for j = 1:length(class...
ff2fe967e15395d602c8db958f6f2499738c11c70edc7a57d93a886ce5ccedf4
MATLAB
1,087
28
function modified_data = change_erp(x) % function to change ERP by randomly shifting time and amplitude. latency_range = -30:30; amplitude_range = 0.75:0.01:1.25; data = permute(x, [3,1,2]); [trials, channels, timepoints] = size(data); modified_data = data; for trial = 1:trials latency_shift = latency_range(r...
4709dd6a737c42356f75c1543e47af2c78ce81db7808de7b0199f669a086883f
MATLAB
1,088
44
function [R,T,p,df] = dcor_uc(X,Y) % [R,T,p,df] = dcor_uc(X,Y) % Computes the U-centered (bias corrected) distance correlation between X and Y. Also outputs the % associated t-value (T) and p-value (p). Rows represent the examples, and columns the variables. % Based on: http://www.mathworks.com/matlabcentral/fileexcha...
c1e4dc4329497f3853cc43378f92612980c22dbb258684e41978a2b80651fe82
MATLAB
1,088
38
function c = redblue(m) %REDBLUE Shades of red and blue color map % REDBLUE(M), is an M-by-3 matrix that defines a colormap. % The colors begin with bright blue, range through shades of % blue to white, and then through shades of red to bright red. % REDBLUE, by itself, is the same length as the current...
2bb61bcdced8f396913997f47884178b319b5ddcb9575928d42fba5b7806d6fc
MATLAB
1,090
45
function [CIJ] = makelatticeCIJ(N,K) %MAKELATTICECIJ Synthetic lattice network % % CIJ = makelatticeCIJ(N,K); % % This function generates a directed lattice network without toroidal % boundary counditions (i.e. no ring-like "wrapping around"). % % Inputs: N, number of vertices % K, ...
9c31c38e104f37a4cbc5567f334e65e2d5813aa0c7d4e93f76b04e7b031f2341
MATLAB
1,090
41
function [Wq,twalk,wlq] = findwalks(CIJ) %FINDWALKS Network walks % % [Wq,twalk,wlq] = findwalks(CIJ); % % Walks are sequences of linked nodes, that may visit a single node more % than once. This function finds the number of walks of a given length, % between any two nodes. % % Input: CIJ b...
43e165002a015738d4d07a71a4566b6448cc006838da7262f71f77b881a9a8a4
MATLAB
1,094
39
function ox=adjph(x) %ADJPH Normalization of columns of a complex matrix. % % Given a complex matrix X, OX=ADJPH(X) returns the complex matrix OX % that is obtained from X by multiplying column vectors of X with % phase factors exp(i*phi) such that the real part and the imaginary % part of each column vector of OX ...
8f6a73dc8c55eb40c0fa3a3f5ece719e8a1a42dd55f4658b198c628413da6585
MATLAB
1,096
26
function tests = genTests(subpackage) %GENTESTS Generate cell array containing all tests in given subpackage % subpackage: dot-seperated subpackage name within NLA namespace, eg. % 'net.test' for net-level tests root_path = nla.findRootPath(); subfolders = strsplit(subpackage,'.'); %Firs...
02efb77fd8d74e67bf29e16171c83abf5cbd96e594b42199c280822146a327d8
MATLAB
1,099
39
function coord = SurfStatInd2Coord( ind, surf ); %Converts a vertex index to x,y,z coordinates. % % Usage: coord = SurfStatInd2Coord( ind, surf ); % % ind = 1 x c vector of indices of vertex, 1-based. % surf.coord = 3 x v matrix of coordinates. % or % surf.lat = 3D logical array, 1=in, 0=out. ...
25f2bca1aaa227483eee48909dc3290fe19f16721bc497ce91cbc59aab60a47d
MATLAB
1,100
36
%USING_HG2 Determine if the HG2 graphics engine is used % % tf = using_hg2(fig) % %IN: % fig - handle to the figure in question. % %OUT: % tf - boolean indicating whether the HG2 graphics engine is being used % (true) or not (false). % 19/06/2015 - Suppress warning in R2015b; cache result for i...
bafa7cb2b1ff3cedd8f30dc3a3a7e6f7bdf53b41648201661109023abf89a578
MATLAB
1,100
23
function [dataA, dataB] = get_eegfmri_all_subject_data(all_res, freq, dtype, raise_to, ROI) dataA = []; dataB = []; area = sprintf('V%d', ROI); for time = fieldnames(all_res.lh.(area).(freq))' if contains(dtype, '-') dtypes = strsplit(dtype, '-'); dataA = cat(4, dataA, ... permute(...
12728231661fa6cfdd30705ddb1e94184cab0882a83d2d8e4af5a90d5dd47dc5
MATLAB
1,102
37
%für MNI: db_id = "db4"; subj_id = "20"; subj_name = "sub-" + subj_id + "Slicer"; if (db_id == "db4") file_path = "/mnt/data1/lmu_or_reconstructions/"; file_path += db_id + "/" + subj_name + "/derivatives/leaddbs/sub-"; file_path += subj_name + "Slicer/reconstruction/sub-"; file_path += subj_name + "Slicer_desc-r...
a26ba3de586ee2a6bdcf3fa04b459bebf428987884be7f0b16b5215fe94e9751
MATLAB
1,104
58
clear analdir = [path_ludisc '\common/DATA\MIPCART pilot\Analysis\']; load([analdir 'ParTable_250625.mat']); [T, m_vol] = mipp_time_2_commonTime_v2(T, 105); T = T(contains(T.dps_fn, 'resQ_nocov_dps.mat'), :); %% clf uID = unique(T.ID); X = []; Y = []; for i = 1:numel(uID) ind = T.ID == uID(i); x = T.t_shif...
876c6ebd1421cf2ebe455643cfe2ce2ccfcb5dd3cbc6c1f0c2185181dcd6d745
MATLAB
1,107
29
%% Data paths % Set REPO_ROOT to the root of the icms-plasticity-code repository. REPO_ROOT = fileparts(fileparts(mfilename('fullpath'))); if isempty(REPO_ROOT) % Fallback if mfilename fails (e.g., running from editor temp dir) REPO_ROOT = pwd; end DATA_ROOT = fullfile(REPO_ROOT, 'data', 'matlab'); % Fig 2 / ...
9a07f8749de9a3750e99894ad3c7cb7de3913de50fb92cd70943e99ac52cffa5
MATLAB
1,112
35
% current working directory needs to be /path/to/scripts mainpath = pwd; addpath([mainpath filesep 'toolboxes' filesep 'analyzePRF']) addpath([mainpath filesep 'toolboxes' filesep 'analyzePRF' filesep 'utilities']) addpath([mainpath filesep 'toolboxes' filesep 'knkutils']) addpath([mainpath filesep 'toolboxes' filesep ...
afd884e5bcfd822d77cb28bb85819e5d24bd96bcc61ec44d615936ddb7c7f002
MATLAB
1,115
44
function data = mipp_table2par_byID(T, pn) if nargin < 2 pn = {'s0', ... 'D', 'Vi','Va','Vt', ... 'D_lo', ... 'D_hi', 'Vi_hi','Va_hi','Vt_hi', ... 'D_delta','Vi_delta','Va_delta','Vt_delta', ... 'MKi', 'MKa', 'MKt', 'ufa', ... 'MKi_hi', 'MKa_hi', 'MKt_hi', 'ufa_hi', ...
cbaef75494e780fe2c6c195d48f579802ea6d2dc8986f83328a7045a52ed7c41
MATLAB
1,115
34
function [coreness,kn] = kcoreness_centrality_bu(CIJ) %KCORENESS_CENTRALITY_BU K-coreness centrality % % [coreness,kn] = kcoreness_centrality_bu(CIJ) % % The k-core is the largest subgraph comprising nodes of degree at least % k. The coreness of a node is k if the node belongs to the k-core but % ...
d37e3b49836c0948adc91051e6fa9b862a7dc78810e102e496d03b3772cb4ff3
MATLAB
1,117
57
function [A,fint] = glm_phi (phi,dt,fb) % Estimate connectivity parameters using GLM/EMA method % FORMAT [A,fint] = glm_phi (phi,dt,fb) % % phi [N x Nr] matrix of phase time series % (N time points, Nr regions) % dt sample period % fb bandwidth parameter % % A [Nr x Nr] normalised ...
54c50724f8812a60e4990dc3705f0660603e8952d9ad7c400ce08ebb1b3a2f68
MATLAB
1,118
33
function t_stats = computeTStatsAcrossTrials(inputData) % Extracts trial data from a struct and computes t-stats % inputData: struct with fields trial1, trial2, ..., trialN % Each trial: [nSensors x nTimepoints] % Returns: t_stats [nSensors x nTimepoints] if isstruct(inputData) trialNames =...
4582179e4263615bb41dac27d100a8fa8c7992f43d3ee896661460e6382b1fa1
MATLAB
1,120
38
function BCCT_CON_Surf_GUI D.fig = figure('unit','norm',... 'pos',[0.4,0.4,0.2,0.2],... 'name','Structural Covariance Surface-based Map',... 'menubar','none'); D.Freesurfer = uicontrol('parent',D.fig,... 'unit','norm',... 'pos',[0.1,0.3,0.3,0.4],... 'style','pushbutton',... 'string'...
4ec709efb605c2fa21390b67659af1e336ecd927f4b35fb9d07a5c2e85e8c48d
MATLAB
1,121
42
function [loc_est, id_est, G_mcmv, data_cov_inv] = MCMV_beamformer_localizer_reg(Y, noise_cov, G, pnts, included_sp, num_sources) %addpath('/m/nbe/scratch/braintrack/pnas_mne_results') num_trials = size(Y,3); T = size(Y,2); data_cov = compute_cov(Y, num_trials, T); %%%%%%%%%%%reg%%%%%%%%%%%%%%%%%%%%% reg=0.05; alpha=...
5531b4b567d289c78db1be41d82f0fd59a8e1bbf67203119b173037858c2063a
MATLAB
1,122
38
%% create and read file %awk '{print ">Pep"NR;print $0}' peppho.txt %http://www.uniprot.org/uniprot/P05198 prot=fastaread('L:\Elite\LARS\2014\november\Lars Inger Ane Serum\kng1prot.fasta') peps=fastaread('L:\Elite\LARS\2014\november\Lars Inger Ane Serum\kng1pep.fasta') %% map plot([1 length(prot.Sequence)],[1 ...
2276abe13ff44513bd83f3264725d8ada9cd4a1ad028b086fb7f70ada31ccb80
MATLAB
1,123
30
function [surf_lh,surf_rh] = load_conte69(name) % LOAD_CONTE69 loads conte69 surfaces. % % [surf_lh,surf_rh] = LOAD_CONTE69(name) loads conte69-32k surfaces of % the left (surf_lh) and right (surf_rh) hemispheres. Name can be set to % 'surfaces' for cortical surface or 'spheres' for corresponding spheres. % % ...
4f04e9b82bc626c2b7239591825d7ff7697fdd0c93181a0a6a05d976cdeba3c9
MATLAB
1,123
33
%% Dijkstra's algorithm % To evaluate the performance of Dijkstra's algorithm, we pick graphdir = '../graphs/'; graphs = {'cs-stanford', 'tapir'}; profile off; if exist('prof','var') && prof, profile on; end nrep=15; ntests=10; mex_fast=0; mat_fast=0; mex_std=0; mat_std=0; for rep=1:nrep for gi=1:length(graphs) ...
ca7720e17dbe47c5ab4eada16999c49baf5903054ec5e58eb502b7cb8db31eff
MATLAB
1,123
48
function demo_mcmv(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=500; num_sources=3; dist_thr = 30; %load h...
d0ba73c2a97422d1eafbbdc14c7e9db7be6434a2833f8938f9bfd60759d1cd6d
MATLAB
1,125
51
function R_lp_d = WongWangFluc(Gm,Gn) % inputs: % Gm: connectivity baseline % Gr: reversion rate dt = .0001; % 1ms t_run = 1500; % run time in seconds tpts = 0:dt:t_run; gamma =.641; a = 270; b = 108; d = .154; jn = .2609; sigma = 0.06; w = 1.0; I = .32; tau = .1; load('AAL_matrices.mat','C'); C = C./max(C); N = size(C...
3c3f87e198171d94e5d57f1717eb966af46e6e5b6f6e0dc481463527a7f1fd3d
MATLAB
1,127
29
%% threshold [data,id,~]=xlsread('L:\Elite\kamila\SILAC1p25.mRNA1p25all.xlsx'); corrcoef(data(:,11)>0,data(:,12)) axis equal plot(data(:,11),data(:,12),'r.') grid on xlabel('SILAC') ylabel('mRNA') upup=sum(data(:,11)>0&data(:,12)>0) updn=sum(data(:,11)>0&data(:,12)<0) dnup=sum(data(:,11)<0&data(:,12)>0) dnd...
c87191b73d6ff57e53ee6e281ce49d7d391a6ba424fc4b6f08d7a79c182f3915
MATLAB
1,128
36
%% Model Order Selection for identification strictly causal MVAR model %%% input: % Y, M*N matrix of time series (each time series is in a row) % pmax, maximum tested model order % idMode, determines estimation algorithm (0:builtin least squares, else other methods [see mvar.m from biosig package]) %%% output:...
18748f432672fb22a18fb1b0519d38e6b2af5de9fdbb73e35799af51816620ff
MATLAB
1,130
33
function [GEdiff,Ediff] = diffusion_efficiency(adj) % DIFFUSION_EFFICIENCY Global mean and pair-wise diffusion efficiency % % [GEdiff,Ediff] = diffusion_efficiency(adj); % % The diffusion efficiency between nodes i and j is the inverse of the % mean first passage time from i to j, that is the expected ...
bb54620c35661d6a4e73fddb889516f3195489bef6829dd259967e0c46e73a3b
MATLAB
1,130
34
function [complete_linkage,complete_distances] = find_complete_linkage(link,no_of_files) clear global complete_data complete_dist global complete_data complete_dist distances = link(:,3); complete_distances = distances(1); complete_distances(2) = complete_distances(1); distances(1) = []; link(:,3) = []; link(...
ef356cdaf14a3259e2101751d089846fa56b43bc4b226e67cf63b992b8a06d09
MATLAB
1,135
45
function image(m) [sx,sv]=char(m); [x,v]=double(m); d1=0.66; d2=0.88; clf; if ~isempty(x) [n,p]=size(x); minx=min(x); maxx=max(x); x=(x-ones(n,1)*minx)./(ones(n,1)*(maxx-minx+(maxx==minx))) ... + ones(n,1)*(maxx==minx); axes('position',[0.06 0.06 0.2 d1]); imagesc(x); colo...
d9d58db846d3c03673bcbc6f45ce829e49330d23c0665329b395ab9522f22190
MATLAB
1,136
41
function Z=module_degree_zscore(W,Ci,flag) %MODULE_DEGREE_ZSCORE Within-module degree z-score % % Z=module_degree_zscore(W,Ci,flag); % % The within-module degree z-score is a within-module version of degree % centrality. % % Inputs: W, binary/weighted, directed/undirected connection matri...
1dd7be45c7f2499fd3a67100d10d3cb88da91013c2d11e216454720e0a4fb3bd
MATLAB
1,138
58
bsad=csvread('X:\Elite\Mohmd\bsad.csv') bsat=csvread('X:\Elite\Mohmd\bsat.csv') %hist(bsat(bsat(:,1)>0,1),[100]) hist(bsat(:,1),[100]) hold %hist(bsad(bsad(:,1)>0,1),[100]) hist(bsad(:,1),[100]) h = findobj(gca,'Type','patch') display(h) set(h(1),'FaceColor','b','EdgeColor','k','facealpha',0.5); set...
d8fe0034c90674239177cc93415a000439f797b6f6fb64963acd780287fece0a
MATLAB
1,138
43
% function adapted from the LiNGAM package % complete software may be downloaded from http://www.cs.helsinki.fi/group/neuroinf/lingam/ function [Bopt,optperm,bestval] = permslowertriagbrutal( B ) % questa è per strictly lower triangular su B0! % Finds the best identical row and column permutation in terms o...
f3fa4bd9bf4ede2d33337badcd71d3d8689b7f348381ebe8af462b2ec8dab8d5
MATLAB
1,140
28
function colorlimits(obj,limits) % Sets color limits for plot_hemispheres. Limits must be a 2-element % numeric vector or n-by-2 matrix where n is the number of columns in % obj.data. The first column of limits denotes the minimum color limit and % the second the maximum. When limits is a 2-element vector, then the % l...
5f388e1218a24f48690b3fd953bb19447c4dca5f59e3dfccf91e48c6bde49fb1
MATLAB
1,144
38
function BCCT_MOD_Surf_GUI D.fig = figure('unit','norm',... 'pos',[0.4,0.4,0.2,0.2],... 'name','Modulate effect of Structural Covariance Surface-based Map',... 'menubar','none'); D.Freesurfer = uicontrol('parent',D.fig,... 'unit','norm',... 'pos',[0.1,0.3,0.3,0.4],... 'style','pushbutton...
617f6bb46c7cd0ddbfbf4fdb34d24d27b2160b74c5416666a65f799965f43312
MATLAB
1,145
55
function fn = now_write_wf(r, p, o_dir, fn) % function fn = now_write_wf(r, p, o_dir, fn) % Write result from NOW_RUN to a .txt file. % If the file names (fn) are not defined, a name will be created based on % the problem definition. if nargin < 3 o_dir = pwd; end if nargin < 4 fn = now_problem_to_name(p); e...
64ab171baa7d098edf06f24b309f839909a67fc984b202100937735978103f07
MATLAB
1,151
32
function voxel_neigh = tc_check_voxel_neighborhood(layer_perc,label, mask, shape) %% voxel_neigh = tc_check_voxel_neighborhood(layer_perc, mask, shape) % % checks and plots stats on the neighborhood of selected voxel voxel_sel = find(mask); overlapping_perc = []; for comp = 1:size(layer_perc, 2) overlapping_perc ...
0b2e6667d8bb5e8cfad1a92219261e5b1cab0230b839ce0d2155cfd71a7faecb
MATLAB
1,154
36
function image_crop_enter_values(data) for i=1:length(data) max_x(i) = max(size(data{i}.image,2)); max_y(i) = max(size(data{i}.image,1)); end input_values = inputdlg({'X1:','X2:','Y1:','Y2:'},'',1, {num2str(1),num2str(max(max_x)),num2str(1),num2str(max(max_y))}); if isempty(input_values)==1 retur...
2aa1b745982f8e0299fc599a99061d1de7c9deb49a5d4246492002e6609f8a13
MATLAB
1,157
40
function [CIJscore,sn] = score_wu(CIJ,s) %SCORE_WU S-score % % [CIJscore,sn] = score_wu(CIJ,s); % % The s-core is the largest subnetwork comprising nodes of strength at % least s. This function computes the s-core for a given weighted % undirected connection matrix. Computation is analogous to the more % ...
0726d7bf1b8f8b7e87b70de3dec06fbb71d46debe7dfafe98c1bccbe89cb9e54
MATLAB
1,159
46
classdef Label < nla.inputField.InputField properties name display_name end properties (Access = protected) field = false end methods function obj = Label(name, display_name) obj.name = name; obj.display_name = display_name; obj.s...
ab76af8b2a4d9c685cbc3dc540ac879a7bbea32cff6a5c6d503fa48bcdd3d80d
MATLAB
1,163
32
function bst_events = utest_get_test_bst_events() % Return a BST event struct with corner cases: % - multiple conditions % - some have empty notes / channels tags % - some have non-empty notes with weird chars % - some selected, some not % % Maintain this function everytime bst event structure changes % -> to a...
6d95108a965323c421a39f4eb4475c77c7f81f4b1bc75b7ae9c52928a72bcfe0
MATLAB
1,166
45
function s=mtimes(t1,t2) if (~isa(t1,'term') && numel(t1)>1) | (~isa(t2,'term') && numel(t2)>1) warning('If you don''t convert vectors to terms you can get unexpected results :-(') end t1=term(t1,inputname(1)); t2=term(t2,inputname(2)); if isempty(t1) | isempty(t2) s=term; return end n1=size(t1.m...
e972fa3e8b6faaa93b1024f41cf8cab8df01015a46bba9a30a3ad8b35c687880
MATLAB
1,175
38
function BCCT_CaSCN_Surf_GUI D.fig = figure('unit','norm',... 'pos',[0.4,0.4,0.2,0.2],... 'name','Causal network of Structural Covaraince Connectivity(Seed to Whole Brain, Surface-based)',... 'menubar','none'); D.Freesurfer = uicontrol('parent',D.fig,... 'unit','norm',... 'pos',[0.1,0.3,0.3,0...
9582ac7fc4d6795f1d7558d0ad93e0cde649dfa7e8b26600d1ad3c9c8a9d1421
MATLAB
1,178
28
function conn_matrices = load_group_mpc(name,parcel_number) % LOAD_GROUP_MPC loads group level microstructural profile covariance matrices. % % conn_matrices = LOAD_GROUP_MPC(name, parcel_number) loads sample % microstructural profile covariance matrices of the HCP dataset. Name % can be set to 'vosdewael' for ...
4c511ecfb660d39f2568745d51921148d2ad7bf29cd0a368d8b61e577a91c891
MATLAB
1,179
54
%%%% EXTERNAL FUNCTION % function taken from the LiNGAM package % complete software may be downloaded from http://www.cs.helsinki.fi/group/neuroinf/lingam/ function p = slttestperm( B ) % slttestperm - tests if we can permute B to strict lower triangularity % % If we can, then we return the permutation in p, ...
5148472918533998ae82d90c49d5fc755682819337a37f6fffadd9244a6aa264
MATLAB
1,179
52
% Demonstration of generative model functions. % % See GENERATIVE_MODEL and EVALUATE_GENERATIVE_MODEL for further details % and interpretation. clear close all clc data = load('demo_generative_models_data'); A = data.A; Aseed = data.Aseed; D = data.D; % get cardinality of network n = length(A); % set model ...
4ed11fe26f5ca9d9c43ae0ca26f379f3d77a62239fbda80cf85b3b26daeb70bc
MATLAB
1,180
46
function [status]=write4dfp(filename, info, data) %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')) name=[name1 '.4dfp.img']; nameroot=name1; elseif (...
e8e008085521f93f4b8e90ed9d06045c1f7d87e341cacf3509286ca7c3505c35
MATLAB
1,185
47
function [CIJ] = makeringlatticeCIJ(N,K) %MAKERINGLATTICECIJ Synthetic lattice network % % CIJ = makeringlatticeCIJ(N,K); % % This function generates a directed lattice network with toroidal % boundary counditions (i.e. with ring-like "wrapping around"). % % Inputs: N, number of vertices % ...
560ea9ab5d76c38f02bcb534880a05f0957ea02a2733ea0879edb830833ed1c7
MATLAB
1,186
31
%% read [data,id,~]=xlsread('L:\Qexactive\Linda\MaxLFQall.xlsx'); protab = tblread('c:\users\animeshs\Desktop\MCRshalinitonje.txt','\t') protab = tblread('L:\Qexactive\Linda\LFQALLseries\proteinGroups.txt','\t') [data,id,~]=xlsread('L:\Elite\Ani\lfq.xlsx'); lfq=data(:,10:33); %% extract LFQ lfq=protab(:,[103:1...
a4bf4ec2644a95b055bf53dd2945db5d224e162c687137e4a2e0288468446d84
MATLAB
1,187
61
%% plot figure 3a clear;clc;close all; figure; load('decode_accur_mean.mat') % suptitle('Functional Localizer') mean_accur_mean=squeeze(mean(decode_accur_mean,1)); subplot(1,2,1) x=10:10:750; y=10:10:750; clims = [0.15 0.25] imagesc(x,y,mean_accur_mean,clims) ylabel('Train Time Post Onset (ms)') xlabel('Test Time Po...
fa35069f7074ce8544d03de8e9fccd3703ca6f0cb7aa0d79e32f9fd62f28427a
MATLAB
1,188
37
function data_cluster = loc_list_extract_clusters(data) for i=1:length(data) data_cluster{i} = extracting_clusters(data{i}); end data_cluster = horzcat(data_cluster{:}); loc_list_plot(data_cluster) end function clusters = extracting_clusters(data) f = waitbar(0,'extracting clusters'); area = data...
3d06454a0ff7a59e858a50a9cf845e7d8ad9c4f2edef89f3816db1bf984d1e94
MATLAB
1,192
30
function data_rotate = loc_list_rotate_cm(data) input_values = inputdlg({'Enter the degrees with which you want to rotate the image'},'Rotation input',1,{'180'}); degrees = str2double(input_values{1}); data_rotate = cell(1,length(data)); for i = 1:length(data) data_rotate{i} = loc_list_rotate(data{i},degre...
bf3d755949e31c3b71d4fdaeaeb641bd91cc38c645214b174bddfe44913b6b90
MATLAB
1,193
40
function [channel_label, measure] = nst_format_channel(isrc, idet, measure) % NST_FORMAT_CHANNEL make channel label from source, dectector and measure information. % % CHANNEL_LABEL = NST_FORMAT_CHANNEL(ISRC, IDET, MEAS) % % ISRC (int >= 0): source index % IDET (int >= 0): extracted detector index % ...
097b279efbf6aa302846f7b0c8ee5efcabbf3d37eb0145877240cefb166901eb
MATLAB
1,196
41
function SurfStatWriteData( filename, data, ab ) %Writes data (e.g. thickness) to a single .txt or FreeSurfer file. % % Usage: SurfStatWriteData( filename, data [, ab] ); % % filename = .txt or FS file name, either new version binary or ASCII. % ab = 'a' for ASCII or 'b' for binary. % % data = k x v ...
5bed0b6581e84ac56c0ec45fef257e61b8c99b6fbf30d73b4dd1dddff5b4a664
MATLAB
1,196
40
function noise=mkpinknoise(n,m); % makes m channels of pink noise % of length n. Each column is one % channel % % Guido Nolte, 2012-2015 % g.nolte@uke.de % If you use this code for a publication, please ask Guido Nolte for the % correct reference to cite. % License % % This program is free software: ...
0d7b3a722edc54cfa027240945283a5d2bc1be700fc2f8128f0642ebde3dc62a
MATLAB
1,198
30
function [aN] = compute_aN_gpu(r_pf_t, r_pf, q_kf, P_kf, V_r, ... omega_t, lambda_t, w, N, CONST, log_det) np=size(q_kf,1); gamma = zeros(np, np,N); logw_rb = zeros(N,1); I=eye(np); for i=1:1:N gamma(:,:,i) = chol(P_kf(1:np,1:np,i)); end q_kf_r (:,1,:) = q_kf; q_kf_gpu = gpuArray(q_kf_r); gamma_gpu = gpuArray(gamm...
83b08ec6379c56b0db471b069e3f6034e396bbe2ce99801c9f2e7acd52372a01
MATLAB
1,200
42
function [FDfilt mvm_filt] = filter_motion(TR,mvm) % [FDfilt mvm_filt] = filter_motion(TR,mvm) % a function that filters the motion parameters and calculates a filtered % FD (FDfilt) % % Inputs: % TR = TR in seconds % mvm = time X 6 motion parameters % % Outputs: % FDfilt = array with filtered FD values % mvm_filt = t...
8078576c82b13025dc14c33b57fe8061cb361b18fb271b49f0b9db2c1fae16ab
MATLAB
1,202
36
function transitions = find_transitions(A, min_state_length, transition_threshold) nwin = size(A,1); if nwin < 2*min_state_length errordlg('Error using ''transitions'' function: duration must be at least 2 times the minimum state length') end transitions = zeros(0,1); last = nwin-2...
10ceedb34d6b6c1f0510ee43a40a289e71e2bbb5d111aa2be7a2b629ac4cca8b
MATLAB
1,204
27
function [status,cmdout] = tc_wrapper_nifti2surf(subjectsDir, i_filename, o_filename, r_filename, varargin) additional_command = ''; if ~isempty(varargin) if varargin{1} additional_command = [';mri_surf2surf --srcsubject "0_freesurfer" --trgsubject fsaverage --hemi $hemi ' '--sval ' strrep(o_filename, '.mgh', '.$h...
2b12f138795ad1e5e896635e4e4c2732378e19e2482a574a640f79847ba75cf2
MATLAB
1,204
37
function path = retrieve_shortest_path(s,t,hops,Pmat) % RETRIEVE_SHORTEST_PATH Retrieval of shortest path % % This function finds the sequence of nodes that comprise the shortest % path between a given source and target node. % % Inputs: % s, % Source node: i.e. node where the short...
45e6b5b68b26e743aca494b4303605adecc6ca5b2d3d6cc8f1c7481186743609
MATLAB
1,206
27
function [vor, dist] = dg_voronoi(img, voxsize, seeds, distance, aniso) % Geodesic Discrete Voronoi Diagram % FORMAT [vor dist] = dg_voronoi(img, voxsize, seeds, distance, aniso) % % img - binary image (2D or 3D) with : > 0 : inside % <= 0 : outside % voxsize - siz...
5c01e565026762d09fa14b5ec97bfd16120f68e736b0bed4822553325732a7e1
MATLAB
1,206
31
%% Method generate a atlas with all parental regions of the given xlsx file % getParentalARA('./annotation_label_IDs_valid.xlsx','./annotation/annotation.nii.gz') function getParentalARA(xml_file,atlasNii_file) addpath('./AllenBrainAPI-master/'); labelsStrArray = char(readXML_Lables(xml_file)); atlasData = load_ni...
d88945776a4a492f9adef9bf661a9fd2d5c6544d4032dc19f632c0212451faea
MATLAB
1,206
40
function loc_list_voronoi_plot(data) answer = inputdlg({'Maximum Number of Localizations for Down Sampling'},'Input',1,{'1000'}); if isempty(answer)~=1 num_points = str2double(answer{1}); m = length(data.x_data); xy(:,1) = data.x_data; xy(:,2) = data.y_data; if m>num_points xy = data...
7957643d7aca3e0692246bc937b0333b24f68192be8ab68e63dce82e059f5bc0
MATLAB
1,211
26
function shape_classification_network_graph(classes) if size(classes,1)<500 parameters = shape_classification_normalized_parameters(classes); disp('Finding Nodes and Edges') number_of_nodes = size(parameters,1); [x,y] = meshgrid(1:number_of_nodes); x = triu(x,1); y = triu(y,1); ...
115605a8d6ad8e4e7716d68ff5f6b0444f477453898ea735ad03892ffbe3153e
MATLAB
1,213
51
for ica = 1:70 ICAS=num2str(ica); if(ica<10) ICAS=strcat('00',ICAS); else ICAS=strcat('0',ICAS); end %strcat('ica','_',ICAS)=[]; %ica_mat=[]; %icamat(ica)=[]; for s = 1:66 SS=num2str(s); if(s<10) SS=strcat('00',SS); ...
f2e75c9490644c6aaa6e79c850bbf08a54fff3b139f4282a27891be4bdd03745
MATLAB
1,217
24
function [data_above,data_below] = loc_list_voronoi_seperate_based_on_value(data) answer = inputdlg({'Voronoi Area Threshold Value:'},'Input',[1 50],{'0.1'}); if isempty(answer)~=1 threshold = str2double(answer{1}); for i = 1:length(data) I_below = data{i}.vor.voronoi_areas<threshold; I_ab...
e905eb5499d474578d28414bb2c8990f0e016e82c6ac03371a1721eb855c982d
MATLAB
1,219
34
function data_k_means = loc_list_k_means(data) answer = inputdlg({'k-Value:'},'Input',[1 50],{'5'}); if isempty(answer)~=1 k = str2double(answer{1}); for i=1:length(data) counter(1) = i; counter(2) = length(data); data_k_means{i} = loc_list_k_means_inside(data{i},k,counter); ...
3da8a153e109c00281d979ad5cd19ba0d5d65b4b718188b2f906c49552c217cf
MATLAB
1,221
40
% Undo the flipping and rotations performed by xform_nii; spit back only % the raw img data block. Initial cut will only deal with 3D volumes % strongly assume we have called xform_nii to write down the steps used % in xform_nii. % % Usage: a = load_nii('original_name'); % manipulate a.img to make...
dcf65f4b8edf50d8d3d7882cf6d9f3481045682d051426f44b1892a2fc1dbcb8
MATLAB
1,226
29
function parcel_data = load_parcellation(name,parcel_number) % LOAD_PARCELLATION loads parcellation vectors. % % parcel_data = LOAD_PARCELLATION(name) loads parcellations on % conte69-32k surfaces. Name can be set to 'vosdewael' for a % subparcellation of the Desikan-Killiany atlas, or 'schaefer' for a % func...
92a17a12f411ff39543f578d608e275b670014d1eb8e018fb9518703902f49e1
MATLAB
1,227
48
function shape_classification_save_results_bin(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(...
2dfae60502aee633c485f52e969a95e0b20f622e3e47415e3f4f4db41cfcf2f2
MATLAB
1,229
41
function report_stat(csvPath, panel, comparison, vals1, vals2) % REPORT_STAT Append one row of Mann-Whitney U stats to a CSV file. % report_stat(csvPath, panel, comparison, vals1, vals2) % % Columns: panel, comparison, n1, n2, median1, median2, test, U, p, r n1 = numel(vals1); n2 = numel(vals2); med1 ...
71d0b48356cc0c895ea82cc1ff133b46d79c4bab6670dad2adc82fc883cf0771
MATLAB
1,230
36
function [interp_cmap]=interpolate_cbrewer(cbrew_init, interp_method, ncolors) % % INTERPOLATE_CBREWER - interpolate a colorbrewer map to ncolors levels % % INPUT: % - cbrew_init: the initial colormap with format N*3 % - interp_method: interpolation method, which can be the following: % 'neare...
99d7cae6bdc142cac8374ecae217e89d79181b83468eb03141aa0871fb140905
MATLAB
1,231
44
function SurfStatWriteVol( filenames, data, vol ); %wtites volumetric data to files in MINC, ANALYZE, NIFTI or AFNI format. % % Usage: SurfStatWriteVol( filenames, data, vol ); % % filenames = single file name with extension .mnc, .img, .nii or .brik as % above (3D if k=1, 4D if k>1), or cell ar...
a8be9b04297dcfd83d1b3c51552c647abc035dc468a0668d4a1fc83525feecee
MATLAB
1,234
30
function data_load = spt_simulate_directed_brownian_motion() input_values = inputdlg({'number of particles:','time step:','number of time steps:','diffusion coefficient: (um^2/s)','size:','mean velocity (um/s)'},'',1,{'10','0.05','100','0.001','2','0.05'}); if isempty(input_values)==1 data_load = []; else ...
a58536c829540307ba8a6be869f95ac0d16f90c02d94b9a6835e05414eae88ae
MATLAB
1,236
32
function knn_data = loc_list_knn_density_map(data) answer = inputdlg({'KNN k value:','Maximum Number of Localizations for Down Sampling:'},'Input',[1 50],{'10','10000'}); if isempty(answer)~=1 k = str2double(answer{1}); num_points = str2double(answer{2}); knn_data = cell(1,length(data)); for i...
52450265dfb5b6c2fec54e91bdfaf6a15f1289ecd0d82c63693fa71b7211f9ac
MATLAB
1,237
49
%% % current working directory needs to be /path/to/scripts mainpath= pwd; addpath([mainpath filesep 'toolboxes' filesep 'tc_functions']) addpath([mainpath filesep 'fmriRegAnalysis']) addpath([mainpath filesep 'toolboxes' filesep 'fieldtrip']) addpath([mainpath filesep 'toolboxes' filesep 'OpenFmriAnalysis']) tvm_inst...
730bfb6ef272a2c446bd236bdfca3389b7d5f643fad69a85b66f2a8bc729304e
MATLAB
1,239
52
% Demonstration of generative model functions. % % See GENERATIVE_MODEL and EVALUATE_GENERATIVE_MODEL for further details % and interpretation. clear close all clc data = load('demo_generative_models_data'); A = data.A; Aseed = data.Aseed; D = data.D; % get cardinality of network n = length(A); % set model ...
1a9d8c061f3a1f49f74949a9072428a78148b64c0ae6ec80d6357111bb9cf122
MATLAB
1,240
30
% Example code for how to run the spin test % Medial wall removal is now included % SMW 07/31/2020 % Step 1: SpinPermuFs.m to obtain 'spins' of the data % (or use SpinPermuCIVET.m): % left and right surfaces (group-averaged at every vertex): readleft = '/path/to/left_data1.csv'; readright = '/path/to/right_data1.csv...
7cc1ec97cd571b555ef85f5cac05fbfb6d87ceed0949000ce0e2f46a627230c1
MATLAB
1,248
40
function fn_l = now_problem_to_name(p) % function fn_l = now_problem_to_name(p) % Get a set of reasonable names for the waveform files based on the problem % definition. This function may be replaced with header information stored % in the file one such headers are supported by the sequence code. gampstr = sprintf('%0...
b08ce417e8ae224f96863744ac65cf40c96706776681fda75a37126ac91df097
MATLAB
1,251
37
function [co_vec1, co_vec2, count_co_vec1, count_co_vec2]=cooccurrence_vec(a_s,a_e,n_s, n_e) %%% This function finds co occurrences between event 1 and event 2 % input: % a_s, a_e: start and stop of event 1 % n_s, n_e: start and stop of event 2 % output:, % co_vec1 : index of cooccur...
b54e662bbded32c8b3e6f6908462a2a7aa2fa138bb6ab776888c588fb8d4a27f
MATLAB
1,258
39
function [data_filter_above,data_filter_below,I] = filter_area(data,min_area) clusters = extract_clusters(data); areas = cellfun(@(x) x(1,3),clusters); I = areas > min_area; clusters_above = clusters(I); if ~isempty(clusters_above) clusters_above = vertcat(clusters_above{:}); data_filter_above.x_...
e60b8e900112c8b7d4e65e954da5c1a06a11cc92505bfcf7eabe8a83a1452011
MATLAB
1,259
31
function vor = construct_voronoi_structure(x,y) disp('=========voronoi structure calculation==========') disp('calculating delaunay triangles') dt = delaunayTriangulation(x,y); disp('calculating voronoi vertices and connections') [vertices,connections] = voronoiDiagram(dt); disp('finding voronoi cells coordin...
ab31db327d3a37df2f2e91a5b1418b2c52c093fc0b6066b4932378601ee88af1
MATLAB
1,263
37
function v = eigenvector_centrality_und(CIJ) %EIGENVECTOR_CENTRALITY_UND Spectral measure of centrality % % v = eigenvector_centrality_und(CIJ) % % Eigenector centrality is a self-referential measure of centrality: % nodes have high eigenvector centrality if they connect to other nodes % that have...
a0897bbacc6a74b193e94c580c39107de96ab55fdc2baa8d80abbe44bf2d731e
MATLAB
1,268
35
function head_global = reconstruct_head_from_chest(newChest3, head_positions_rel_to_chest) % Input: % newChest3 - 3x3 matrix of new chest sensor positions (must be in same order as original) % head_positions_rel_to_chest - Nx3 matrix of head sensor positions in chest frame % % Output: % he...
4b52ffe002815f26ad497095bdd319d7f10b30a0e278c9432595d1eb24888fa3
MATLAB
1,269
36
fo='L:\promec\USERS\Synnøve\20200825_3samples\QE\1stRun\combined\txt-rabit-noMBR-1\proteinGroups.txt'; testtype=' WSRT'; data=readtable(fo); IDX=[1 7 8];%Uniprots, Gene Name, Fasta header sdx=108; edx=119; rep=3; log2data=log2(table2array(data(:,sdx:edx))+1); log2ctr=log2data(:,[1:ceil((edx-sdx+1)/rep):size(log...
f798722628055d214e1bf465cbe6ac4e1a2d1a1a87d56c99cc7ffe5c91bf49d2
MATLAB
1,271
24
function reg_middle_volume = tc_reg_middle_volume_index(num_trials, num_volumes_per_trial, skip_first_N_volumes, TR, pseudo_TR, TEEG) %% reg_middle_volume = tc_reg_middle_volume_index(num_trials, num_volumes_per_trial, skip_first_N_volumes, TR, pseudo_TR, TEEG) % % Rene, you clearly messed this up :/ we must check % % ...
3491ed5ccf6c5745decd1509ce4343acb8938c4ee9c8a001a55223872c209bd3
MATLAB
1,280
30
function Show_GC_res_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); maxv = max(R(:)); axHm1_1 = axes('parent',Hm1,'unit','norm','pos',[0.1 0.1 0.8 0.8],...
7e48af1f6a3d8324ce02b38838fabc2025bda4f9b1ab3e178cdd1805ac7d1a6f
MATLAB
1,289
50
function ColormapOut = AFNICOLORMAP(k) if mod(k,2) k = k+1; end mk = k/2; ColorMapOrig = [1,1,0;1,0.8,0;1,0.6,0;1,0.4118,0;1,0.2667,0;1,0,0;0,0,1;0,0.2667,1;0,0.4118,1;0,0.6,1;0,0.8,1;0,1,1;]; ColorMapMid = ColorMapOrig(:,2); switch k case 2, ColorMap=[0,1,1; 1,0.8,0;]; case 4...
5830cdba2586c709c4fa8bbd1d448efd8aac0e171c9733c23f28f82aae4c754c
MATLAB
1,298
40
% Common settings for stats and figures % % Other m-files required: % brewermap: https://github.com/DrosteEffect/BrewerMap % subtightplot % Author: Cameron Hassall, Department of Psychiatry, University of Oxford % email address: cameron.hassall@psych.ox.ac.uk % Website: http://www.cameronhassall.com % Participants t...
1c6321ebf480782db90fba0dae4f9e310a1537b0e635facf7aa4c59c010dfb34
MATLAB
1,299
45
function D=distance_bin(A) %DISTANCE_BIN Distance matrix % % D = distance_bin(A); % % The distance matrix contains lengths of shortest paths between all % pairs of nodes. An entry (u,v) represents the length of shortest path % from node u to node v. The average shortest path length is the % ch...
59964b55dcfd36929fae3d6d1e63be7cca8fe8857a1d40eea9ee4e5fe5ecbfa0
MATLAB
1,301
60
function [freq1,freq2,subs_freq,zlim]=spectrogram_automation(input1,input2,channel,freqrange) bottom=min([size(input1,1) size(input2,1)]); input1=input1(randperm(length(input1))); input1=input1(1:bottom); input2=input2(randperm(length(input2))); input2=input2(1:bottom); %% input1 clear Data fn=1000; leng=length(input...