sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c25fb91654c7be0be7df65b9aec2caf9d8e02aa1b60c3641b7f4f6a88aedca1b | MATLAB | 1,968 | 57 | function y = Amul(At,dense,x,transp)
% y = Amul(At,dense,x,transp)
%
% AMUL Computes A*x (transp=0) or A'*x (transp=1), taking care of dense.A.
%
% ********** INTERNAL FUNCTION OF SEDUMI **********
%
% See also sedumi
% This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko
% Copyright (C) 2005 McMaster... |
dd3eed37f4e8b8a8cad25f50864b19c86aaa35164f434d83842549546972d8f6 | MATLAB | 1,968 | 67 | %% CALCULATE SIMILARITY
%
%
%% Configuration
clear
clc
fprintf(' *** Estimation of neural efficiency between rest and the dot-probe task ...\n')
%Define cohort, session, correlation
Cohort = '2'... |
dd210b46bb55d3cf017bc6eabc42ac49740ab0b8f9833f67768c134549893c40 | MATLAB | 1,969 | 69 | % Design a 1/f spectrum shaping (pink-noise) filter
% "Filter design" lecture notes (EE364) by S. Boyd
% "FIR filter design via spectral factorization and convex optimization"
% by S.-P. Wu, S. Boyd, and L. Vandenberghe
% (a figure is generated)
%
% Designs a log-Chebychev filter magnitude design given as:
%
% minimi... |
0f1377d8ac5c4e6d074f64cf4f18bc3b99d08efccc31ee931e4d0eea5bece668 | MATLAB | 1,970 | 48 | height_pix = 1080;
height_deg = 42.6;
pixperdeg = height_pix/height_deg;
radius = [height_pix/2 0];
sector = [-180 180];
thchsz = 10; % 1/SF; % thchsz = wedge width - bigger number less checks per visible wedge = Angle_per_Vol/Parameters.ChecksAng
rchsz = 3.2; % rchsz = ring width (deg) - bigger number more checks p... |
907ebbd45e3d99e71ab422eb098b1570476417001371c5756493d083fd61a5a5 | MATLAB | 1,970 | 60 | function computeObjectMaps(params)
% computeObjectMaps(params)
%
% ----------------------------------------------------------------------
% Matlab tools for "Predicting human gaze beyond pixels," Journal of Vision, 2014
% Juan Xu, Ming Jiang, Shuo Wang, Mohan Kankanhalli, Qi Zhao
%
% Copyright (c) 2014 NUS VIP -... |
c22dc6a14b0b2e4f792d60b53257e889fac9ee3da87db7564d870a51b942f84e | MATLAB | 1,970 | 64 | function plotTrajectories(kinematics, plotParams)
% Plot finger centroid trajectories
% Make figure if asked
fig;
if ~isfield(plotParams, 'panelwidth') % Fig 1 main uses defaults
panelwidth = 3.25;
panelheight = 3.25;
else
panelwidth = plotParams.panelwidth;
panelheight = plotParams.panelheight;
end
le... |
6ca5164276343b848064c4477d236c678fe573acf7898fce93bbfd37517ed93e | MATLAB | 1,971 | 63 | function [numidpoint,greyobj,options]=ea_findonemidpoint(slicebw,estpoint,mask,options)
% __________________________________________________________________________________
% Copyright (C) 2014 Charite University Medicine Berlin, Movement Disorders Unit
% Andreas Horn
try
stats=ea_centroid(slicebw);
catch
keyb... |
d4d2513e36b33d5e1df680bf140c548646858264e2ec44fa2046ac1e995efca2 | MATLAB | 1,972 | 40 | function X = remove_boundaries(I,shifts,method,template,add_value)
if nargin < 5 || isempty(add_value);
add_value = min(I(:));
end
if nargin < 3 || isempty(method);
method = 'nan';
end
shifts = round(shifts);
sz = size(I);
nd = ndims(I);
X = I;
if strcmpi(method,'nan');
method = 'zero';
... |
4cc8c43a243cc9bf6472c71d554c277ac5f3252793b927a989073da9778554c8 | MATLAB | 1,973 | 42 | function [lh_avg_mesh, rh_avg_mesh, lh_mask, rh_mask] = CBIG_hMRF_load_mesh_mask_by_mesh_type(mesh_type)
% [lh_avg_mesh, rh_avg_mesh, lh_mask, rh_mask] = CBIG_hMRF_load_mesh_mask_by_mesh_type(mesh_type)
%
% This function loads the surface mesh and the binary vector indicating cortex vs medial wall given a surface mesh.... |
bc990ef81da78209c6ca6ccf7af070d7d735f340434bb39c5dc96c82bc723e86 | MATLAB | 1,974 | 53 | function computeTurnBouts2(allflies,angvelthresh)
angvelthresh = 10;
for u = 1:length(allflies)
allflies(u).angvel = 100 * diff(allflies(u).camH);
turnindsR = []; turnindsL = [];
thing = downsample(movmean(allflies(u).angvel(1:3000),100),10);
findRturns = @(data) find(diff(sign(da... |
e5edc4017ab40fbe3e80b6fb5fca59308b2862eb9546181dcd0161e2079ba05f | MATLAB | 1,974 | 74 | function Y = spectralEmbedding(X, numEigs)
% Computes the spectral embedding of the data matrix X as described in the
% methods of Esmaeili et al 2021, Neuron
% Steps:
% - create RBF distance matrix
% - compute normalized graph Laplacian
% - eigendecompose Laplacian
% - keep components corresponding to desired number o... |
87164101967e23321a28f5a6a9ba6326841517a757711071cd7cd4465904b70f | MATLAB | 1,976 | 63 | function dxcurr = CBIG_MMLDA_dxchange2dxcurr(dxchange)
% dxcurr = CBIG_MMLDA_dxchange2dxcurr(dxchange)
%
% Convert dxchange variable to dxcurr variable of diagnosis of the subject.
%
% Input:
% - dxchange : The changing diagnosis of the patient including 9 cases:
% dxchange = 1 means convert from CN ... |
98ddfdc5efdb3b71c0e8d7524d5e08055c716860955e5ea82d613339943d7190 | MATLAB | 1,977 | 39 | % Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions
%
%=========================================================================
%
% Copyright (c) 2008 Thomas Yeo and Mert Sabuncu
% All rights reserved.
%
%Redistribution and use in source and binary forms, with or without
%modification, a... |
2a58a1d67c03480a6fc79a6a11da9a76a1cc4a4a39d3e54a9ae02d2575f28524 | MATLAB | 1,978 | 55 | function [y, ddotx, Dx, xTy] = PopK(d,x,K,lpq)
% [y, ddotx, Dx, xTy] = PopK(d,x,K,lpq)
%
% POPK Implements the quadratic operator for symmetric cones K.
%
% ********** INTERNAL FUNCTION OF SEDUMI **********
%
% See also sedumi
% This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko
% Copyright (C) 2005... |
e1865cdefaa74918bf4b9f5798891dd9a497111350b6ab4191a98aaed9c27cfe | MATLAB | 1,978 | 38 | % SOFA API - demo script
% Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences
% Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "License")
% You may not use this work except in compliance with t... |
1dd6ad683cea4c72cb3f903eff98800b63658d64498f11bb0c190928e10c72e8 | MATLAB | 1,980 | 40 | % CVX: Built-in operators and functions supported in CVX models.
%
% The following operators and functions are included with MATLAB but
% have either been verified to work properly within CVX models or have
% been extended with additional code to do so. In many cases, typing
% help cvx/<func>
% where <f... |
3afd5b0dc4cf1acc7c021f2a163be50f7c3d5b4400a3cd806c4506bc31ae2346 | MATLAB | 1,980 | 48 | function [endpos, maxlevel] = match_bracket(str,startpos,brackets)
%
% [endpos, maxlevel] = match_bracket(str,startpos,brackets)
%
% Looking for the position of a closing bracket token in a string
%
% authors:Qianqian Fang (q.fang <at> neu.edu)
%
% input:
% str: the full string to be searched
% startpos: the ... |
18eb59801a904cbdea27e9b08f6a80acb7ceef12483be686378ced31d37c441d | MATLAB | 1,981 | 57 | function S = ea_set_optimizer(options,stim_folder)
% Set optimization parameters for OSS (Should be moved to GUI)
% By Butenko, konstantinmgtu@gmail.com
arguments
options % Lead-DBS options for electrode reconstruction and stimulation
stim_folder % stimulation folder
end
% create NB folders
if exist([stim... |
d9f2b90d566449184fab79816caa2da1672178e5c2b81f54eebad3864a52af19 | MATLAB | 1,981 | 69 | function ClincFreq_Hist(INDIR,INDIRT1,OutHistdir,voxelsize)
files2 = dir([INDIR,'*.nii']);
files = dir([INDIRT1,'*.nii']);
xlsout{1,1} = 'pat';
xlsout{1,2} = 'voxel number';
xlsout{1,3} = 'volume(ml)';
xlsout{1,4} = 'min';
xlsout{1,5} = 'max';
xlsout{1,6} = 'mean';
xlsout{1,7} = 'std';
xlsout{1,8} = 'meadian';
xlsout{1... |
840a1297b9888946ef61e9c423ac4321412ec1ee49ab42e43c1c8819c4b30e27 | MATLAB | 1,982 | 77 | function [cvx_optval,P,q,r,X,lambda] = cheb(A,b,Sigma);
% Computes Chebyshev lower bounds on probability vectors
%
% Calculates a lower bound on the probability that a random vector
% x with mean zero and covariance Sigma satisfies A x <= b
%
% Sigma must be positive definite
%
% output arguments:
% - prob: lower boun... |
9686ab92e2c79a34d29ea7866410063b6b04ad62ca67b6392ee0ec7b41ae86d3 | MATLAB | 1,984 | 38 | % Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions
%
%=========================================================================
%
% Copyright (c) 2008 Thomas Yeo and Mert Sabuncu
% All rights reserved.
%
%Redistribution and use in source and binary forms, with or without
%modification, a... |
1408f37d619435e44703795ec258f9311e79ea352a8a35160a064e7c38f4714a | MATLAB | 1,986 | 95 | % Convert image of different orientations to standard Analyze orientation
%
% Usage: nii = rri_orient(nii);
% Jimmy Shen (jimmy@rotman-baycrest.on.ca), 26-APR-04
%___________________________________________________________________
function [nii, orient, pattern] = rri_orient(nii, varargin)
if nargin > 1
... |
082d910c6c6b1f1f4cf72c1e95a036147f1c3c9308f7e9b6513860862e458292 | MATLAB | 1,989 | 57 | % std_selectdesign() - select an existing STUDY design.
% Use std_makedesign() to add a new STUDY.design.
%
% Usage:
% >> [STUDY] = std_selectdesign(STUDY, ALLEEG, designind);
%
% Inputs:
% STUDY - EEGLAB STUDY structure
% STUDY - EEGLAB ALLEEG structure
% designind - desired (exis... |
59544dde82a82c112fe1402f4492a00e6f9885ef013b1c756ff733bbe5cf8bd8 | MATLAB | 1,989 | 70 | function information = MyvarInformation(self, cel, varargin)
% Computes the information of a cell about the "myvar" parameter
%
% Will return the information score in bits/spike for
% tetrode cel(1), cell cel(2). Can return continuized epochs, or vectorizes
% multiple epochs. Note that if dim
%
% See parameters belo... |
85cf060d45aabad2e3416575ca24192c09e85c58ef9b82f1c7d2e9c9a807023f | MATLAB | 1,989 | 56 | function ild = calcIld(L,R,method)
%CALCILD Calculate normalised interaural level difference
%
% ILD = IOSR.AUDITORY.CALCILD(L,R) calculates the ILD of vectors L and R.
% Rather than a logarithmic ratio, the returned ILD is in the range
% [-1,1]. The algorithm has the following steps:
%
% 1. Calculate total... |
11a3fdcbb3cf922a4c9116357c6f170eec78772bbc867e879d94fc31fd67e5c1 | MATLAB | 1,990 | 80 | function out = pairwiseTwoPropZ(groups, alpha)
% pairwiseTwoPropZ Pairwise two-proportion z-tests across groups
%
% Inputs
% groups : 1xG cell array; each cell is a vector of 0/1 (or logical) for modulation
% alpha : significance level (default 0.05)
%
% Output struct "out"
% .G number of groups
% .... |
55adf496c8872b534bbb5ce32d185f408f53b410b5d65aa6daea388512fe2993 | MATLAB | 1,992 | 49 | function apref = ea_antspreset_legacy_lowvar(cmd)
if ischar(cmd) % 'query' mode, return the name of the preset
apref = 'Legacy: Low Variance';
return
end
normsettings = cmd; % cmd is the 'normsettings' struct
switch normsettings.ants_metric
case 'Mutual Information'
apref.metric='MI';
apre... |
87ac7051780157de4a44155d183859e3653ffa29aad48a5c635dac6ae5047b7c | MATLAB | 1,993 | 56 | function [] = fill_gradient_legend(obj, title_text, legend_values, legend_ticks, gradient_height)
legend_y_step = 1;
legend_y_additional_step = 0.5;
obj.legend_text_handles = [obj.legend_text_handles ...
text(1, obj.legend_y, title_text, ...
'FontWeight', 'bold', ...
'Interpreter', obj.text_options.interp... |
899b32c5c7aff18815c377cccb0825029ac7ce740ccf642e28506c2cdd1e16ed | MATLAB | 1,993 | 51 | function str = fixname(str)
% FIXNAME changes all inappropriate characters in a sting into '_'
% such that it can be used as a filename or as a structure field name. If
% the string begins with a numeric digit, an 'x' is prepended.
%
% Use as
% str = fixname(str)
%
% MATLAB 2014a introduces the matlab.lang.makeValid... |
dd4c053db8f9cfb7d3c91d2e7d2f7de2bc4553a4dc0224c4318d5e18ca9122bb | MATLAB | 1,993 | 55 | function myPLS_plot_screeplot(S,Sp_vect,pvals_LC,save_opts)
% This function plots singular values (observed & surrogates obtained
% with permutation testing), as well as the covariance explained by each
% latent component (LC).
%
% Inputs:
% - S : L x L matrix, L is #LCs, singular values (diagonal matrix)
%... |
0a7e9ecbe859233753abbd340f809770aabbba29b8e179db92a50b7c8f055a08 | MATLAB | 1,994 | 59 | function header = constructNPYheader(dataType, shape, varargin)
if ~isempty(varargin)
fortranOrder = varargin{1}; % must be true/false
littleEndian = varargin{2}; % must be true/false
else
fortranOrder = true;
littleEndian = true;
end
dtypesMatlab = {'uint8','uint16','uint32','uint64','int8','int16','... |
7681ed073c237856b860cfb347895ba582583663b7fc5c0b9fe4121c5def8e86 | MATLAB | 1,994 | 58 | % memmapdata() - create a memory-mapped data class
%
% Usage:
% >> data_class = memmapdata(data);
%
% Inputs:
% data - input data or data file
%
% Outputs:
% data_class - output dataset class
%
% Author: Arnaud Delorme, SCCN, INC, UCSD, Nov. 2008
% Copyright (C) 2008 Arnaud Delorme, SCCN, INC, UCSD
%
... |
f52de0fcd83ea7cb80fb263a28157c8d29c72859601bf7de7533fdd485abfb7c | MATLAB | 1,994 | 50 | ccc;
RAWDATAPATHs = dir("..\MAT Data\pre (granger ext)\single\**\*Active\**\Prediction Data_*.mat");
MATNAMEs = {RAWDATAPATHs.name}';
AREAs = cellfun(@(x) x(strfind(x, '_') + 1:end - 4), MATNAMEs, "UniformOutput", false);
RAWDATAPATHs = arrayfun(@(x) string(fullfile(x.folder, x.name)), RAWDATAPATHs);
SAVEPATHs = array... |
ce6bb35b0ce6e12a3c8accbcf51a1b0116f763db915b5bf7b494e9d614326d4b | MATLAB | 1,995 | 53 | %%
%% Java Information Dynamics Toolkit (JIDT)
%% Copyright (C) 2012, Joseph T. Lizier
%%
%% This program is free software: you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
%% the Free Software Foundation, either version 3 of the License, or
%% (at yo... |
49634d947e19089bc78eafee0501c630f2264a4d13c5041e0da06487bacd8387 | MATLAB | 1,996 | 51 | function corr_LxLy = myPLS_plot_subjScores(Lx,Ly,names_groups,grouping,signif_LC,save_opts)
%
% This function plots the imaging & behavior scores of all significant
% latent components (LCs). Subjects' scores are shown according to their
% diagnostic group. Correlations between imaging & behavior scores is displayed.... |
10964c656c7fc30b91ac8ef5a8f8a1af310674920a3e3f50cb4d85e633925a43 | MATLAB | 1,997 | 59 | function [grpRes indRes] = discover(dat,noClus,noReps,dim)
% [grpRes indRes] = discover(dat,noClus,noReps,dim)
%
% NOTE: This function is a modified version of Danial Lashikari's code
% discover.m, which can be found here:
% http://people.csail.mit.edu/danial/Site/Code.html
%
% Our modification incl... |
4f957ff52c3d50c53523d6a13364ee74149f9efb4b8907c15bf7ac40b81aefec | MATLAB | 1,997 | 61 |
function [Anorm,iters] = graphsalapply( A , frame , sigma_frac, num_iters , algtype , tol )
%
% this function is the heart of GBVS.
% * it takes a feature map, forms a graph over its locations, which is either a lattice of a hierachy ("multiresolution")of lattices,
% connects the nodes with weighted edges, an... |
c413d159a8ee637d2dc4265bc3ae7da9131f19183bd0cdb19c8c15fcd8d08290 | MATLAB | 1,998 | 67 | function PlotRawData(traces, myfile)
% traces = traces(traces(:,8)<3600,:);
fig1 = figure('Position', [0 300 1200 400]);
tiledlayout(2,5);
set(gcf,'renderer','Painters');
nexttile(1,[2 2]);
scatter3(traces(:,1), traces(:,2), traces(:,3),5,traces(:,5), 'filled'); % color options: ClusterIDs, myXYZ(:,5)
... |
cfd6997f5ca51b13693c4122bd8224dee88153daa321093b4ce2c243468a047d | MATLAB | 1,998 | 77 | function handles = inputmap_init(handles)
handles.savename = '';
handles.filename = '';
handles.savepath = '';
handles.framestampname = '';
handles.framestamppath = '';
handles.stampinfoname = '';
handles.stampinfopath = '';
handles.framestampvariable = 'framestamp';
handles.stampinfovariable = 'stampinfo';
handles.fr... |
f97c18b2c5f13a75997944f32e8731edcb2f4b9bc50bd220a07193ff6de7f668 | MATLAB | 1,998 | 43 | function [ autoart ] = artifact_threshold_revglob(cfgT, data_in)
numOfTrl = length(data_in.trialinfo); % get number of trials in the data
artifact = zeros(0, 2); % initialize artifact variable
artfctmap = cell(1, numOfTrl); ... |
36ebf09f724e738a6c673b1c324ee592eefce518d6659ff5f3f3d86ec239718e | MATLAB | 2,000 | 38 | function ClincFreq_Norm2MNI_T2(indat,inroi,outdir,outname,voxelsize,pth)
[patdat,namdat,extdat] = fileparts(indat);
% [patroi,namroi,extroi] = fileparts(inroi);
load([pth,filesep,'Norm2EPI_est.mat']);
pathspm = which('spm.m');
[patspm,namspm,extspm] = fileparts(pathspm);
MATLABBAT_est = matlabbatch;
MATLABBAT_est{1}.s... |
02e26d1bcb1eae87ff93ccdbd54cc469538e63e7d42417bc3ee6d66e98cf8e8e | MATLAB | 2,002 | 38 | % SOFA API - demo script
% Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences
% Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "License")
% You may not use this work except in compliance with t... |
049495a7c5d165a076c6ac38fbac74ccda96ee2ff64f57bef29270d8f3b82447 | MATLAB | 2,002 | 69 | function ip = plot_pass_index_parser( varargin )
import CMBHOME.PASS_INDEX.*;
if any(cellfun(@ischar,varargin))
varargin1 = varargin(1:find(cellfun(@ischar,varargin),1)-1);
varargin = varargin(find(cellfun(@ischar,varargin),1):end);
else
varargin1 = varargin;
varargin = {};
end
all_plots = {'Traje... |
050a7d1bab2702cf76e57b6b94256c62e38139ffca548075ef0df91dbc865125 | MATLAB | 2,002 | 38 | function ClincFreq_Norm2MNI_EPI(indat,inroi,outdir,outname,voxelsize,pth)
[patdat,namdat,extdat] = fileparts(indat);
% [patroi,namroi,extroi] = fileparts(inroi);
load([pth,filesep,'Norm2EPI_est.mat']);
pathspm = which('spm.m');
[patspm,namspm,extspm] = fileparts(pathspm);
MATLABBAT_est = matlabbatch;
MATLABBAT_est{1}.... |
88e2f42f0f491077c77f587836e0198aaa8769718df000e3276c806337b989ee | MATLAB | 2,002 | 48 | %% Figure 3 main
YOURDATAPATH = '';
% Load ROIs and PETHs data
fileList = searchFilesRecursive(YOURDATAPATH, 'allROIs.mat');
load(fullfile(fileList.folder, fileList.name))
fileList = searchFilesRecursive(YOURDATAPATH, 'PETHs.mat');
load(fullfile(fileList.folder, fileList.name))
load('allenDorsalMap.mat');
% Get modul... |
d561f3705210fb7f6b04c7280335bd1b56b3ba55e688460a5f0a67a688fe94f6 | MATLAB | 2,002 | 52 | function [a_array1, b_array1] = generate_connectome_hub(a_array,b_array, lambda, topology, hub_centres, hublength)
%GENERATE_CONNECTOME_EDR Summary of this function goes here
% Detailed explanation goes here
if ~all(size(a_array) == size(b_array))
error('a_array and b_array must be same size');
end
... |
046e1119286580765776a9cf21c2c3fbd74ab84e9e1d84c925eed0a037f59234 | MATLAB | 2,003 | 94 | %% determine STFT parameters
hop = 128;
nfft = 1024;
win = hann(nfft);
%% load signals
load('handel.mat','y','Fs')
xt = y;
load('laughter.mat','y','Fs')
xi = y;
% crop xt
xt = xt(1:length(xi));
%% calculate and plot STFTs
% calculate STFTs
[st,f,t] = iosr.dsp.stft(xt,win,hop,Fs);
si = iosr.dsp.stft(xi,win,hop,Fs)... |
55ca1d31bf07dc5ef589e8096b5b2adbcbed5ec7a31fea6511139ab4d95bcc7d | MATLAB | 2,003 | 46 | function [perm, dz] = incorder(At,Ajc1,ifirst) %#ok
% [perm, dz] = incorder(At [,Ajc1,ifirst])
% INCORDER
% perm sorts the columns of At greedily, by iteratively picking
% the 1st unprocessed column with the least number of nonzero
% subscripts THAT ARE NOT YET COVERED (hence incremental) by
% the previously proc... |
73cc0afe9c5ca8fb202d47fb057426284ef88bdfbbdedbffea58f3a01879d069 | MATLAB | 2,003 | 53 | function timers = cvx_toc
%CVX_TOC Returns the current timing information.
%
% CVX collects the following timing information:
% --- Elapsed time since CVX_TIC was last called. If CVX_TIC was never
% called, this measures the time since CVX was first initialized.
% --- Elapsed time spent between top-level ... |
ad3c262b99b274c5433df8e9c30480e0e803988cf3d3d3e7c68b123f763bf5f6 | MATLAB | 2,003 | 57 | function glmnetPrint( x )
%--------------------------------------------------------------------------
% glmnetPrint.m: print a glmnet object
%--------------------------------------------------------------------------
%
% DESCRIPTION:
% Print a summary of the glmnet path at each step along the path.
%
% USAGE:
% ... |
2379419b598d5271ae106543a799666fd6d335eecfe1fd9682186a973f89637f | MATLAB | 2,004 | 54 | function ranInt = myrandint(outputRow,outputCol,outputRange,varargin)
% MYRANDINT(M,N,RANGE) is an M-by-N matrix with random integer entries
% drawn with replacement from elements of vector RANGE. The elements in
% vector RANGE do not need to be contiguous or unique. (Actually, they do
% not even need to be inte... |
7cb7dde5db0d8426f66e6634f947776b4466ec7006ee106e3b223c040b5cb50b | MATLAB | 2,004 | 71 | function hdr = mayo2nifti1(ohdr,mat)
% Convert from an ANALYZE to a NIFTI-1 header
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%
% $Id: mayo2nifti1.m 5070 2012-11-19 16:00:40Z john $
if isfield(ohdr,'magic'),
hdr = ohdr;
... |
19a76f2bee58bb2a27b040c3a2933c0a8e513931a517d6eb131b6f05559272a7 | MATLAB | 2,005 | 72 | function [t,u,v,idx]=raytrace(p0,v0,node,face)
%
% [t,u,v,idx]=raytrace(p0,v0,node,face)
%
% perform a Havel-styled ray tracing for a triangular surface
%
% author: Qianqian Fang, <q.fang at neu.edu>
%
% input:
% p0: starting point coordinate of the ray
% v0: directional vector of the ray
% node: a list of node c... |
4afda173f19d5666301f0f68d86aa7b827022435d6068644c3eedc77998ba8df | MATLAB | 2,005 | 82 | function [n, ts, sv] = plx_event_ts(filename, ch)
% plx_event_ts(filename, channel) Read event timestamps from a .plx file
%
% [n, ts, sv] = plx_event_ts(filename, channel)
%
% INPUT:
% filename - if empty string, will use File Open dialog
% channel - 1-based external channel number
% strobed channel ha... |
ff13d7740d766951cfcb4324ced35e9a80f5f929f6c3064c1861a7dd994e24cd | MATLAB | 2,005 | 48 | function y = fwblkslv(L,b) %#ok
% y = fwblkslv(L, b)
%
% FWBLKSLV Solves block sparse upper-triangular system.
% y = fwblkslv(L,b) yields the same result as
% y = L.L\b(L.perm,:)
% However, FWBLKSLV is faster than the built-in operator "\",
% because it uses dense linear algebra and loop-unrolling... |
3f73dbf4323330a0fd4515a7b877a3facf23d10f9e185e7d22648fab5d7c80f1 | MATLAB | 2,006 | 50 | function [species_names,counts_data,intervene_matrix] = concatData(species_names1,counts_data1,intervene_matrix1,species_names2,counts_data2,intervene_matrix2)
% This file is a part of the MDSINE program.
%
% MDSINE: Microbial Dynamical Systems INference Engine
% Infers dynamical systems models from microbiome time-s... |
4b9213d61ecfbdc051925df2e0b9e5cc28d724d419f9bb175a81dbad1736aebc | MATLAB | 2,006 | 49 | function y = sparbwslv(L,b)
% y = sparbwslv(L,b)
%
% SPARBWSLV Solves block sparse upper-triangular system.
% y = sparbwslv(L,b) yields the same result as
% y(L.perm,:) = L.L'\b
% However, SPARBWSLV is faster than the built-in operator "\",
% because it uses dense linear algebra and loop-unrolling... |
2179ac7a52228f7db4ca17a839f62018825387d05a2ace5ccce7c9a7fe81c955 | MATLAB | 2,007 | 63 | % numdim() - estimate a lower bound on the (minimum) number of discrete sources
% in the data via their second-order statistics.
% Usage:
% >> num = numdim( data );
%
% Inputs:
% data - 2-D data (nchannel x npoints)
%
% Outputs:
% num - number of sources (estimated from second order measures)
%
%... |
27f86c4aa5e86cd0e8f635985858587ab7418a197f4bb6294da6ca211a854bb9 | MATLAB | 2,007 | 57 | %
% KDTREEIDX Find closest points using a k-D tree.
%
% IDX = KDTREEIDX( REFERENCE, MODEL ) finds the closest points in
% REFERENCE for each point in MODEL. The search is performed in an
% efficient manner by building a k-D tree from the datapoints in
% REFERENCE, and querying the tree for each datapoint in
% MOD... |
34a1d3b0f7f6b73ec3deb78db2280be9b0bc8b49116d59bb21ae2ec8868bb664 | MATLAB | 2,007 | 80 | function o = mayostruc
% Create a data structure describing Analyze headers
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%
% $Id: mayostruc.m 1143 2008-02-07 19:33:33Z spm $
persistent org;
if ~isempty(org),
o = org;
ret... |
cb2eec2465183267439e059d5a20a1643afb3a88c09487d633f2eecaa375f728 | MATLAB | 2,007 | 69 | function [pl2] = PL2GetFileIndex(filename)
% PL2GetFileIndex(filename): gets pl2 file index. File indexes are cached.
% If cached file index for the specified filename exists, returns cached file index,
% otherwise, calls PL2ReadFileIndex(filename)
%
% [pl2] = PL2GetFileIndex(filename)
%
% INPUT:
... |
435ea26a5e64ed7dbd4e270e37229c7ad6f948483d0b3a26e31395260b3374e1 | MATLAB | 2,008 | 65 | function z = sparse( i, j, x, m, n )
% Disciplined convex/geometric programming information for SPARSE:
% For a CVX variable X, SPARSE(X) just returns X. In the three-
% and five-argument versions SPARSE(I,J,V,M,N), the index
% arguments I and J and size arguments M and N must be constant.
% ... |
f2cf87bb103ca6c9a398c35aca85e73998b2c6efb2199d73c43d86a47917cd99 | MATLAB | 2,008 | 58 | function [ha, pos] = tight_subplot(Nh, Nw, gap, marg_h, marg_w)
% tight_subplot creates "subplot" axes with adjustable gaps and margins
%
% [ha, pos] = tight_subplot(Nh, Nw, gap, marg_h, marg_w)
%
% in: Nh number of axes in hight (vertical direction)
% Nw number of axes in width (horizontaldirection... |
fbf5461f52c5ed8e11e2200c9b5aa9b3f69c2fb3d9604e4b4108a01f4deb7dce | MATLAB | 2,008 | 69 | function y = vnorm(A,varargin)
% VNORM - Return the vector norm along specified dimension of A
%
% VNORM(A) returns the 2-norm along the first non-singleton
% dimension of A
% VNORM(A,dim) return the 2-norm along the dimension 'dim'
% VNORM(A,dim,normtype) returns the norm specified by normtype
% along the di... |
1f4888fb3b243e8b49449d61ea16e998cb0b2d1859fac9360aec635e3e08cb39 | MATLAB | 2,010 | 70 | function savefast(filename, varargin)
% savefast: fast saves of large arrays to .mat files
%
% Matlab's 'save' command can be very slow when saving large arrays,
% because by default Matlab attempts to use compression. This function
% provides a much faster alternative, at the cost of larger files.
%
% The synta... |
2e60d0f063b7c39b059534674852149bff08aef075637e9798ebe677551bff5e | MATLAB | 2,010 | 60 | function varargout = subsref(this,subs)
% Subscript referencing for GIfTI objects
%__________________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
% Guillaume Flandin
% $Id: subsref.m 6345 2015-02-20 12:25:50Z guillaume $
if length(this) > 1 && ~s... |
e5a07bbb5590da2b8fc802c733f52f64b20fcad3e7e8eb71ed95d727adb55e21 | MATLAB | 2,010 | 54 | function ea_save_sweetspot_model(obj, ExternalModelFile)
% this function is called from the GUI
% we want to define the model outside of cross-validation
if ~exist('patsel','var') % patsel can be supplied directly (in this case, obj.patientselection is ignored), e.g. for cross-validations.
patient... |
14c8d9195851a691734192301926c2146e3f0161bd1b61e3c88a4af23df7448d | MATLAB | 2,011 | 46 | function [L,perm,xsuper,split,tmpsiz] = symfctmex(adjncy, perm, cachsz) %#ok
% [L,perm,xsuper,split,tmpsiz] = symfctmex(X, perm, cachsz)
%
% Computes sparse symbolic factor L, updated permutation PERM,
% super-node partition XSUPER, and a splitting of supernodes
% (SPLIT) to optimize use of the computer cache (as... |
af8d3e9d42c3776ac929a6f3436654432a7cb053119dfb3cf1639e0fe581512a | MATLAB | 2,011 | 41 | classdef CBIG_IndCBM_unit_test < matlab.unittest.TestCase
% Written by XUE Aihuiping and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
methods (Test)
function test_example(testCase)
% create output folder
CBIG_CODE_DIR = getenv('CBIG_CODE_DIR');... |
1c06dbcc93c34e0f549255f784ad1d66d0ecc9d0330e3a4a65e586e8d097fab3 | MATLAB | 2,013 | 59 | function unit = ft_estimate_units(size)
% FT_ESTIMATE_UNITS tries to determine the units of a geometrical object by
% looking at its size and by relating this to the approximate size of the
% human head according to the following table:
% from 0.050 to 0.500 -> meter
% from 0.500 to 5.000 -> decimeter
% fr... |
2178e6fc4d9ed651e5df224ebe64d7f688655a9779b639368dd195186ee6f61a | MATLAB | 2,013 | 66 | function varargout = palm_boxcox(varargin)
% Find the lambda parameter and compute the Box-Cox transformation.
%
% Usage:
% [Y,L] = palm_boxcox(X)
% Y = palm_boxcox(X,L)
%
% X : Input data. All values need to be positive.
% Y : Transformed data.
% L : Lambda parameter.
%
% Reference:
% Box GEP and Cox DR. An Analy... |
626a632552318d0cd52080f4aeb1eb09910e511285647705c3f72f164177b409 | MATLAB | 2,013 | 43 | fprintf(1,'Executing %s at %s:\n',mfilename(),datestr(now));
ver,
try,
if isempty(which('spm')),
throw(MException('SPMCheck:NotFound', 'SPM not in matlab path'));
end
[name, version] = spm('ver');
fprintf('SPM version: %s Release: %s\n',name, version);
fprintf('SPM p... |
2e7468d6284bba0a9cd283ad48b5305c7f2d756f1d5e0d7bbce2b7f0f4504d0c | MATLAB | 2,015 | 86 | function [n, ts_left, ts_right] = nex_int(filename, varname)
% nex_int(filename, varname): Read interval variable from a .nex file
%
% [n, ts_left, ts_right] = nex_int(filename, varname)
%
% INPUT:
% filename - if empty string, will use File Open dialog
% varname - variable name
% OUTPUT:
% n - number of interval... |
aced9f28548771133353affe698d746c3a74e1e4e35cc16662b53d1b5ebc3400 | MATLAB | 2,015 | 55 | %%
%% Java Information Dynamics Toolkit (JIDT)
%% Copyright (C) 2012, Joseph T. Lizier
%%
%% This program is free software: you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by
%% the Free Software Foundation, either version 3 of the License, or
%% (at yo... |
fce52030ff24c2a325021e721a452152073880c2a76a54148be4f677d9694d3e | MATLAB | 2,015 | 77 | function [pval v] = circ_vtest(alpha, dir, w, d)
%
% [pval, v] = circ_vtest(alpha, dir, w, d)
% Computes V test for non-uniformity of circular data with a specified
% mean direction dir.
% H0: the population is uniformly distributed around the circle
% HA: the population is not distributed uniformly around the... |
05110f6736b6186316e82b03503df98d03d2565522bc91347920ecad3eab4276 | MATLAB | 2,016 | 52 |
% Load a dataset of 21 subjects
% Several fmri_data objects are included. Two of interest are datasets for
% Nback vs. Rest contrast and 3-back vs. 2-back contrast. Each dataset
% contains one contrast image per person (N = 21 images).
load('/Users/torwager/Google Drive/SHARED_DATASETS_gdrive/A_Multi_lab_world_map/2... |
55c628c76b48ce0e6a623fe4274592cd1988fe99ed28598fe0d29d38910e739c | MATLAB | 2,016 | 46 | function cifti = cifti_struct_dense_replace_surface_data(cifti, data, structure, dimension)
%function cifti = cifti_struct_dense_replace_surface_data(cifti, newdata, structure, dimension)
% Replace the data for one cifti surface structure, taking a full-surface array as input.
%
% The dimension argu... |
663661785ca709ad395ecde5fc854157f4349488e62e6b82f4d7537581f69ba0 | MATLAB | 2,016 | 52 | function p = npcdf(X,x)
%npcdf - Non-parametric cumulative distribution function.
%
% Given a list of samples drawn from an unknown (non-parametric) distribution,
% the corresponding cumulative distribution function is evaluated at a set of
% given points.
%
% USAGE
%
% p = npcdf(X,x)
%
% X list of... |
785ba42270363846de9705989de2f3ce90c5652270be9d2807c12f2a03fcda7c | MATLAB | 2,016 | 57 | % Figure 8.11: Approximate linear discrimination via support vector classifier
% Section 8.6.1, Boyd & Vandenberghe "Convex Optimization"
% Original by Lieven Vandenberghe
% Adapted for CVX by Joelle Skaf - 10/16/05
% (a figure is generated)
%
% The goal is to find a function f(x) = a'*x - b that classifies the non-
% ... |
be01350e87928beb11c767ae59880fb173272f9e43e5589e11fb452d9b4dc95d | MATLAB | 2,016 | 57 | function computeSemanticMaps(params)
% computeSemanticMaps(params)
%
% ----------------------------------------------------------------------
% Matlab tools for "Predicting human gaze beyond pixels," Journal of Vision, 2014
% Juan Xu, Ming Jiang, Shuo Wang, Mohan Kankanhalli, Qi Zhao
%
% Copyright (c) 2014 NUS V... |
8efad251b64221d4699100438a4820d2fdb1aea080e5407986041f29225fc674 | MATLAB | 2,017 | 66 | function [ha, pos] = tight_subplot(Nh, Nw, gap, marg_h, marg_w)
% tight_subplot creates "subplot" axes with adjustable gaps and margins
%
% [ha, pos] = tight_subplot(Nh, Nw, gap, marg_h, marg_w)
%
% in: Nh number of axes in hight (vertical direction)
% Nw number of axes in width (horizontaldirectio... |
ecf5d87e88f21fa7bfcbe451c78486381b77515bcbc1acd3f57613e437e7bfb5 | MATLAB | 2,017 | 60 | function varargout = subsref(this,subs)
% Subscript referencing for GIfTI objects
%__________________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
% Guillaume Flandin
% $Id: subsref.m 7577 2019-04-24 08:59:56Z guillaume $
if length(this) > 1 && ~s... |
4a8e717754a5c5b1b3cbd2b75afe196372b472eed371e9f273aa077d7eee24a7 | MATLAB | 2,018 | 70 | function theStruct = parseXML(filename)
% PARSEXML Convert XML file to a MATLAB structure.
try
tree = xmlread(filename);
catch
error('Failed to read XML file %s.',filename);
end
% Recurse over child nodes. This could run into problems
% with very deeply nested trees.
try
theStruct = parseChildNodes(tree);
ca... |
77fa515a8e6bf06693fc13cc8c6032f62cbb35970d7614f17bc4a584394f6348 | MATLAB | 2,018 | 44 | % Read time data and reorganize them
% Reorganize the data to fit the catplot function
folder = ("C:\Users\yh19218\OneDrive - University of Essex\OneDrive - University of Essex\PG Research\0A_Journal\202004_unknown Journal_Probability Score\1_Results\0_Final Results\TimeDT\");
classes = ['OvsC';'HvsW';'OvsH';'OvsW... |
d11468efcfe5d5d96bc53c278721b588f6349d40acfcaf7ca064c9932d32a420 | MATLAB | 2,018 | 77 | function ea_apply_normalization_tofile(options,from,to,useinverse,interp,ref)
% this function applies lead-dbs normalizations to nifti files.
% currently just used to generate patient specific atlases,i.e., from MNI
% space to native space
if ischar(from)
from = {from};
end
if ischar(to)
to = {to};
end
if ~e... |
45fe24e0cb1c7540c3f95941bd6208560e8432a61e4ec5bf670ff47c52e7af81 | MATLAB | 2,020 | 49 | % written by Yiyuan Han, Essex BCI-NE Lab, 23/OCT/2019
% EEGfilter: the filter for filterring EEG signals with Butterworth filter
% - data: input EEG signals in time x channel
% - band: the filterring band, if the filter Type is 'LP'/'HP', it only
% accepts one parameter to be passed in, or it should be an array wi... |
52d84e0b5efca57c6d75e0f73ab4c18679e154fe8505e7be1e61d9d62c9bd959 | MATLAB | 2,020 | 70 | function theStruct = parseXML5D(filename)
% PARSEXML Convert XML file to a MATLAB structure.
try
tree = xmlread(filename);
catch
error('Failed to read XML file %s.',filename);
end
% Recurse over child nodes. This could run into problems
% with very deeply nested trees.
try
theStruct = parseChildNodes(tree);
... |
e3367ca70138fb76b73c1de9b309e137c2201ae0a718fdd2cbf26fc109d9423d | MATLAB | 2,021 | 39 | % Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions
%
%=========================================================================
%
% Copyright (c) 2008 Thomas Yeo and Mert Sabuncu
% All rights reserved.
%
%Redistribution and use in source and binary forms, with or without
%modification, a... |
1c30b9c6a38317454c7b333c2371fcf7915b68d83d2981949f0c340f71c4b14e | MATLAB | 2,022 | 73 | %% Example 2 of Running Collocation Topic Model (LDACOL)
%%
% How to save multiple samples from the same or different chains in the
% LDACOL model
%%
% Load a dataset
dataset = 1; % 1 = psych review; 2 = nips
if (dataset == 1)
fprintf( 'Loading Psych Review Abstracts - Collocation Data\n' );
load... |
7dbe5b0c77562402298a26bbb0317d81171033e06ed077750596fdec731751b5 | MATLAB | 2,022 | 66 | function h = imagesc(varargin)
%IMAGESC Display image with scaled colors
% IMAGESC(...) is the same as IMAGE(...) except the data is scaled
% to use the full colormap.
%
% IMAGESC(...,CLIM) where CLIM = [CLOW CHIGH] can specify the
% scaling.
%
% See also IMSHOW, IMAGE, COLORBAR, IMREAD, IMWRITE.
% Copyrig... |
9436d591abd09b2ef98cbe401340045434b4f94fc47cb018b0fadd4d6bd65ef2 | MATLAB | 2,023 | 78 | %% Example 1 of Running Collocation Topic Model (LDACOL)
%%
% Load a dataset
dataset = 1; % 1 = psych review; 2 = nips
if (dataset == 1)
fprintf( 'Loading Psych Review Abstracts - Collocation Data\n' );
load 'psychreviewcollocation'; % load in variables: WW WO DS WS SI
filenm = 'topics_psychrevie... |
60d7153896cfd9e41537eb878379a7a94416a995ae53ce636b9bb4dfd27749cf | MATLAB | 2,024 | 68 | function stats = CBIG_fitLME_3t(subInfoFile, GMICVFile, q)
% stats = CBIG_fitLME_3t(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+3;
COR_COL = 1+1;
fprintf('\n\n\n');
... |
aa4cb832e3f9846c85ff115c87c9602c91a6e383bcb5fb56bbad0304924644fa | MATLAB | 2,024 | 71 | classdef Flex < handle
%uix.mixin.Flex Flex mixin
%
% uix.mixin.Flex is a mixin class used by flex containers to provide
% various properties and helper methods.
% Copyright 2016 The MathWorks, Inc.
% $Revision: 1435 $ $Date: 2016-11-17 17:50:34 +0000 (Thu, 17 Nov 2016) $
prop... |
397ab6083f0b418a21d364db46b44f8376d2b45910bd6b98ae9e62cf84df4be9 | MATLAB | 2,025 | 81 | function varargout=loadbnm(fname)
% a compact binary matrix format.
%
% [M1,M2,M3,...]=loadbnm(fname);
%
% see savebnm
%
% Aslak Grinsted April 2004
% -------------------------------------------------------------------------
% Copyright (C) 2002-2004, Aslak Grinsted
% This software may be used, copied... |
5c7be3650c9c7e9a9a24a559619c07846a2d72c207cecbea69311a55960dfcdf | MATLAB | 2,025 | 67 | function [xr2,yr]=calcRadius2b(proj,parms2fit,xg0,penalty)
% Usage ... xr=calcRadius2b(proj,parms2fit,xg0,penalty)
%
% This function is intended for use with cylprojy2, both of which
% have additional parameters to account for fluorescence data and/or
% high-cross sectioning objectives (i.e. 16x or higher).
% To use f... |
ee213075a7ad193e65bb1559c41c632b0110a32823c6b9df5c2e107fdb464818 | MATLAB | 2,026 | 69 | % abspeak() - find peak amps/latencies in each row of a single-epoch data matrix
%
% Usage:
% >> [amps,frames,signs] = abspeak(data);
% >> [amps,frames,signs] = abspeak(data,frames);
%
% Inputs:
% data - single-epoch data matrix
% frames - frames per epoch in data {default|0 -> whole data}
%
% Outp... |
fa936635d0d0622276466866b040450e05c70b342c9e4ffa23f392edd63bcd27 | MATLAB | 2,026 | 57 | function ea_discfibers_roi_collect(obj)
% subroutine to load in rois and create an N-image for Lead-DBS
% fiberfiltering projects.
if isempty(obj.roidata)
if isfield(obj.M,'pseudoM')
vatlist = obj.M.ROI.list;
else
vatlist = ea_discfibers_getvats(obj);
end
tdir=ea_getleadtempdir;
f... |
c6f5c01b3cbcb8820b77de2d4d96a69fc974e937a2260fb10f1805aecbe5ea3e | MATLAB | 2,027 | 75 | %*********************************************************
%% svec: compute the vector svec(M),
%%
%% x = svec(blk,M,isspx);
%%
%% SDPT3: version 3.1
%% Copyright (c) 1997 by
%% K.C. Toh, M.J. Todd, R.H. Tutuncu
%% Last Modified: 16 Sep 2004
%%**********************************************************
function x = s... |
a18f6a409f996b3579ef196d283de5bbf89accc5192004c0185fec820cc87598 | MATLAB | 2,028 | 80 | function y = nanvar(x,dim,flag)
% FORMAT: Y = NANVAR(X,DIM,FLAG)
%
% Variance ignoring NaNs
%
% This function enhances the functionality of NANVAR as distributed in
% the MATLAB Statistics Toolbox and is meant as a replacement (hence the
% identical name).
%
% NANVAR(X,DIM) calculates the standard dev... |
bb695f60e8936eddeedef1494f5fee157536f12c40fc82365967c8e1e2c4e4b5 | MATLAB | 2,029 | 46 | % SeDuMi 1.1 (May 2005)
% Toolbox for optimization over self-dual homogeneous cones.
%
% This file is part of SeDuMi 1.1 by Imre Polik and Oleksandr Romanko
% Copyright (C) 2005 McMaster University, Hamilton, CANADA (since 1.1)
%
% Copyright (C) 2001 Jos F. Sturm (up to 1.05R5)
% Dept. Econometrics & O.R., Tilburg... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.