sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
12261ec9cc4e7c07bc2ebba85c88db5de467e1575824f6828a3a636a97519e99 | MATLAB | 1,772 | 37 | function [rhos,pvals]=plotalldat(alldat)
rhos={};
pvals={};
colours=colormap(hsv(numel(alldat)));
for k=1:numel(alldat)
figure; hold on;
eightcols=linspace(1,8,numel(alldat{k}.mavgx));
%[r,m,b]=regression(alldat{k}.mavgx,alldat{k}.ang);
[r,m,b]=regression(eightcols,alldat{k}.ang);
%l=true;
if ... |
aadbf95b93ecdc8dd01e5fb55f238b03be87079266ffde6036f003866277b5e1 | MATLAB | 1,772 | 57 | %
% some constants used across different calls to gbvs()
%
function [grframe,param] = initGBVS(param, imgsize)
mymessage(param,'initializing....\n');
% logical consistency checking of parameters
if ( min(param.levels) < 2 )
mymessage(param,'oops. cannot use level 1.. trimming levels used\n');
param.levels = ... |
c4064699a512ec3608780be2bce264a5423a22a9731001bbfa210b1229214c8c | MATLAB | 1,772 | 48 | % Reorganize the data to fit the catplot function
file = readtable("/Users/yiyuan/OneDrive - University of Essex/PG Research/0A_Journal/202004_unknown Journal_Probability Score/1_Results/0_Final Results/Results_tables/AccuracyData.xls");
accuracy = table2array(file(:,1));
length = table2array(file(:,2));
feature = tabl... |
1e1c66340c5efc857113f3ebc8a7e7879b4aa99457a6afc7c479429330b23dbe | MATLAB | 1,773 | 53 | function s = export(this,target)
% Export a GIfTI object into specific MATLAB struct
% FORMAT s = export(this,target)
% this - GIfTI object
% target - string describing target output [default: MATLAB]
% s - a structure containing public fields of the object
%______________________________________________________... |
d650907e93b0f07de25af081d1df550fd034b30bf3653f3a76cc80507b247d75 | MATLAB | 1,773 | 110 | % This video was uploaded and converted to .gif with Giphy:
% https://giphy.com/create/gifmaker
%
% https://media.giphy.com/media/ybSv8dGOxnVZ45TsR4/giphy.gif
D = imread('D-Pine_Black.jpg');
Dflat = any(D, 3);
Df = uint8(repmat(Dflat, 1, 1, 3));
[n, k] = size(Dflat);
t = 25;
C = imread('New_hampshire_colors.jpg');
... |
128128c7cc21ec603210bee2ff5faf4e0cf69c6fd8549a25562c05ac4c00d4d3 | MATLAB | 1,774 | 46 | function binary( varargin )
%BINARY Declares an binary variable.
% BINARY VARIABLE x
% where x is a valid MATLAB variable name, declares a scalar variable for
% the current CVX problem, and constrains it to the set {0,1}. Put
% another way, it is equivalent to
% integer variable x
% 0 <= x <= 1
%
%... |
4676022e305c624d650ced7038a5b1c8aa722a6149802a864cdae7cf0d929a7b | MATLAB | 1,774 | 63 | % [r, udata, sdata] = getMultiplicity(data) returns the occurrences/Multiplicity of the elements of 'data'
%
% Inputs:
% data : n-dimensional input array
%
% Outputs:
% rep : # of occurrences for each element of 'data'
% udata : sorted 1-D array of unique values in 'data'
% sdata : sorte... |
a417611ffc1690f68662144de73589e499209c35f7a599296f3b48fe5e1d05ba | MATLAB | 1,775 | 82 | % loaddat() - loading neuroscan format data file into matlab.
%
% Usage:
% >> [typeeeg, rt, response, n] = loaddat( filename );
%
% Inputs:
% filename - input Neuroscan .dat file
%
% Outputs:
% typeeeg - type of the sweeps
% rt - reaction time of the subject
% response - response of the subject
% n - number... |
b7a8c172e9832782cca1086b9676a37996a9d7b1723a120ebe8c6d57094c2bb8 | MATLAB | 1,775 | 41 | %animals = {'WT98-0', '3xTg77-1', '3xTg49-2', 'WT45-2'}
%animals = {'3xTg136', '3xTg48-0', '3xTg49-1', '3xTg148-1', '3xTg165'}
function plot_CSD_examplefigs(animals, filter, region)
for anim = 1: length(animals)
animal = animals{anim};
disp(['starting ' animal])
exp_dir = get_exp(animal);
... |
027633212fba3c11459c9bfbb8237c6eaf217380c0860e9763ff4540c497e069 | MATLAB | 1,776 | 60 | function cmap = cmrMap(M)
%CMRMAP Create a monochrome-compatible colour map
%
% CMAP = IOSR.FIGURES.CMRMAP returns a colour map CMAP (varying black -
% purple - red - yellow - white) that is monochrome- compatible, i.e. it
% produces a monotonic greyscale colour map. CMAP is size M-by-3, where M
% is the lengt... |
23af5c966e805d0f180510675ecf1b683ebd6d79ffc5b0df6b52b9dbdb37d26d | MATLAB | 1,776 | 48 | function z = quad_pos_over_lin( x, y, dim )
%QUAD_POS_OVER_LIN Sum of squares of positives over linear.
% Z=QUAD_POS_OVER_LIN(X,Y), where X is a vector and Y is a scalar, is equal to
% SUM(MAX(X,0).^2)./Y if Y is positive, and +Inf otherwise. Both X and Y must
% be real.
%
% For matrices, QUAD_POS_OVER_LIN(X,Y... |
ae7abc7a1ee7427f79bd73fd9a4900f47f495fb36df83f74f14933a9d269ab27 | MATLAB | 1,776 | 61 | %%***********************************************************
%% lmiexamp2: generate SDP data for the following LMI problem
%%
%% max -Tr(P)
%% s.t. A1*P + P*A1' + B*diag(d)*B' <= 0
%% A2*P + P*A2' + B*diag(d)*B' <= 0
%% -d <= 0
%% sum(d) = 1
%%******... |
856d5056823010cda7211a190d9899cea6285987616128ebefd812e600be96a3 | MATLAB | 1,777 | 44 | function [Theta_global_L2] = benchmarkDietDataL2Opt(cfg, T,perturbations,BMD,keep_species,data_counts)
% This file is a part of the MDSINE program.
%
% MDSINE: Microbial Dynamical Systems INference Engine
% Infers dynamical systems models from microbiome time-series datasets, and
% predicts biologically relevant b... |
f17c371bcae2902fe8297b046bef105bd99072f735693f566c4f6e6af3b0a26b | MATLAB | 1,777 | 43 | function fulltrial = concat_plot(catmat,plotting,crange,exp1,exp2)
% example call: fulltrial = concat_plot('cat_mar1722_f4e1.mat',1,[-1 10]);
load(catmat);
% myrois = {'all','one','two','three','four','five','six','seven','eight'};
% myrois = {'left','right','cell1','cell2','cell3','cell4'};
my... |
0d2e45b18a148712c153b86f5db863c33969d73e74ef9ee6fa44b5b870d3bce7 | MATLAB | 1,778 | 57 | function [Ycon,ln] = concatenate_files(files,filename,output_type)
% concatenate a list of files into a single file
% INPUTS
% files: list of a files as a struct array. Name of each file is in files(i).name
% filename: output filename
% type: output type ('mat' array loaded in RAM (default), 'hdf5' ... |
b067994952304e95175be03498a7423fb13597451be8a94940800ad038e3d297 | MATLAB | 1,778 | 84 | function hc = compass_lines(varargin)
%COMPASS Compass plot.
% COMPASS(U,V) draws a graph that displays the vectors with
% components (U,V) as arrows emanating from the origin.
%
% COMPASS(Z) is equivalent to COMPASS(REAL(Z),IMAG(Z)).
%
% COMPASS(U,V,LINESPEC) and COMPASS(Z,LINESPEC) uses the line
% specific... |
bd6bbcb79a8ba56147f13273a429f44fb0247c8fcde0e8a0eaeaf4bb91f5dbe4 | MATLAB | 1,778 | 38 | % This script tests and demonstrates implementation of the main pipeline of
% the spectralevents toolbox. The datasets referenced below are from
% sessions used in Shin et al. eLife 2017
% (http://dx.doi.org/10.5061/dryad.pn931).
clear all, close all
% Load data sessions/subjects from the same experimental setup so... |
db5bd3995c1a99c90f2a1e5437e4ac59be1e9aada5ab27232c5739d4e9a55949 | MATLAB | 1,778 | 39 | % pop_stdwarn() - check memory options and issue warning for studies.
%
% Usage: >> pop_stdwarn;
%
% Author: Arnaud Delorme, CERCO, 2007
%
% See also: eeg_options()
% Copyright (C) Arnaud Delorme, CERCO, 2007, arno@salk.edu
%
% This program is free software; you can redistribute it and/or modify
% it under the terms o... |
b5ac42588d5dfee87695cf7460f3fcdccd178dc5bd08185a6b17035243f6f7fb | MATLAB | 1,779 | 48 | %% Figure 6 analysis
YOURDATAPATH = '';
% Load ROIs and PETHs data
fileList = searchFilesRecursive(YOURDATAPATH, 'allROIs.mat');
load(fullfile(fileList.folder, fileList.name))
% Using only cue-modulated
allROIs = allROIs([allROIs.modCue] == 1);
% Params
xLimits = [-4 0];
yLimits = [-2.35 3.3];
gridRes = 50;
smoothSDPt... |
b702d0ede0fcf4c52d8003c62749fdae95195305dab5b150f361a77f4eedd773 | MATLAB | 1,779 | 46 | function apref = ea_antspreset_legacy_preset2(cmd)
if ischar(cmd) % 'query' mode, return the name of the preset
apref = 'Legacy: Original Lead-DBS Preset 2';
return
end
normsettings = cmd; % cmd is the 'normsettings' struct
switch normsettings.ants_metric
case 'Mutual Information'
apref.metric='MI... |
584a48f8de8f8f2fab271449773b4a6219d7f06c31fb5513e6c1b2d102bbc753 | MATLAB | 1,780 | 45 | function X = mat(x,n)
% Y = MAT(x,n) or Y = MAT(x) (the 2nd argument is optional)
% Given a vector of length n^2, this produces the n x n matrix
% Y such that x = vec(Y). In other words, x contains the columns of the
% matrix Y, stacked below each other.
%
% See also vec.
% This file is part of SeDuMi 1... |
751df264668c41afb8e7a8840d3eb259a1c60ccf4a48e5a21497088e18991fc6 | MATLAB | 1,780 | 62 | function [z, r, tp] = fsLR2roizmat_ciftidat_ciftinode(cii, roi_cii)
% DESCRIPTION:
% Extract node time series from 32k fsLR saved in CIFTI dtseries.
% Outputs correlation matrix (r), fishers-z-transfromed corr matrix (z),
% and node-by-timepoint matrix (tp).
%
% cii: Full pat... |
c15446bd4b98f2235643e5862b1be5b0b2149e35572c9acd8a32bc68ed25edb4 | MATLAB | 1,780 | 35 | function varargout=ea_coregpostopct_fsl(options)
% Wrapper function for FSL FLIRT registration of post-op CT
% __________________________________________________________________________________
% Copyright (C) 2019 Charite University Medicine Berlin, Movement Disorders Unit
% Andreas Horn
if ischar(options) % return n... |
063beade06791824fa68e3ccc7d0c80619424fcf0a8d1415cff08426de0de07c | MATLAB | 1,781 | 65 | function [prevhold] = takehold(ax, mode)
%TAKEHOLD hold axes and return previous hold status.
% TAKEHOLD(ax) is equivalent to hold(ax, 'on'), where ax is the handle to
% an axes object.
%
% TAKEHOLD(ax, 'local') clears the axes ax if their previous hold state
% is off and then holds the axes, i.e., hold(... |
c94d4d61785efea5c1c5f84f4686c160ec87286b27d21f048349674d772de033 | MATLAB | 1,781 | 42 | function [ytrR, yteR] = residualizeY(ytr, yte, Ctr, Cte, doIt)
% residualizeY Optional train-only nuisance regression of a continuous outcome.
%
% [ytrR, yteR] = residualizeY(ytr, yte, Ctr, Cte, doIt)
%
% Companion to residualizeFold for the outcome side. Only meaningful for a
% CONTINUOUS outcome, so only PLSR_... |
4f8f92d137e8b11c956a313e00403f2cecd850a89e13a23dcbe3c57777f067b3 | MATLAB | 1,782 | 39 | function bad_channels = RFT_clean_flatlines(signal,max_flatline_duration,max_allowed_jitter)
% Detects (near-) flat-lined channels in your EEG data.
%
% ADAPTED BY NPA LAB to only return the list of bad channels, not removing
% them (as it was done in EEGlab and we work with ft structures)
%
% In:
% Signal : c... |
6a9205e848c3d1aef33e651f508e69a1b63b3a07d649fc16296604ad07b0322b | MATLAB | 1,782 | 55 | function [xAP]=ent_xap(X,Y,M,r,k)
%[xAP]=ent_xap(X,Y,M,r,k)
%
% inputs: X - first time series
% Y - second time series
% M - something vector length
% r - R tolerance to find matches, proportion of the stdev
% k - something lag
% outputs: xAP - cross approximate entropy... |
a0fa6ba699d2202298a19595f98fb1736ebe70cce448e89ce4d8ae7e1fff0b59 | MATLAB | 1,782 | 46 | function apref = ea_antspreset_legacy_preset1(cmd)
if ischar(cmd) % 'query' mode, return the name of the preset
apref = 'Legacy: Original Lead-DBS Preset 1';
return
end
normsettings = cmd; % cmd is the 'normsettings' struct
switch normsettings.ants_metric
case 'Mutual Information'
apref.metric='MI... |
2354a9f0078f0efcb633f3aef2c9edcb5c83e64f7061850283ba6e4723ac4b13 | MATLAB | 1,783 | 45 | function hypograph( varargin )
%HYPOGRAPH Declares a hypograph variable.
% HYPOGRAPH VARIABLE x
% where x is a valid MATLAB variable name, declares a scalar
% variable for the current cvx problem, and specifies it as
% the objective of a maximization. There is no need to declare
% a separate MAXIMIZE ... |
6c478729fbce7894ccbab33c6fbbfbee7546da20a39cedd41f9e4b817621d2d7 | MATLAB | 1,783 | 55 | function plot_vector(X,f,plt,Xerr,c,w)
% Function to plot a frequency dependent vector X. If error bars are specified in Xerr,
% it also plots them. Xerr can either contain upper and lower confidence intervals
% on X, or simply a theoretical confidence level (for the coherence). Used
% to plot the spectrum and coh... |
1e0ddf73c2aae76122e6f88cddf2063f0682499ff46d6b62bb99fa1bdba5299f | MATLAB | 1,785 | 47 | function ea_export_as_atlas(app, ss_val, ff_val, nm_val)
if ss_val
sides = fieldnames(app.explorer.spotdrawn);
for i = 1:length(sides)
spot{i} = app.explorer.spotdrawn.(sides{i});
end
else
spot = {};
end
if ff_val
disctract = app.explorer.fiberdrawn;
disctract.info.Connectome = app.exp... |
41f323438d20d1353ff960dc425fa56ec9ad8278a08cc0659ae3112d28d39618 | MATLAB | 1,785 | 49 | function W = threshold_edges_proportional(W, p, weight_to_remove)
% threshold_edges_proportional.m
%
% This function "thresholds" the connectivity matrix by preserving a
% proportion p (0<p<1) of the strongest or weakest weights. All other weights,
% and all weights on the main diagonal (self-self connections) are... |
d5b3f5123d48d702139501638e4b141e9ad81129776386bff98ef52f5d562fd5 | MATLAB | 1,786 | 52 | function [outermost, inside] = find_outermost_boundary(bnd)
% FIND_OUTERMOST_BOUNDARY locates outermost compartment of a BEM model
% by looking at the containment of the triangular meshes describing
% the surface boundaries
%
% [outermost] = find_innermost_boundary(bnd)
%
% with the boundaries described by a struct a... |
263a841cb28000d0ca03a68194edf74144987da63c8d0c383cebdb3bc4bac6f5 | MATLAB | 1,788 | 52 | function [Template,space,new_vx2mm,voxsize,neworigin_vx] = ea_createTemplateSpace(varargin)
TemplateCenter = varargin{1};
TemplateVXDimensions = varargin {2};
voxsize = varargin{3};
templatepath = varargin{4};
if length(varargin) == 5
templatename = varargin{5};
else
templatename = 'template.nii';
end
if ~isequ... |
9b6ea21fd2cf5cf879ebc73f85bee6b47266758fccdd76907ac815bbfd64748d | MATLAB | 1,788 | 47 | % Periodic Boundary Conditions version
function [perim_list, area_list] = get_cell_shape(V, newC)
% GET_CELL_SHAPE Compute perimeter and area of every cell polygon under
% periodic boundary conditions (PBC).
%
% [perim_list, area_list] = GET_CELL_SHAPE(V, newC) computes, for each
% cell, the perimeter and area of ... |
cb9e74bba3d4ff25c5834c1fcb1dbc93d39b84d2293ea2fedb9589dc82309d91 | MATLAB | 1,790 | 46 | function ea_querytutor(bids)
machineId = ea_getMachineId;
jsonData = ea_getTutorData(bids);
baseUrl = 'http://tutor.lead-dbs.org/?userid=';
url = 'http://tutor.lead-dbs.org:8000/my-endpoint';
options = weboptions('RequestMethod', 'post', 'MediaType', 'application/json', 'HeaderFields', {'User-ID', ... |
e856c129ecdca0c2debc58dda93d1f03898f132e13024dcbeeee20cf849dee77 | MATLAB | 1,791 | 70 | function [occ whichBin dim] = Occupancy(self,variableName,varargin)
% [occ whichBin dim] = root.myvar2.Occupancy('x');
%
% Returns occupancy of root.myvar in each of the bins.
%
% Inputs:
% variableName- string of which variable to bin
%
% Outputs:
% occ - Number of samples in each bin
%
% whichBin - Tells whic... |
5d5b9422b44a9fb819eb72f7b52d5b6e1c4c902f4a503aaf5393873f48a2be33 | MATLAB | 1,792 | 93 | function dat=readinr(fname)
%
% vol=readinr(fname)
%
% load a volume from an INR file
%
% author: Qianqian Fang, <q.fang at neu.edu>
% date: 2009/05/03
%
% input:
% fname: input file name
%
% output:
% dat: output, data read from the inr file
%
% -- this function is part of iso2mesh toolbox (http://iso2mesh.s... |
1e74135827ebc67c43b87c2c4b03e728124fa1a9d574fce4f2b5163ef045a361 | MATLAB | 1,793 | 57 | %% Figure 10 main
% RUN fig9_analysis, then return here
fig9_analysis
% Load map
load('allenDorsalMap.mat');
% Params
mapColors = [
25, 200, 255; % blue
0, 215, 25; % green
235, 70, 225; % reddish purple
230, 165, 45; % orange
]/256;
areas = {'M2', 'M1', 'S1-fl', 'S1-hl', 'S1-tr'};
% Contour para... |
996faf7558cb67290e852b2c4d1fb3edff1a0fdeaf330704fee804ae89cb3506 | MATLAB | 1,793 | 63 | function CBIG_ASDf_CCA_plotScatter(V, U, R, pVal, factor_idx, output_name)
% CBIG_ASDf_CCA_plotScatter(V, U, R, pVal, factor_idx)
%
% This function plots scatter plot between factor loading CCA mode and
% behavioral scores CCA mode. If output_name is specified, the plot will be saved.
%
% Input:
% - V:
% ... |
37c27f6995b33cc1dd3e086b43359370440f79c99978b7b0c57f812809897e60 | MATLAB | 1,794 | 45 | function [stepperHandle,isOpen] = stepperInit(initData)
% function: [stepperHandle,isOpen] = stepperInit(initData)
% Input:
% initData = [VelocityLimit Acceleration CurrentLimit serialNumber]
% Return:
% stepperHandle: stepper motor handle
% status: is OPEN
isOpen = false;
VelocityLimit = initData(1);
Acce... |
3c27cf61a330f702c40e4fa8373a190c67bf9218f3619cd37f1a21b8ba80744e | MATLAB | 1,795 | 44 | %%********************************************************************
%% blkbarrier: calculate
%% [-v(p)*logdet(X{p}), v(p)*logdet(Z{p}) + n*v(p)*(1-log(v(p)))]
%% [-v(p)*log(gam(X{p})), v(p)*log(gam(Z{p})) + v(p)]
%% [-v(p)*log(X{p}), v(p)*log(Z{p}) + n*v(p)*(1-log(v(p)))]
%%***********************************... |
0409d7b2f19414288e49dc2225a519cc60604dcc77a548cbc00576dd87023a22 | MATLAB | 1,797 | 62 | function [x,y,button, key] = PointInput(varargin)
%function [x,y,button, key] = PointInput(n,figh, axish)
% Input:
% n = number of clicks
% figh - which figure to analyze the clicks in
% axish - in which axes .. try to avoid this complications, use defaults
% Output:
% x,y - coordinates of the axes where the click happ... |
b966a322dfe1900e9bfd3dbbec106cba952412486d80b8445064fea32b05777b | MATLAB | 1,797 | 60 | % Exercise 4.5: Show the equivalence of 3 convex problem formations
% From Boyd & Vandenberghe, "Convex Optimization"
% Joëlle Skaf - 08/17/05
%
% Shows the equivalence of the following 3 problems:
% 1) Robust least-squares problem
% minimize sum_{i=1}^{m} phi(a_i'*x - bi)
% where phi(u) = u^2 ... |
64edfb4e238a78267efa23933bc29217a0ecfec9dd3d4e1cb2016d934bdc3344 | MATLAB | 1,798 | 40 | function [outdata, outroi] = cifti_struct_dense_extract_surface_data(cifti, structure, dimension)
%function [outdata, outroi] = cifti_struct_dense_extract_surface_data(cifti, structure, dimension)
% Extract the data for one cifti surface structure, expanding it to the full number of vertices.
% Vertices... |
ca15c413b705bd874f1543430247709413ddd4b9bbc3dd171ecee389c0e3aeba | MATLAB | 1,799 | 61 | % configure file for operations on streamline trackings results
%
% for BATCH EDITOR system (Volkmar Glauche)
%
% File created by Susanne Schnell
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function realigndefi = dti_cfg_realigndef
yname = cfg_files;
yname.tag = 'yname';
... |
b64914c5481e46754c7ce3e2be3493743e7533d42a6680b6a3ab4931cdf54ce8 | MATLAB | 1,800 | 49 | % rsget() - get the p-value for a given collection of l-values
% (Ramberg-Schmeiser distribution)
%
% Usage: p = getfit(l, val)
%
% Input:
% l - [l1 l2 l3 l4] l-values for Ramberg-Schmeiser distribution
% val - value in the distribution to get a p-value estimate at
%
% Output:
% p - p-value
%
% Aut... |
d990146240cb7996e061d6815db70cc86820504c72a39adef769f63f808287ef | MATLAB | 1,800 | 69 | function ea_dsistudiomat2ftr(matFile, refb0, outputName, outputTRK, LPS)
% Convert the mat file exported from DSI-Studio to the FTR format in LEAD
%
% If the trk is going to be visualized in Surf-Ice, LPS should be set to 1
% to fix the orientation.
[directory, matName] = fileparts(matFile);
if isempty(directory)
... |
5a23bbf2d84ecbe263c6385686d711936ced29e5c5375b579623d207cbdb77b8 | MATLAB | 1,801 | 73 | function intervals = ToIntervals(x,in)
%ToIntervals - Convert logical vector to a list of intervals.
%
% USAGE
%
% intervals = ToIntervals(x,in)
%
% x values, e.g. timestamps
% in logical vector (1 = x value is inside, 0 = x value is outside)
%
% NOTE
%
% Values can also be omitt... |
93fdbda1c86b2bfb2d416ebea5573c75b2c81a13c41d551d1d23552d19135c79 | MATLAB | 1,801 | 52 | function y = polyval_trig( p, x )
%POLYVAL_TRIG Evaluate a trigonometric polynomial.
% Y = POLYVAL_TRIG(P,X) returns the value of a trigonometric polynomial P
% evaluated at X. P is a vector of length N+1 whose elements are the
% coefficients of the polynomial in descending powers.
%
% Y = REAL(P(1)*W^N + ... |
fdf5de67d71bea04e8acd7f3399575c75866481351130785f4e905f3e35f82ed | MATLAB | 1,802 | 88 | function createModelModelLUT_classical(ten,alpha,tissue_params,Pstruc,fid)
alpha =0;
dirs = load('dwidirections.mat');
dirs = [dirs.dirs128 -dirs.dirs128];
[~, W] = createWeightingScheme(ten,Pstruc.b_weighting);
Da = tissue_params(1);
Dp = tissue_params(2);
vf = tissue_params(3);
P = squeeze(ten(1,1,:))*dirs(1,:)... |
070c56024e6a5268a3e3b017883a61065bf14778cb878171a85bd927c9e3365c | MATLAB | 1,803 | 80 | function h=ea_parcellation2multisurface(nii,indices,colormap)
% surface can be a char (smoothed/full) or a cell pointing to rh and lh
% .mz3 surface files.
if ~exist('surface','var')
surface='auto';
end
if ~exist('sides','var')
sides=1:2;
end
if ~exist('colormap','var')
colormap=lines; %ea_color_wes('al... |
c5ad6f4f5bee41d37c5d3ec9c757570674ba061a52d403c3dad6c660a462f603 | MATLAB | 1,805 | 65 | function DBDisplay(results)
%DBDisplay - Display results of a database query.
%
% USAGE
%
% DBDisplay(results)
%
% results output of <a href="matlab:help DBGetFigures">DBGetFigures</a> or <a href="matlab:help DBGetFigures">DBGetVariables</a>
%
% EXAMPLE
%
% DBDisplay(DBGetVariables('name="Spectrogram... |
d34018195fe99838439f9d700c361d2269edbe0c47dc96d2a0c6c11e58f61178 | MATLAB | 1,805 | 53 | function seed = ea_conformseedtofmri(dataset,seed,interp)
% Use SPM coreg to conform space for VTA.
% Can solve the all nan/zero problem for some very small VTA. The course is
% that rigid body reslicing provided by spm_reslice is not enough. 12 DOF
% (affine) or 9 DOF (traditional) transformation might be needed.... |
d88eb5c45852ccfab6941d9c40d78129879683256c69f519384ca2940bd405e4 | MATLAB | 1,805 | 55 | function subtree = branch(tree,uid)
% XMLTREE/BRANCH Branch Method
% FORMAT uid = parent(tree,uid)
%
% tree - XMLTree object
% uid - UID of the root element of the subtree
% subtree - XMLTree object (a subtree from tree)
%__________________________________________________________________________
%
% Re... |
fa57cf1be3ef0508c3c9bf18e4cc501f1e5d467bed37f96c59e5fa9cd10d612a | MATLAB | 1,805 | 56 | function [betas, stats] = CBIG_fitGLM_4t(subInfoFile, GMICVFile, q)
% [betas, stats] = CBIG_fitGLM_4t(subInfoFile, GMICVFile, q)
% What is the subtype order?
% Offset by 1, the RID column
%
% Written by CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
SUB_COL = 1+2;
FRO_COL = 1+3;
P... |
8dc6974754c7efe103b6ff5deb79d6ee96d741cc7b70309738a87e11f58c22fe | MATLAB | 1,806 | 43 | function perm = sortnnz(At,Ajc1,Ajc2) %#ok
% perm = sortnnz(At,Ajc1,Ajc2)
%
% SORTNNZ Sorts columns in At
% in increasing order of nnzs; only the nnzs between Ajc1 and Ajc2
% are considered for each column. If Ajc1 or Ajc2 is empty, we use
% the start or end of the columns in At.
%
% ******************** I... |
378fe655c84d6aa24ce06acffc977ebc8247fb116139299528a803a30588644d | MATLAB | 1,807 | 55 | % val = clamp(val,minval,maxval)
% ---------------------------------------
%
% Clamp an nd-array between minval and maxval
%
% Inputs:
% val Input matrix
% minval Any value of val smaller than minval will be made equal to minval
% maxval Any value of val larger than maxval will be made equal to maxval... |
eeee7e7872d4c8c30d90888edd39e87f13c400643af3072f45fb8d7f1438d475 | MATLAB | 1,808 | 62 | function sim = metad_sim(d, metad, c, c1, c2, Ntrials)
% sim = metad_sim(d, metad, c, c1, c2, Ntrials)
%
% INPUTS
% d - type 1 dprime
% metad - type 2 sensitivity in units of type 1 dprime
%
% c - type 1 criterion
% c1 - type 2 criteria for S1 response
% c2 - type 2 criteria for S2 response
% Ntrials - number of trials... |
5138b2875de2523288d1b82191e6768f3d394b0e686f6b58f8f06728660308f5 | MATLAB | 1,809 | 48 | function ephysPropertiesTable = saveEphysProperties(paramEP, ephysProperties, savePath)
% JF, Reformat and save ephysProperties
% ------
% Inputs
% ------
% paramEP: matlab structure defining extraction and classification parameters
% (see bc_ephysPropValues for required fields
% and suggested starting values)
% e... |
808f662894e769443c365af78271ff5a261b1d422ac9c0f3c8b0321cac7e0c6c | MATLAB | 1,809 | 55 | function [adfreq, n, ad] = plx_ad_span(filename, channel, startCount, endCount)
% plx_ad_span(filename, channel): read a span of a/d data from a .plx or .pl2 file
%
% [adfreq, n, ad] = plx_ad_span(filename, channel, startCount, endCount)
%
% INPUT:
% filename - if empty string, will use File Open dialog
% st... |
9759edf27de74216fc41c03ef97b5658b6aa61eb34e90923d56270926a8b5e68 | MATLAB | 1,809 | 61 | function [node,face,elem]=meshcylinders(c0, v, len, varargin)
%
% [node,face]=meshcylinders(c0, v, len, r,tsize,maxvol,ndiv)
% or
% [node,face,elem]=meshacylinder(c0, v, len, r, tsize,maxvol,ndiv)
% [nplc,fplc]=meshacylinder(c0, v, len,r,0,0,ndiv);
%
% create the surface and (optionally) tetrahedral mesh of a 3D cyl... |
ea950c64e8aeadfd7f06dd4c853702b11e73f06046f83fa6094cc8f03186d99d | MATLAB | 1,809 | 49 | function [isolationDist, Lratio, silhouetteScore, histogram_mahalUnit_counts, histogram_mahalUnit_edges, histogram_mahalNoise_counts, histogram_mahalNoise_edges] = getDistanceMetrics_2(pc_features, pc_feature_ind, thisUnit, numberSpikes, spikesIdx, allSpikesIdx, nChansToUse, plotThis)
nPCs = size(pc_features, 2);
thes... |
1602e6878b405b83480cce897612c9e89722b2b2ec69208ab19fd82f791eac7b | MATLAB | 1,810 | 47 | function ea_run_cleartune_from_leadDBS(~,~,handles, file)
config = [];
% Choose if/which fibfilt file to run with
if file == 1
tractset_path=ea_regexpdir(ea_get_cleartune_root, 'PD_Symptom_Specific_Tracts_Rajamani_2024.fibfilt', 1, 'file');
if isempty(tractset_path)
disp('T... |
fab7e2c830f6ebaa92b00171cf133efe9c731ac61631399b2733d57a65ff7a41 | MATLAB | 1,811 | 58 | function s = export(this,target)
% Export a GIfTI object into specific MATLAB struct
% FORMAT s = export(this,target)
% this - GIfTI object
% target - string describing target output [default: MATLAB]
% s - a structure containing public fields of the object
%______________________________________________________... |
3ff12b3e1162688aed6863c9a34442427f43691d0fc61f2a323c17f2d9304db7 | MATLAB | 1,813 | 63 | function header = ea_fslhd(input, xmlarg)
% Wrapper for fslhd
% Use XML-style NIFTI header or not
if nargin < 2
xmlarg = '';
elseif strcmp(xmlarg, 'x')
xmlarg = '-x';
end
if ~isfile(input)
error('%s not found!', input);
end
basedir = [fileparts(mfilename('fullpath')), filesep];
FSLHD = ea_getExec([basedi... |
3ab5c9b6bd5b04b2b8755791b3f3f4d79d2db85ba4ed925051959b26b2c3ba28 | MATLAB | 1,814 | 71 | % this voxel-wise parcellation scheme has been built using the
% mni_icbm152_gm_tal_nlin_asym_09c template. The template was downsampled
% to a voxel-size of 4 mm isotropic and thresholded at 0.5 (threshold was
% actually set to 0.52483 to obtain a round number of exactly 35k nodes).
% Indices start on the left hemisph... |
e45fa0d68b7b41317e39854e7ea9c8db35cfdd158c61064f1b0ae0cabfd3398e | MATLAB | 1,814 | 40 | % do Bayesian inference on C. diff dataset
load cdiff_data_reformatted.mat;
doBayesianInference('params_cdiff/','output_cdiff/',T,intervene_matrix,[],data_counts,species_names,BMD,experimentBlocks);
% example of computing trajectories for C. diff from day 30 to day 56
% load processed data and MCMC samples
loa... |
a28e714d472899154475e4187b283e6507b274213c287742ad3cffc5bf7cf2df | MATLAB | 1,816 | 55 | function CFA_SingleGroupPval_Perm(DATtemp,VoxelDir,LabName,V,j,IDtemp)
subnum = size(DATtemp,2);
Indexist = find(sum(DATtemp,2));
% PermDat = DATtemp(:,Indexist);
% full(sum(DATtemp,2))
bs_num = 5000;
bs_mat = ceil(rand(bs_num,subnum)*subnum);
% bs_mat(bs_mat==0) = 1;
% Edat = zeros(length(Indexist),bs_num);
Seplength... |
48fac48f44a44ef73a5220257bce6172edd2157c7ab17a367b3e408f896c1068 | MATLAB | 1,818 | 16 | %EEGLAB statistics functions (statistics folder):
% <a href="matlab:helpwin anova1_cell">anova1_cell</a> - Compute F-values in cell array using ANOVA.
% <a href="matlab:helpwin anova1rm_cell">anova1rm_cell</a> - Compute F-values in cell array using repeated measure...
% <a href="matlab:helpwin anova2... |
875ed276feec321354e5eed805eb63d39ad36d5c0c4ef0d281e354cb01aca4f4 | MATLAB | 1,818 | 49 | % Simple power control in communication systems via GP.
% Boyd, Kim, Vandenberghe, and Hassibi, "A Tutorial on Geometric Programming"
% Written for CVX by Almir Mutapcic 02/08/06
% (a figure is generated)
%
% Solves the power control problem in communication systems, where
% we want to minimize the total transmit... |
86c04e3afd37b54fe9949256793279c7e3f5d2e5a5fb8ae989ee6f2707b0376f | MATLAB | 1,821 | 71 | % this voxel-wise parcellation scheme has been built using the
% mni_icbm152_gm_tal_nlin_asym_09c template. The template was downsampled
% to a voxel-size of 5 mm isotropic and thresholded at 0.5 (threshold was
% actually set to 0.5 to obtain a round number of 8057 nodes).
% Indices start on the left hemisphere from do... |
d30943dc1f1924ab022e619b7d6b888a62bdb68abd75252375650b832be1cc78 | MATLAB | 1,821 | 53 | function s = sideEffects(fn)
%SIDEEFFECTS Run fn and report the environment damage it caused.
%
% s = nonantest.sideEffects(@() SomeFunction(args))
%
% A numerically correct function can still be unusable on a cluster. This
% records the three ways NONAN functions currently break headless execution:
%
% s.fig... |
1e10df7358da444fef15d46d953ac3a18a53c7d1e352822e62bb6e385a9aa1f6 | MATLAB | 1,822 | 65 | function x = cvx_reshape( x, s, rmap, cperm, cperm2 )
sx = size( x );
if nargin < 5,
cperm2 = [];
if nargin < 4,
cperm = [];
if nargin < 3,
rmap = [];
if nargin < 2,
s = sx;
end
end
end
end
usp = cvx_use_sparse( s, nnz... |
572786150c7db085d08d037450d06189e19bc7614864f534cb59c2e97db2430f | MATLAB | 1,822 | 70 | function obj=update(obj,varargin)
% update update grouping factors in order to superimpose layers in the same
% figure.
% Update takes the same arguments as the constructor gramm(). Only provide
% the data you want to replace.
%For iscategorical()
persistent old_matlab
if isempty(old_matlab)
old_matlab=verLessThan... |
836df8183fdd362e35efd250882c79a372d7a18ce22eda131a047b71dbfec2c5 | MATLAB | 1,822 | 77 | function [pval z] = circ_rtest(alpha, w, d)
% Computes Rayleigh test for non-uniformity of circular data.
%
% [pval, z] = circ_rtest(alpha,w)
% H0: the population is uniformly distributed around the circle
% HA: the populatoin is not distributed uniformly around the circle
% Assumption: the distribution has max... |
a12b53ea73c2252b42f8acde8ad05800289534af6b8fe20d0b3a566a8b472fd9 | MATLAB | 1,822 | 46 | % trial2eegplot() - convert eeglab format to eeplot format of rejection window
%
% Usage:
% >> eegplotarray = trial2eegplot(rej, rejE, points, color);
%
% Inputs:
% rej - rejection vector (0 and 1) with one value per trial
% rejE - electrode rejection array (size nb_elec x trials) also
% made of 0 an... |
1b960dc85a0c9c713404d4bc8a015efdc66c6ccb528ccbac3ef702a172d61b9f | MATLAB | 1,823 | 71 | % this voxel-wise parcellation scheme has been built using the
% mni_icbm152_gm_tal_nlin_asym_09c template. The template was downsampled
% to a voxel-size of 5.5 mm isotropic and thresholded at 0.5 (threshold was
% actually set to 0.5 to obtain a round number of 8057 nodes).
% Indices start on the left hemisphere from ... |
66e248d7227a9ae5f558eea5ca8f630f4904b26790fe365939a85698d66728db | MATLAB | 1,823 | 54 | % dipfit_reject() - remove dipole models with a poor fit
%
% Usage:
% >> dipout = dipfit_reject( model, reject )
%
% Inputs:
% model struct array with a dipole model for each component
%
% Outputs:
% dipout struct array with a dipole model for each component
%
% Author: Robert Oostenveld, SMI/FCDC, Nijmegen 2003
... |
cc1c0390643bbf752e0634ce6e19be69f1aa7501962ca51ccdbb1755d994d4f9 | MATLAB | 1,824 | 66 | function image = mijread(filename)
% mijread, version 1.0
%
% im = mijread;
% im = mijread(filename);
% im = mijread(url);
%
% Read the images or stack of images using the ImageJ library.
% Files must be in TIFF (uncompressed), PNG, GIF, JPEG, DICOM, BMP, PGM or FITS
% format TIFF images can be 1-bit, 8-bits, 16-bits ... |
dc31cbc8e63e754caa3b2dbb89590e9ed06c39d67d360d86cadf19f4666cf677 | MATLAB | 1,825 | 50 | classdef CBIG_MSHBM_Epilepsy_unit_test < matlab.unittest.TestCase
% Written by Mervyn Lim Jun Rui and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
methods (Test)
function test_example(testCase)
% ====================================
%% Setup
... |
68c03f5d4880093e5d2c447298c7ee5c19605b48a7a8a8e86130b2dcedddfe1e | MATLAB | 1,826 | 65 | function surf_to_tetgen(filename, nodes, elements, element_types, attributes_nodes,attributes_elements)
% This function converts a triangulated mesh in FieldTrip format into a
% surface structure readable by Tetgen software
% Copyright Arno Jannsen, 2011
%Write the node file
node_filename = [filename '.node'];
precis... |
d81e17830aa56a28575177f439b8c896b90cc8a1385f61fb29cb39b97ff989ca | MATLAB | 1,826 | 53 | function s = export(this,target)
% Export a GIfTI object into specific MATLAB struct
% FORMAT s = export(this,target)
% this - GIfTI object
% target - string describing target output [default: MATLAB]
% s - a structure containing public fields of the object
%________________________________________________... |
0fc39d52aed33ba9714b80e67748b9d40c4a3513fefe141d7a06d40977d860dc | MATLAB | 1,827 | 63 | function [psgOUT, scoresOUT] = subsetsleepstage(psg, scores, ar, sleepstage, verbose)
%%
% Authors: Dan Denis
% Date: 2021-07-14
%%
% Get length of epoch in samples
epochSampleLength = scores.hdr.win * psg.hdr.srate;
% Get the start and end sample of each epoch
epochSample = indexepochs(epochSampleLength, psg.hd... |
ebe7651d5ba702ff31ea951df99cc7dcf2cb56cf2d8eb2de93e49b7939243356 | MATLAB | 1,827 | 77 | function [pval z] = circ_rtest(alpha, w, d)
%
% [pval, z] = circ_rtest(alpha,w)
% Computes Rayleigh test for non-uniformity of circular data.
% H0: the population is uniformly distributed around the circle
% HA: the populatoin is not distributed uniformly around the circle
% Assumption: the distribution has max... |
ea45411fbb0ae25bdf11423eb54609ba6648ee0cb879534c3a4700756c72c98d | MATLAB | 1,828 | 56 | ccc;
GRANGERPATHs = dir("..\MAT Data\granger result raw\PE\1\single\CC\**\*.mat");
GRANGERPATHs = arrayfun(@(x) fullfile(x.folder, x.name), GRANGERPATHs, "UniformOutput", false);
% GRANGERPATHs(contains(GRANGERPATHs, '\PE\1\')) = [];
data = cellfun(@(x) load(x).res, GRANGERPATHs);
f = data(1).freq;
t = data(1).time;
... |
dd646a1e4e091a6aae8d401a344e44a86561f5ce73cd58e54d7415d9bd8613fb | MATLAB | 1,830 | 65 | function c = clim(handle,clims)
%clim - Get or set color scaling limits for current axes (or all figure axes).
%
% USAGE
%
% clims = clim
% clim(h)
% clim([c0 c1])
% clim(fig,[c0 c1])
%
% h optional axes or figure handle (default = gca)
% c0, c1 optional scaling minimum and maxi... |
e2efc9e57182883cc82542df601d63c58e5368eb16012d1b5874c7994e4f0996 | MATLAB | 1,830 | 66 | function histmat = hist2D(x, y, xedges, yedges)
% function histmat = hist2D(x, y, xedges, yedges)
%
% Extract 2D histogram data containing the number of events
% of [x , y] pairs that fall in each bin of the grid defined by
% xedges and yedges. The edges are vectors with monotonically
% non-decreasing values.
%
%... |
4325f69d12b14ff876690418d6d53dfbaa4aa15e4bbb0593e6b30373bb1f60f4 | MATLAB | 1,831 | 73 | function [TFR,tVec,fVec] = spectralevents_ts2tfr(S,fVec,Fs,width)
% function [TFR,tVec,fVec] = spectralevents_ts2tfr(S,fVec,Fs,width);
%
% Calculates the TFR (in spectral power) of a time-series waveform by
% convolving in the time-domain with a Morlet wavelet.
%
% Input
% -----
% S : si... |
a9714286225c5c53e9a39fb830b0693ff1c7cdcda83ab75304d8a705ffbc7f72 | MATLAB | 1,831 | 44 | %% code to plot distances for two example vertices to verify
clear all
oak_stem = '/oak/stanford/groups/kalanit/biac2/kgs/projects/';
results_path = fullfile(oak_stem, 'Dawn/NSD/results/spacetorch/brain_figures');
distance_type = 'spherical';
if strcmp(distance_type, 'spherical')
distance_stem = 'spherical_';
... |
26b54a3d8304b4711912123f7f95ae3dd16d9295c1818a489e4f005faf9d46f4 | MATLAB | 1,832 | 54 | % XMLTree: XML Toolbox for MATLAB and GNU Octave
% Version 2.0 14-Aug-2015
%
% XML file I/O.
% xmltree - Constructor (XML parser).
% save - Save an XMLTree in a file.
%
% XML Tree manipulation methods.
% add - Add a node in a tree.
% attributes - Handle attributes of a node.
% branch ... |
355ef4723bcf43d449d568f152e7e530af79389387c95582072eb0464e44895d | MATLAB | 1,834 | 54 | function ea_get_4Dfield_from_csv(field_in_csv, file2save)
% Get nifti file with X,Y,Z vector components of the electric field.
% By Butenko, konstantinmgtu@gmail.com
arguments
field_in_csv % where the csv file with field components is stored
file2save % 4D nifti filename
end
%ea_dispt('Creating nif... |
dae7ca3a19bd5f920771d1a80a4a4c9d10718399e907c7e893a95a0e515f458c | MATLAB | 1,834 | 57 | function [Ycon,ln] = concatenate_files(files,filename,output_type)
% concatenate a list of files into a single file
% INPUTS
% files: list of a files as a struct array. Name of each file is in files(i).name
% filename: output filename
% type: output type ('mat' array loaded in RAM (default), '... |
7f325276fb8907dc965a0576de4c016d290a842fb4c8bd311ddbdfebcb7957c4 | MATLAB | 1,836 | 65 | function usemask = ea_unified_getobjmask(obj,im)
% Determine mask type string
maskn = ea_mask2maskn(obj);
switch maskn
case 'equation'
eq = obj.cvmask(5:end); % remove =Eq:
eq = strrep(eq, 'X', 'im(:)');
usemask = eval(eq);
case 'nifti'
maskn... |
4c632e8216cf6659d21df68e8182878ca883e6d2de9e09bc6f877fb9679ce839 | MATLAB | 1,837 | 49 | function filename = fetch_url(filename)
% FETCH_URL checks the filename and downloads the file to a local copy in
% case it is specified as an Universal Resource Locator. It returns the
% name of the temporary file on the local filesystem.
%
% Use as
% filename = fetch_url(filename)
%
% In case the filename does not... |
6ac751e16dbd5ac395154c68db7ec499bc4833b2414c78a13c2639508b14fa8a | MATLAB | 1,838 | 50 | function varargout = palm_dpxread(filename)
% Read a curvature file (DPV or DPF), in ASCII format.
% This function is much faster than 'dlmread' for large files,
% and works only in Linux and Mac.
%
% [dpx,crd,idx] = dpxread(filename)
%
% - dpx contains the values for each vertex or face
% - crd contains the vertex co... |
cd50a4875603b3c7469eee55a8af8cc16f61d66cb48a98b831f4574e721ef85a | MATLAB | 1,838 | 35 | function [OR,CI95_up,CI95_low,p] = ea_discfibers_odds_ratios(activ_prob, outcome)
% See the method's description in Jergas et al 2023 https://doi.org/10.1101/2023.04.26.23289100
%disp('Calculating fiber-wise Odds Ratios for EF-sigmoids ...')
allAntiValues = 1 - activ_prob; %%non-connected voxvals = 1-voxval
for f =... |
25e15035566a2ab1c8b7d3c236828571c3d853753b009a60c8f4f1bb118f8ddd | MATLAB | 1,839 | 51 | function [loadmovieflag, I1, Mem_max, w, handles] = loadmovie_init(handles)
loadmovieflag = 0;
w = [];
I1 = [];
[imagefolder, imagefilename, fext] = fileparts(handles.filename);
handles.fext = fext;
savename = [regexprep(imagefilename,' ', '_'), '_roi.mat'];
handles.savename = savename;
figuretitlename = regexprep(im... |
ec2ddc3f26a671d81ca1457b1eee2947a7d27b5b68c051789161d9bd22882705 | MATLAB | 1,839 | 57 | function image_cell_str = plugin_unzip_images_if_needed(str)
% Take a string with wildcards (str) to list files, and return list of images image_string_matrix
% If no images, look for .gz version and unzip those.
% If not found, return empty image_string_matrix
%
% image_string_matrix = plugin_unzip_images_if_needed(... |
9c7954ba3f79e5fce16034836e8c206c461c252040e797e1a2c81411b169cdd7 | MATLAB | 1,840 | 82 | function [pval m] = circ_otest(alpha, sz, w)
%
% [pval, m] = circ_otest(alpha,sz,w)
% Computes Omnibus or Hodges-Ajne test for non-uniformity of circular data.
% H0: the population is uniformly distributed around the circle
% HA: the population is not distributed uniformly around the circle
%
% Alternative to t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.