sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
86cfa6c476637260c2de7351bb46d4f653c6341b9e5102a503804e0d437f6aaf | MATLAB | 822 | 27 | function [ P_transition ] = P_sec( sec_Pk_edos )
%Calcula la probabilidad de ir de un estado a otro dada una secuencia
%especifica. Genera una matriz [edosXedos] con las probabilidades de ir de
%un estado a otro incluyendo los estados recurrentes
p_edos=max(sec_Pk_edos);
trans=size(sec_Pk_edos,2);
trans_edos=zeros(p_e... |
298a793feafafe63d5a49ab92e6cef9c393fb6990dc7c008a577a83cae6772e4 | MATLAB | 823 | 27 | function SubjNameComp
T1ImgDir = uigetdir([],'Plese select one folder') ;
FunImgDir = uigetdir([],'Plese select another folder') ;
[DataDirT1 T1Img cc] = fileparts(T1ImgDir) ;
[DataDirFun FunImg cc] = fileparts(FunImgDir) ;
t1list = dir([DataDirT1,filesep,T1Img]) ;
funlist = dir([DataDirFun,filesep... |
b55ba39b96a2fc27bac0e3ef3dd6d4cedcb4e0a855e86d932709f88f52b321f0 | MATLAB | 823 | 23 | function res = hlp_split(str,delims)
% Split a string according to some delimiter(s).
% Result = hlp_split(String,Delimiters)
%
% In:
% String : a string (char vector)
%
% Delimiters : a vector of delimiter characters (includes no special support for escape sequences)
%
% Out:
% Result : a cell array of (non-empt... |
0c214bb16d3dca7b8d88aae8d848a8f7e9c4d566decd72325929c98f0fe02d6a | MATLAB | 824 | 28 | function vol=map2vol(map)
%
% converts a map (e.g. statistical t-map) to a true-color volume.
% This function can be helpful for displaying a map using the other
% function called showVol.m
%__________________________________________________________________________
% Copyright (C) 2009 Medical Research Council
import... |
b594b0457b12121c7ada576463d2c7618d55801429e2c815339ab20b3e09185d | MATLAB | 824 | 38 | function Test_linearFunction
% Define a linear space
m = 5;
n = 2;
manifold = euclideanfactory(m,n);
% random symmetric square matrix
A = randn(m,n);
% Create the problem structure.
problem.M = manifold;
% Define the problem cost function, Euclidean gradient and Hessian.
problem.cost = @cost;
function f = cost(X)
... |
f3273aaab117943bcc63333d258cf18507023598ab0276c66bc89d38c952b165 | MATLAB | 824 | 24 | function tmpfname = prepare_read_avw_img_slice(fname)
% tmpfname = PREPARE_READ_AVW_IMG_SLICE(fname)
%
% This simply takes a .nii or .*.gz file and converts it
% into a .hdr .img pair, returning the basename of the pair.
% It is intended to be used together with read_avw_img_slice
% routine to avoid doing the conve... |
f93ee9a521ab6c49f3ac6739f6c68c0efd92f93919ee7816941ddce3459e2f5f | MATLAB | 824 | 32 | function [ store, abort ] = checkEscape(store)
%CHECKESCAPE checks if the escape key was pressed and abirts the game in
%that case
%
% Outputs:
% store: main datafile
% abort: 1 if escape was pressed
%
% About:
% Coded by F.Petzschner 19. April 2017
% Last change: F.Petzschner 19. April 2017
keyCode = detectkey... |
01d265e97e59bc583a31aef78c802d7e829cf30c013ce0cacb317f448fbf574a | MATLAB | 825 | 19 | function snrMat = calculateSNR(nirs, roiChans, windowInfo, snrMat, nsub, params)
% Calculates signal-to-noise ratio (SNR) for all ROI channels (both HbO
% and HbR) for the current subject, excluding windows with detected motion
% artifacts.
for iChan = 1:length(roiChans)
% Calculate SNR for HbO channels... |
5105d1bd1b20a7d241ae645feac1130b4940286dfcc12d1b83362cef0c2cd83a | MATLAB | 825 | 18 | function wmmask = mkWMmask(funimg, t1img, WMSegThr, WriteOut)
% funimg=[path2,filesep,list1(i).name,filesep,imglist2(1).name]
% t1path=[path1,filesep,list1(i).name]
[t1path, name, ext, versn] = fileparts(t1img) ;
wmmask1= TMSreslice(funimg,t1img,[],0) ; % no out img was written, so the output dir is meaningless
wmmas... |
d0dc90e13bf4f41d989c1c5c8d7875105ac26ab2304b1be4f24fc8396f6e574c | MATLAB | 825 | 39 | function nmri_write_mgh( fname, vox2ras ,metrics )
%nmri_write_mgh( fname, vox2ras ,metrics )
% saves metrics as MGH for Freesurfer / PALM
if iscell(metrics)
% make to double
sz=size(metrics{1});
if length(sz)>1 && sz(1)<sz(2)
% transpose to have 1st dim max
metrics=cellfun(@transpose,metrics,'un',0);
sz=si... |
df10fdce282a848fbc0e801bdd92f911e140318c2135bbe5958a9e8cec56891c | MATLAB | 825 | 40 | function stackedbar(v,colors,labels)
% stackedbar(v,colors,labels)
% plots a stacked bar plot in order of magnitude, so that you can see all
% values for all variables
figure('Color','w'); set(gca,'FontSize',18); hold on;
if isempty(colors), colors = {'b' 'g' 'r' 'y' 'c' 'm'};, end
v(isnan(v)) = 0;
for k = 1:size(v,... |
09bfcdc12145888989d83942ba5ca3de322c50057f12cbd617bd6dcd3e6385c6 | MATLAB | 826 | 41 | function A = compute_edge_face_ring(face)
% compute_edge_face_ring - compute faces adjacent to each edge
%
% e2f = compute_edge_face_ring(face);
%
% e2f(i,j) and e2f(j,i) are the number of the two faces adjacent to
% edge (i,j).
%
% Copyright (c) 2007 Gabriel Peyre
[tmp,face] = check_face_vertex([],face);
n... |
16a92a919b4899c317bdecf18ec2246e51b3b66f0c10375206a44d425b1a50c8 | MATLAB | 827 | 29 | classdef nnbnorm < nntest
properties (TestParameter)
rows = {2 8 13}
cols = {2 8 17}
numDims = {1 3 4}
batchSize = {2 7}
end
methods (Test)
function basic(test, rows, cols, numDims, batchSize)
r = rows ;
c = cols ;
nd = numDims ;
bs = batchSize ;
x = test.randn(r,... |
25c9d8ba8d51ec28015dba46b7cc0fc0d62021f5ed0da6001eab2b4c029851ea | MATLAB | 827 | 31 | %{
preprocess.Spikes (computed) # infer spikes from calcium traces
-> preprocess.ComputeTraces
-> preprocess.SpikeMethod
---
%}
classdef Spikes < dj.Relvar & dj.AutoPopulate
properties
% NMF spikes (method 5) can be copied via MATLAB, STM spike detection is performed in Python
popRel = prepro... |
67c96f7a1883180ec695d5d3f9633155ae652ccbe84e4cb04b431b0c955fab8c | MATLAB | 827 | 32 | function [ mi ] = DiscreteMI(X, Y)
%%DISCRETEMI Mutual information between discrete variables
% I = DISCRETEMI(X, Y) calculates the mutual information between vectors X
% and Y taking each distinct value as a different discrete symbol.
%
% Pedro Mediano and Fernando Rosas, Aug 2020
%% Parameter checks
if ~(ism... |
6a96e5e2ef6183f426a97781bcde434dec14185cf86bf938816b73a86e95fddf | MATLAB | 827 | 28 | function param=parseParameters(default,varargin)
% param=parseParameters(default, name, value, name, value,...)
% set parameters with given option
% This function is intend to be called from other functions to set parameters
%
% default: structure with default values
% name: field of default (case insensitive)
% value:... |
f30b9664960509cda917d8c5aac16d0c56808f5d2a24b6b46687ca98db389d26 | MATLAB | 827 | 20 | function [pvec, pstruct] = tapas_ph_binary_transp(r, ptrans)
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2015 Christoph Mathys, TNU, UZH & ETHZ
%
% This file is part of the HGF toolbox, which is released under the terms of the GNU General Public
%... |
7b1ac240c2ff615b1b0fa94eb31a2de9314c91b0af9bba646246ac1437d6ad3d | MATLAB | 828 | 38 | % function h=text2(Xpos,Ypos,String,Axis,varargin)
% wrapper of text to specify text as in relative position
%
% Hiro Miyawaki at UWM, 2011-
%
function h=text2(Xpos,Ypos,String,Axis,varargin)
if nargin<4
Axis=axis();
end
% just for backward compatibility
if length(varargin)==1 && iscell(va... |
abb18860ea982f6913af5f086477ce26bc42e9dc2a51f4b7ad9c79c5ffcc228c | MATLAB | 828 | 33 | function filters = load_filters(filename)
% LOAD_FILTERS - Load visual filter matrix
%
% H1 Line: Load filter matrix from MAT file
%
% Syntax:
% filters = load_filters(filename)
%
% Description:
% Loads the visual filter matrix used for input generation.
% Handles missing files gracefully.
%
% Inputs:
% filenam... |
cd1b8b920a5a328ff7e6792c66c9e2a424c862a7bda31b7baecace63ced8b35a | MATLAB | 828 | 36 | %% get_set_bfr_lbv(h,mode,input)
%
% Input
% --------------
% h : structure contains all handles of SEPIA
% mode : 'set' - extract information from GUI to config file
% 'get' - extract information from config file to GUI
% input : if mode is 'set' then input should be fid
% ... |
ef989f8b4f8e7f2d8ba822facc8d2dc989ce7bf89f40717f230d462a69ad4bd8 | MATLAB | 828 | 34 | function interval = FindInterval(logical)
% Copyright (C) 2016 by Ralitsa Todorova, Michaël Zugaro
%
% 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... |
f9ed5015276b2564ec273c18afbdd2dc6e0add9f638f6071c5a33e7e4a4d90b0 | MATLAB | 829 | 38 | function Brockett_Wen_bfgs_test()
n = 500;
p = 4;
B = randn(n, n); B = B + B';
D = sparse(diag(p : -1 : 1));
M = stiefelfactory(n, p);
problem.M = M;
problem.cost = @cost;
problem.egrad = @egrad;
% Cost function
function f = cost(X)
f = trace(X'*(B*X*D));... |
0af2df544569007118558cb6b51fa8191d1b1c1a0cae71470669f49ed426dde1 | MATLAB | 830 | 20 | function [pvec, pstruct] = tapas_rs_whatworld_transp(r, ptrans)
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2012-2013 Christoph Mathys, TNU, UZH & ETHZ
%
% This file is part of the HGF toolbox, which is released under the terms of the GNU General ... |
503d2fefdb96e7ec04dd328ea0076d121e455a7534a13fcca43c0701ab7ededc | MATLAB | 830 | 24 | function [lp,dlp] = priorLaplace(mu,s2,x)
% Univariate Laplacian hyperparameter prior distribution.
% Compute log-likelihood and its derivative or draw a random sample.
% The prior distribution is parameterized as:
%
% p(x) = exp(-abs(x-mu)/b)/(2*b), where b = sqrt(s2/2),
%
% mu(1x1) is the mean parameter, s... |
53f88c46b1196343908e6cfbeb39908978a483371089a1076ef98cdf67ae5d16 | MATLAB | 830 | 21 | function [pvec, pstruct] = tapas_hmm_transp(r, ptrans)
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2013 Christoph Mathys, TNU, UZH & ETHZ
%
% This file is part of the HGF toolbox, which is released under the terms of the GNU General Public
% Licen... |
5928e9ce8e310d999ae1d231d7b21ac7e69b5295a052a9e840c316e46c1d84e2 | MATLAB | 830 | 22 | function Y_alpha = sd_slice_to_alpha(Y, layer)
% SD_SLICE_TO_ALPHA Converts 2D slice data to 2D opacity coding
%
% DESCRIPTION
% Converts 2D slice data to 2D opacity coding, based on value range
% specified in layer struct.
%
% SYNTAX
% Y_alpha = SD_SLICE_TO_ALPHA(Y, layer)
%
% Y - NxM double, containing... |
08985985a2c46a79dcbbc22340b5092726f62abcc19602d6e48217034d30a190 | MATLAB | 831 | 27 | function cnn_imagenet_googlenet()
%CNN_IMAGENET_GOOGLENET Demonstrates how to use GoogLeNet
run matlab/vl_setupnn
modelPath = 'data/models/imagenet-googlenet-dag.mat' ;
if ~exist(modelPath)
mkdir(fileparts(modelPath)) ;
urlwrite(...
'http://www.vlfeat.org/matconvnet/models/imagenet-googlenet-dag.mat', ...
... |
8e5d8c016a157e4bd0ae3a27bbeb4a9d89f5b93378124bde0bc29a533e40c86f | MATLAB | 831 | 29 | function resamp = eeg_autocorr(EEG, pct_data)
if ~exist('pct_data', 'var') || isempty(pct_data)
pct_data = 100;
end
ncomp = size(EEG.icaact, 1);
nfft = 2^nextpow2(2*EEG.pnts-1);
% calc autocorrelation
c = zeros(ncomp, nfft);
for it = 1:ncomp
X = mean(abs(fft(EEG.icaact(it, :), nfft, 2)).^2, 3); % Code not us... |
0d1d39b4e9a34859961e3c96b74c759a035ba295301efb6e41ba36287cccb20a | MATLAB | 832 | 29 | function [MRSCont] = osp_remove_noise_scan(MRSCont)
%% MRSCont = osp_remove_noise_scan(MRSCont)
% This function removes the noise reference from the raw data which is
% added to the raw data acquired with the CMRR sequence (if the flag is
% set to include a water and noise reference). The function should be
% c... |
1765cb0d4983e0993496d75f4c02eab1091d4a597a8b4e005edf33f1edac09ba | MATLAB | 832 | 21 | function runPalm_shirleyPC(conName,nPerm, maskName, output_dir)
% conName: name of contrast to run
root = 'C:\Users\User\Documents\fMRI_EXP\';
spm_path = "C:\Users\User\Documents\spm12";
addpath(spm_path)
data_path = fullfile(root, 'Alon');
data_path = fullfile(data_path, output_dir, 'fsl_normalization');
% make sur... |
2af86e53718f53e807ee95417c875dfd35e9e65daf507d6217135bc1392687a0 | MATLAB | 832 | 37 |
function inds = closest(V,v,varargin)
% For each element of vector v, find the element of vector V that is
% closest to it. Pass additional string parameters 'smaller' or 'larger'
% to look only for elements that are closest, but only smaller or larger.
%
% Example:
% closest(1:10,[4.4,7.8]) ret... |
5ad6163af1771b89a46b5a146ca1c7a538cece5dc65556f4c0bc0f9409124537 | MATLAB | 832 | 38 | function Test_quadraticFunction
% Define a linear space
m = 5;
n = 2;
manifold = euclideanfactory(m,n);
% random symmetric square matrix
Q = multisym(randn(m));
% Create the problem structure.
problem.M = manifold;
% Define the problem cost function, Euclidean gradient and Hessian.
problem.cost = @cost;
function f ... |
a24dee1e2540a37823e616762db3ff5e1bf24cdb374fa27298f6bd1a5de7cee5 | MATLAB | 832 | 45 | function [kernel] = kspace_kernel(FOV,N)
% FOV : field of view in x, y, and z directions
% N : no of samples in kx, ky, kz
% center : center index of the k-space (cx,cy,cx)
center = N/2 + 1;
kx = 1:N(1);
ky = 1:N(2);
kz = 1:N(3);
kx = kx - center(1);
ky = ky - center(2);
kz = kz - center(3);
% determine the ste... |
0f735cd4d7798d59ca7aee3c94efe478556a7268d169d78c3f8169373fb71e2e | MATLAB | 833 | 28 | function egrad = essential_egradE2egrad(X, egradE)
% Converts the gradient in essential matrix E to the gradient in X.
%
% function egrad = essential_egradE2egrad(X, egradE)
%
% egradE is the function handle for the gradient in E.
%
% The output is a matrix in the space of X.
%
% See also: essential_costE2cost essenti... |
39ee0e0a1740f6f0d5f5add0d9a4e3059833310feab6056146cce3ae12a00570 | MATLAB | 834 | 25 | % function ent = MS_shannon(z,bin,depth)
%
% Calculate the approximate shannon entropy of a time series using a bin
% bin encoding and depth symbol symbol sequences. The entropy is
% given by
% sum P log P
% where P is the probability of any given symbol sequence occuring,
% and the summation is over all symbol sequenc... |
477d6e2d7f1c74484f6cf217fc9d79f0403a4ca51ff4bffc1f1666dcf841c1a1 | MATLAB | 834 | 36 | function pred = plstest(x,model)
% apply pls model on unknow samples (based on Frans Van Den Berg mypls routine)
%
% test = plstest(x,model)
%
% x data matrix (n x p)
% model pls model (see plsfit.m)
%
% test predicted response (n x g)
%
% version 1.0 - september 2009
% Davide Ballabio
% Milano Chemom... |
905b97aa59db138fa52e3de86269c6a6d689eb33a36a7a399b9bd5e173870731 | MATLAB | 834 | 36 | function cellnorm = normCellVector(cellvec)
% this function calculates the second norm of a cell vector field
%
% SYNOPSIS:
%
%
% PARAMETERS:
%
%
% RETURNS:
%
%
% EXAMPLE:
%
% SEE ALSO:
%
% Copyright (c) 2012-2016 Ali Akbar Eftekhari
% See the license file
% check the size of the variable and the mesh dimension
d = c... |
433d29ebed16f1cda886319436fd5ed65fedfc5417fa484893c7c15a4d206579 | MATLAB | 835 | 23 | %% Constants
TIMEWINDOW = [-1000, +1000];
TIMEWINDOW_BIN = 50;
KERNEL_SIZE = 1000;
KERNEL_STD = 100;
basepath = 'D:\Data\Lobster\Lobster_Recording-200319-161008\Data';
outputpath = 'D:\Data\Lobster\EventClassificationData_4C';
filelist = dir(basepath);
workingfile = regexp({filelist.name},'#\S*','match'); % read only... |
93d1d547e678984760fd8e8658a48e594ab1e2135cc874decaecb712a6764198 | MATLAB | 835 | 26 | % Compute the log intensity for the inverse link function g(f) = 1/(1+exp(-f)).
% Output range: 0 <= g(f) <= 1.
%
% The function can be used in GLM likelihoods such as likBeta.
%
% Copyright (c) by Hannes Nickisch, 2016-10-04.
function varargout = glm_invlink_logit(f)
varargout = cell(nargout, 1); % allocate the ri... |
a1e4bebfdbfb7c5e7a7af1a41eaa682aa5964c83f04b0faef8e3d6612824e398 | MATLAB | 835 | 29 | function [varargout] = check_classification(y)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% check_classification checks the target variable and returns if it is
% classification or not. It returns true if the number of unique values is
% below 3, false otherwise.
%
% Arguments:
% y: T... |
22b71c956fda6263f893b49e165eb474470cdc016687dd7b08fa9b5ab94371e2 | MATLAB | 836 | 36 | function ndvi_img = ndvi_hsi(hsi)
%function ndvi_img = ndvi_hsi(hsi)
%
% compute the Normalized Difference Vegetation Index
% from the hyperspectral image
%
%
% 10/31/2012 - Taylor C. Glenn - tcg@cise.ufl.edu
% NDVI = NIR-VIS / (NIR+VIS)
%fixme: I am pulling these wavelengths out of thin air
% to roughly be somethi... |
308d82801fd466e6af6e262c4affe220fda630e0fca3d0f6956027a085194372 | MATLAB | 836 | 23 | function store = tapas_BLT_initParallelPorts(store)
% tapas_BLT_initParallelPorts function that waits for input on the parallel port from the MRI scanner
%
% About:
% Coded by F.Petzschner 19. April 2017
% Last change: F.Petzschner 19. April 2017
% show wait for scanner screen
DrawFormattedText(store.screen.... |
4181d4aa4997ca9b44dbf748e3f2920d3ddca5a82c895bad2754f88ec3c86fd6 | MATLAB | 836 | 38 | %% h = sepia_handle_panel_qsm_LPCNN(hParent,h,position)
%
% Input
% --------------
% hParent : parent handle of this panel
% h : global structure contains all handles
% position : position of this panel
%
% Output
% --------------
% h : global structure contains all new and other hand... |
8dcfce54a1f26d6ff295496b15e11c8d3df9de51e1896de00990926621dd9980 | MATLAB | 836 | 23 | clear
clc
Pbase = fullfile(pwd, ['..' filesep]);
Pscripts = fullfile(Pbase, 'scripts');
% create DCM template models for fitting
fprintf('\n ------ Preparing DCM models for DMN ------ \n')
run([Pscripts filesep 'DCM_CSD_defineModels_DMN.m']);
fprintf('\n ------ Preparing DCM models for SN ------ \n')
run([... |
95a6f5ac7ae8d5116c43e85f6c5ca8995a5250e7bb0adfa24b13446d30bebc2d | MATLAB | 836 | 28 | function stringORstringInCell=deunderscore(stringORstringInCell)
% gets an input string and replaces the underscores ('_') with hyphens
% ('-').This avoids the problems with displaying the names in which the
% first character after the underscore would be displayed as an index.
%_______________________________________... |
06196cde4d071ab20e363a1c3901ea30454ef25edf0e944f7c8b50264e15d4ca | MATLAB | 837 | 44 | function [Prefix, ViewName, Ext] = AfniPrefix (Prefix)
%
% [Prefix, View, Ext] = AfniPrefix (Name)
%
%Purpose:
% returns the afni prefix, view and extension from a brick name
% No checking is done to make sure that View or Ext are acceptable
% see PrefixStatus instead
%
%Input Parameters:
% Name : 'elvis' or ... |
661df7ab64980972c585015737a26202cdbeb6f24aa0a4a975716c5aaeaaf57d | MATLAB | 837 | 30 | function osp_onExit( ~, ~,gui)
%% osp_onExit
% Callback function on exit button click. Closes gui.
%
%
% USAGE:
% osp_onExit( ~, ~ ,gui);
%
% INPUT: gui = gui class containing all handles and the MRSCont
%
% OUTPUT: Changes in gui parameters and MRSCont are written into the
% ... |
8e6431f14e24cb9c69cd368361a9d28982457bb52ec73e0f2259be4a7c29dd30 | MATLAB | 837 | 29 |
function Sphere_Index = gen_ROI_fast(Vref,mmCoords,Center_vox, Radium)
%
% Center:
% Center coordinates of the ROIs (# of ROIs*3 array).
% Radium:
% Radium for Sphere;
% Ref_img:
% Directory & filename of the reference image.
%
%Vref = spm_vol(Ref_img);
... |
abe5e28da3253358e4f4c390690401ec38b046ea95cf048189d58950937b7735 | MATLAB | 837 | 33 | function rankArray=rankTransform(array,scale01)
% transforms the array 'array' by replacing each element by its rank in the
% distribution of all its elements. setting scale01 would scale the
% elements to [0-1] after ranktrasforming all the non-NaN entries.
%___________________________________________________________... |
ce933c40a1a84d352428f87a5333b29e461e836a865db7ebadaabd5f9a216dae | MATLAB | 837 | 26 | function [m,dm] = meanScale(mean, hyp, x)
% meanScale - compose a mean function as a scaled version of another one.
%
% m(x) = a * m_0(x)
%
% The hyperparameters are:
%
% hyp = [ a;
% hyp_m0 ]
%
% This function doesn't actually compute very much on its own, it merely does
% some bookkeeping, and calls other me... |
07309c4c9a19623e923ad7c1f110e1e185d98a1eb14de2653bb0d1dd3bd21b1f | MATLAB | 838 | 30 | function newtrials = balanceTrials(mask1,mask2,trials)
%balances trials w.r.t. a binary mask.
%i.e., if left and right trials need to be balanced
%mask1 gives true for all left trials, and false otherwise
%this will give new data set with equal amounts of each, via
%subsampling
%mask1,... |
3c1918953f414ffe7e991c91d687e07deb156a28e86330f6c322f1151c2627b4 | MATLAB | 838 | 47 |
% You can manage fonts yourself, if you prefer.
%
% Panel, by default, manages fonts for all managed objects,
% and any associated axis labels and titles. If you want to
% manage these individually, you can turn this off by
% passing the flag "no-manage-font" to the panel
% constructor.
%
% (a) Manage fonts globally (... |
4de0c74276d38e4a8a0fe644363b358f4555ff181e912597a654b1345f162665 | MATLAB | 838 | 35 | function [h, e] = plot_patch(xVals,data)
% [h, e] = plot_patch(xVals,data)
%
% takes in matrix data (data) where the mean of each column is plotted as a point
% in a graph with SEM error bars. outputs mean data handle, h, and errorbar
% handle, e. if xVals is not specified, defaults to 1:data width
%
% modified ... |
6217b5f7e067075a24ae1633b8611b9dc98590f18c55e1de9187f05213c4ae74 | MATLAB | 838 | 33 | clear all;
close all;
clc;
% NB, June 18, 2019.
fprintf('If all is well with qr_unique, this script\nought to print many (numerical) zeros.\n');
mm = [5 8 5 5 8 5];
nn = [5 5 8 5 5 8];
NN = [1 1 1 9 9 9];
for k = 1 : length(mm)
m = mm(k);
n = nn(k);
N = NN(k);
A = randn(m, n, N) + 1i*randn(m, n, N); %... |
b0a4abda1646c705c2d912310e3b03b5b3dabba5290a0ef943a38b455c83b326 | MATLAB | 838 | 29 | function [fa, md, tensor, voxel_size]= read_tensors_fsl(folder, basename)
% Read files generated with FSL and return FA, MD, tensors and
% voxel size
%
% Author: Aina Frau-Pascual
%%% Prepare inputs
% Input tensors from FSL dtifit outputs
fa = load_nii(fullfile(folder, [basename '_FA.nii.gz']));
fa = fa.img;
md = ... |
b71cad8dfb5e41f10402e41946dccbf10b22be0b598dacc8bb85fb1698a09bb4 | MATLAB | 838 | 25 | function [da_rats, AUC_overrats, P_byrat, Rcorr_byrat, bins, T,...
ITI_legend] = ITIEffectAcrossRats(ratlist, ITIbins_density, binnum,...
event, window, Pstruct, Bstruct)
%Compares reward response to offer cue BEFORE different initiation times
%input:
%binnum = number of bins to split initiation times into
... |
46fe5bafcfbef15707330f2fbf8bbf9f63ece74fe2911f2051af040bbda5e8dc | MATLAB | 839 | 26 | function str_title = plotFC_getTitle(chGroups, src, trg, clzLabel, fcName)
% return title for FC plots
% (c) Jiri, Oct23
if nargin < 5
str_title = '';
else
str_title = [fcName ': ']; % connectivity name
end
if nargin == 3 || isempty(clzLabel)
str_title = [ str_title ...
getAbbreviation(chGroups.... |
c75450c67e04aea095c5762acfe6912767f6b423a7dfefb3fd8ef7ff242e0b20 | MATLAB | 839 | 26 | function W = LFP_GenMorlets(F,fs)
%% Generate Morlet wavelets
%
% Inputs
% F -- vector of central frequencies [Hz]
% fs -- sampling frequency
%
% Output
% W -- cell of vectors containing coefficients for each wavelet
W = cell(1,length(F));
ts = 1/fs; % sample period, second
nc = ... |
ca3c60d63e916a4a92b59aaf364e05968e2b20515ea3228d8b7855c97790cce0 | MATLAB | 839 | 28 | function [D, fX] = dlogm(X, H)
% Fréchet derivative of the matrix logarithm.
%
% function [D, fX] = dlogm(X, H)
%
% Computes the directional derivative (the Fréchet derivative) of logm at X
% along H (square matrices).
%
% Thus, D = lim_(t -> 0) (logm(X + tH) - logm(X)) / t.
%
% The second output is fX = logm(X), thoug... |
235d962f37fc0e04f3bb8e0999e7752051748ed171614894ba1ebf5f1f3bfaa3 | MATLAB | 841 | 32 | function taua=rankCorr_Kendall_taua(a,b)
% computes the Kendall's tau a correlation coefficient between the input
% vectors (a and b). NaN entries would be removed from both.
%__________________________________________________________________________
% Copyright (C) 2012 Medical Research Council
import rsa.*
import rs... |
c677ff38ac246a040332e954b54e080893ad2718fecd8319f8b8ebf6f753ffbe | MATLAB | 841 | 29 | % Copyright 2015 The MathWorks, Inc.
function h = WattsStrogatz(N,K,beta)
% H = WattsStrogatz(N,K,beta) returns a Watts-Strogatz model graph with N
% nodes, N*K edges, mean node degree 2*K, and rewiring probability beta.
%
% beta = 0 is a ring lattice, and beta = 1 is a random graph.
% Connect each node to its K next... |
d43f2fb4640aefc2768697797879950832754fe847e6e98b57e442c5a4be808c | MATLAB | 841 | 28 | function [D, fX] = dexpm(X, H)
% Fréchet derivative of the matrix exponential.
%
% function [D, fX] = dexpm(X, H)
%
% Computes the directional derivative (the Fréchet derivative) of expm at X
% along H (square matrices).
%
% Thus, D = lim_(t -> 0) (expm(X + tH) - expm(X)) / t.
%
% Note: the adjoint of dexpm(X, .) is de... |
fb6a2a7bc6fe8d83d5ef01e39b2b208c33696a17ba79d318b6d86823632e9cb3 | MATLAB | 841 | 22 | function proportions = computeTrialProportionForEachChannel(spikeTimes, allStimTimes, poststim_window_s, baseline_window_s, numChannels, spikeMethod)
%computeTrialProportionForEachChannel Computes trial proportion metric for each channel.
% For each channel, computes the proportion of trials where the post-stim
% s... |
3d80013d943134ab9de61e239cb0b7e80050d09b288a77753d1fd3d4b2eb0da6 | MATLAB | 842 | 28 | function [rez] = new_cluster(rez,clusterN,channel,Nclust,M_clust)
id_i = find(rez.st(:,end)==clusterN);
PC = rez.PC{clusterN};
i_chan= rez.Merge_cluster{clusterN,5};
cha_id= find(i_chan==channel);
pcs = squeeze(PC(cha_id,:,:))';
M_template = max(unique(rez.st(:,3)))+1;
% Nclust = 2;
GMModel = fitgmdist(pcs,Nclust ,'Re... |
60cf8ff3e301e9f545235de72f4ef09bd914820eac9058a52e0df5a06507589a | MATLAB | 842 | 37 | function facecell=finddisconnsurf(f)
%
% facecell=finddisconnsurf(f)
%
% subroutine to extract disconnected surfaces from a
% cluster of surfaces
%
% author: Qianqian Fang (fangq@nmr.mgh.harvard.edu)
% Date: 2008/03/06
%
% input:
% f: faces defined by node indices for all surface triangles
%
% output:
% fac... |
1883b2d98b7558baf540dba74ed2f452273b21b5675670cfb0ed6f0c53fbbef1 | MATLAB | 843 | 36 | %% img_hybrid = compute_hybrid_t1w_chi(t1w, chi, mask, mu, thres )
%
% Input
% --------------
% t1w : T1w image (or R1)
% chi : Chimap in T1w space, in ppm
% mask : brain mask;
%
% Output
% --------------
% img_hybrid : hybrid contrast
%
% Description:
%
% Kwok-shing Chan @ DCCN
% k.cha... |
3e3fb641479afd18ad0c9cf3473788e1a120dbd5dbdd79b56a3aeb7673bd19bd | MATLAB | 843 | 21 | function runPalm_shirley(conName,nPerm, maskName, output_dir)
% conName: name of contrast to run
root = '/data/holly-host/smark';
spm_path = '/data/holly-host/smark/spm';
addpath(spm_path)
data_path0 = '/data/holly-host/smark/fmri_sub_preproc_dir';
data_path = fullfile(data_path0, output_dir, 'fsl_norm_new_names');
%... |
490e09959fa57f0afa39c353bef565a4fd994c56262235256c4d7ca7f89e2979 | MATLAB | 843 | 31 | classdef MeshStructure
%CELLVARIABLE Summary of this class goes here
% Detailed explanation goes here
% Copyright (c) 2012-2016 Ali Akbar Eftekhari
% See the license file
properties
dimension
dims
cellsize
cellcenters
facecenters
corners
edg... |
505f9e938a0cc133e070c15ceb7a3cca1756e24d5d0725b6accb7e6ee7c635bb | MATLAB | 843 | 30 | function [dwi_arr, bval_arr, sigmadwi, SNR, noise] = dataPrepDWI(dwi_img,bval_arr,ROI,channels,N_avgs)
bgMask = zeros(size(dwi_img,1),size(dwi_img,2));
bgMask(10:30,10:30) = 1;
% bgidx = sub2ind(size(bgMask),10:30,10:30);
bgidx = find(bgMask);
maskidx = find(ROI);
dwi_arr = map2arr(dwi_img,ROI);
dwi_arr(:,... |
610d620ae242b312e98a50c1aee98f53a6e6020499f0c4b5f6c902d4a7de1ad1 | MATLAB | 843 | 23 | function varargout = covMaterniso(d,varargin)
% Wrapper for Matern covariance function covMatern.m.
%
% Matern covariance function with nu = d/2 and isotropic distance measure. For
% d=1 the function is also known as the exponential covariance function or the
% Ornstein-Uhlenbeck covariance in 1d. The covariance func... |
858f62a03fb8e28649dc947d93a5622ade355cdb5036ff155b4a3fe09dde97f6 | MATLAB | 843 | 24 | function candoit = canGetApproxHessian(problem)
% Checks whether an approximate Hessian can be computed for this problem.
%
% function candoit = canGetApproxHessian(problem)
%
% Returns true if an approximate Hessian of the cost function is provided
% in the given problem description, false otherwise.
% If a Hessian is... |
f7f37a9810a72bc0110a51fe57c9dd4a761ef8b51d07d292f432abc6a3b7a614 | MATLAB | 843 | 25 | px2cm = 0.169;
distanceRange = [floor(min(WholeTestResult(:,3)) * px2cm), ceil(max(WholeTestResult(:,3)) * px2cm)];
index = discretize(WholeTestResult(:,3) * px2cm,...
distanceRange(1) : distanceRange(2));
error = (WholeTestResult(:,3) - WholeTestResult(:,5)) * px2cm;
output = zeros(diff(distanceRange),2);
for ... |
2ca82489a2f2b5a349cbddbf2834193e207f3e003979cc3214189cdc1e8c04b4 | MATLAB | 845 | 24 | function initializePairsStructs(inputStructStrs, skipParameters)
for iInputStructStr = 1:length(inputStructStrs)
inputStructStr = inputStructStrs(iInputStructStr);
inputStruct = struct( ...
"p0", [], ...
"p1", [], ...
"p2", [], ...
"p3", [], ...... |
333a1f84bf90b73ad69f657872c3af70d4599d65e85f70412db95680f8732e9e | MATLAB | 845 | 37 | function RDMs_utv=vectorizeRDMs(RDMs)
% converts set of RDMs (stacked along the 3rd dimension)
% to lower-triangular form (set of row vectors)
%__________________________________________________________________________
% Copyright (C) 2009 Medical Research Council
import rsa.*
import rsa.fig.*
import rsa.fmri.*
import... |
92f96e925d28d716248842a193a0c39b8b8dc7140823a36855f2d6c298de5c94 | MATLAB | 845 | 48 | function [outputArg1,outputArg2] = PlotSubjectRMSError(RMSErrorVector, TitleStr)
if ~exist('TitleStr','var')
% title parameter does not exist, so default it to something
TitleStr = ' ';
end
% --- RGB vector for grey
grey = 0.75*[1 1 1];
% --- means & standard deviation per azimuth for this subject
RMSEr... |
362a9c6d7c29052fdf767f0271b77198e4d88251822e19610fe04c415699e707 | MATLAB | 846 | 43 | addpath("~/ER_Ca_rot/networkSpreadFVM-main/scripts/");
Kd=10.^[-2.045:0.2045:1.0225];
length(Kd)
t = 2.^[-5:1:10];
length(t)
p_c=20;
p=61;
y_e = zeros(16,16);
y0=3;
cnt1 = 1;
cnt2 = 1;
%%
for i = t
cnt2=1;
for j = Kd
[x,y] = ode45(@(x,y) (-(p*y)/(1+((j*p_c)/(y+j)^2))) , [0,i], y0);
y_e(c... |
7a4deaa4b23859a8e9bee6a6e556278f2beee696bf497656685dab6754ac4574 | MATLAB | 846 | 36 | function node=orthdisk(c0,c1,r,ndiv)
%
% node=orthdisk(c0,c1,r,ndiv)
%
% Defining a 3D disk that is orthogonal to the vector c1-c0
%
% author: Qianqian Fang (fangq <at> nmr.mgh.harvard.edu)
%
% input:
% c0: a 1x3 vector for the origin
% c1: a 1x3 vector to define a direction vector c1-c0
% r: the radius of... |
514b65d00f40a41a50a4e9635cdae4940671d81cce52b898ca5e75ec9f704a09 | MATLAB | 847 | 35 | function rgbVec = colorCode2rgb(c)
%COLORCODE2RGB converts a color code to an rgb vector
%
% SYNOPSIS rgbVec = colorCode2rgb(c)
%
% INPUT c : color code
% The following colors are supported:
% 'y' 'yellow'
% 'm' 'magenta'
% 'c' 'cyan'
% 'r' 'red'
% 'g' 'green'
% 'b' 'blu... |
6f5c88ce3f47ff3f9f25f08eefa36ddfaa2a69c40295643b73947b3245682da0 | MATLAB | 848 | 34 | clear all; close all; clc;
n = 5;
m = 10;
[U, ~] = qr(randn(n, min(n, m)), 0);
[V, ~] = qr(randn(m, min(n, m)), 0);
Sigma = diag(min(n,m):-1:1);
% Sigma(2,2) = Sigma(1,1);
% Sigma(3,3) = Sigma(1,1)+1e-6;
% Sigma(4,4) = Sigma(1,1);
A = U*Sigma*V';
r = 3;
problem.M = productmanifold(struct('U', stiefelfactory(n, r), ... |
78f9da118e84af4c9d345f07d72fef88727a5834a92719d0aa4798f6ac439d7b | MATLAB | 848 | 38 | %% h = sepia_handle_panel_qsm_QSMnet(hParent,h,position)
%
% Input
% --------------
% hParent : parent handle of this panel
% h : global structure contains all handles
% position : position of this panel
%
% Output
% --------------
% h : global structure contains all new and other han... |
a3282fc663be4782b9bca74f5b978aa8117cae30c148b343ebdf8fb94391ade7 | MATLAB | 848 | 28 | function p = gaussian_prob(x, m, C, use_log)
% GAUSSIAN_PROB Evaluate a multivariate Gaussian density.
% p = gaussian_prob(X, m, C)
% p(i) = N(X(:,i), m, C) where C = covariance matrix and each COLUMN of x is a datavector
% p = gaussian_prob(X, m, C, 1) returns log N(X(:,i), m, C) (to prevents underflow).
%
% I... |
a756e7dfc8852f3443d38c1463768e00adc9e44e5b4b36d30eebe4c2ea349dda | MATLAB | 848 | 38 | function [hF, tl] = fig(layout, position, color)
% Set tick dir out for all figures, sets for system for consistency
set(groot,'defaultAxesTickDir', 'out');
set(groot,'defaultAxesTickDirMode', 'manual');
% Figure out how to turn "Box" off by default
if nargin < 1
color = [1,1,1];
position = [500 500 650 500]... |
dfa48f2f49a00a8a62e3723b653918e33dfa2d37b63cce9906d6eb4783eaaf82 | MATLAB | 848 | 35 | function basename = get_basename(fullfilename)
% returns basename from filename (if standard convention P/C.name.seq)
% written by Niels Focke 04/2009 for new UMG basename code
basename='';
% check if we have / in fullfilename
slashes=strfind(fullfilename,'/');
if (~isempty(slashes))
[pa, fi, ext] = fileparts(fullf... |
f4cc31b1657b48ce4f5fad60e3763b16580c88c18f3871a0e34cfb8148e769a6 | MATLAB | 848 | 45 | function c1 = perform_curve_resampling(c, s, mode, interp_type)
% perform_curve_resampling - resample a curve
%
% c1 = perform_curve_resampling(c, n, 'nbpts', intep_type);
% or
% c1 = perform_curve_resampling(c, s, 'dist', intep_type);
%
% Where 'n' is the new number of point in the curve,
% and 's' is the cur... |
ac5d7372899a1cf0bfdcaf0ddcbff3f9d5625d7c0fbc0bd921d869ef1d313a75 | MATLAB | 849 | 39 | function [M, Mx, My, Mz] = diffusionTerm(D)
% This function uses the central difference scheme to discretize a 2D
% diffusion term in the form \grad . (D \grad \phi) where u is a face vactor
% It also returns the x and y parts of the matrix of coefficient.
%
% SYNOPSIS:
%
%
% PARAMETERS:
%
%
% RETURNS:
%
%
% EXAMPLE:
%... |
2a49110308383273e315c9717848ffc35b4674db6e38c76a3f0e8ac6cde5f4a2 | MATLAB | 850 | 44 | function [Prefix, Ext] = RemoveNiftiExtension (fname)
%
% [Prefix, Ext] = RemoveNiftiExtension (fname)
%
%Purpose:
% removes known .nii filename extensions.
% Look at code more more details.
%
%Input Parameters:
% fname: filename
%
%
%Output Parameters:
% Prefix: filename without extension
% Ext: recognized... |
a5ff22588dd51a53843a43b32d9e8212da5613834b3ca64387b44c2296e80ed6 | MATLAB | 850 | 20 | function [pvec, pstruct] = tapas_rw_binary_dual_transp(r, ptrans)
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2012-2013 Christoph Mathys, TNU, UZH & ETHZ
%
% This file is part of the HGF toolbox, which is released under the terms of the GNU Genera... |
0ca3d28b9d0e17f2c274715249eee86ac384a6e97a01f61904ea18c53c3c3464 | MATLAB | 851 | 40 | function [A] = detrendwt(A)
%initialize matrix for wait times
sess = nan(length(A.ntrials), max(A.ntrials));
ctr = 1;
wt = nan(length(A.wait_time), 1);
detrendedwt = wt;
wt(A.optout==1) = A.wait_time(A.optout==1);
xvec = (1:max(A.ntrials))';
s = []; x = [];
for jk = 1:length(A.ntrials)
sess(jk,1:A.ntrials(jk)) ... |
54cc2001df8fff7d89c37f69e3385ae03dc3f0b12363d3ff367afd261f79087a | MATLAB | 851 | 44 | function [Prefix, Ext] = RemoveNIMLExtension (fname)
%
% [Prefix, Ext] = RemoveNIMLExtension (fname)
%
%Purpose:
% removes known .NIML filename extensions.
% Look at code more more details.
%
%Input Parameters:
% fname: filename
%
%
%Output Parameters:
% Prefix: filename without extension
% Ext: recognized ... |
6568f0f426a4db14654ecf5d908a04a42ea470750d74c340631f42737c7bbf0c | MATLAB | 851 | 27 | function setLogFile_commandWindow(params)
% sets log file for output that appears in command window
% file = 'log_commandWindow.txt' in output directory
% copies existing (empty) 'log_commandWindow.txt' from usefulScripts
% (c) Jiri, Oct21
%% source file
diaryFileName_src = [params.storage.dir_neuroHammer filesep 'us... |
9e4f178102230d932e14a493782309110eaa51e1675145c82b4726c57ce81fa0 | MATLAB | 851 | 23 | function json = jsonread(filename, opts)
% JSON (JavaScript Object Notation) parser - a compiled routine
% FORMAT json = jsonread(filename, opts)
% filename - name of a JSON file or JSON string
% json - JSON structure
% opts - structure of optional parameters:
% replacementStyle: string to control ... |
e25d594192965ff92538f498a808dcd022d0c78a21321c7db47cdbc558493bf2 | MATLAB | 851 | 29 | function tapas_BLT_runStimulus(params, iTrial)
% tapas_BLT_runStimulus shows the screen when the breathing stimulus is present
% Show Stimulus
Screen('DrawTexture', params.screen.window, params.text.imgstimulation, [], params.screen.fit, 0);
Screen('Flip', params.screen.window);
tapas_BLT_logEvent('stim_on',params);... |
09d3dbdb7383b1887b924c611d1c108aeb66660bd6fa25fcda721eeb81039cbe | MATLAB | 852 | 38 | function [llh] = tapas_sem_optimized_llh(y, u, theta, ptheta)
%% Computes the likelihood of the data using an optimized method.
%
% Input
%
% y -- Observed behavioral data. A structure with fields 't' times
% and 'a' action.
% u -- Experimental input. A structure with fields: 'tt' trial... |
683bd6ba4786ef7b4635ed64627e7c29b9858062a9be54669d500c07d96a97c1 | MATLAB | 852 | 35 | function [lambda,top,bot,err] = tqlb(alpha,beta)
% TQLB: Compute eigenvalues and top and bottom elements of
% eigenvectors of a symmetric tridiagonal matrix T.
%
% [lambda,top,bot,err] = tqlb(alpha,beta)
%
% Input parameters:
% alpha(1:n) : Diagonal elements.
% beta(2:n) : Off-diagonal elements.
% Outpu... |
69a09d5b789c930eedb0b21a1aef7b5cf930b30fb0f0a9a0d1679806f0baea75 | MATLAB | 852 | 20 | %{
vis2p.Mice (manual) #
mouse_id : smallint unsigned # m) Unique identification number
---
mouse_gender="male" : enum('unknown','female','male') #
mouse_strain="C57BL6/J" : enum('NesCre-ReYFP','Viat-Ai9','SST-Ai9','Viaat','Ai9','PV','PV-Ai9','PV-AAVArch','SST-AAVArch','SST-ChR2','Nestin-Ai9',... |
16b5ba343acd0156c8866b6755d3e6e1c8e65016d0f169e5bcd219cc7973335f | MATLAB | 853 | 31 | function [ varargout ] = get_unitinfo( info,all_unitinfo, unitnum )
% function [ varargout ] = get_unitinfo( info,all_unitinfo, unitnum )
% Get some information about a particular unit or all units.
%disp(all_unitinfo.labels)
if ~iscell(info)
info={info};
end
N = numel(info);
if ~exis... |
30d1ee744508fc0cdd52aeb129e14fe183c56d3782c573bd4ea5297392409050 | MATLAB | 853 | 23 | function [Out] = NumToAzi(sn)
% Takes in a response matrix organized so that rows are responses
% and columns are azimuths between [-75:15:+75].
% Responses (loudspeaker #) are converted to the corresponding azimuth angle
% Loudspeakers 1:25 --> azimuths -90:75:90
% Output returnes as a struct with added fields.
%% -... |
c5dfb15aca23c73e730da5b4834eb7fb6d7b156490fa5e9f868cbaa31bb169dd | MATLAB | 853 | 37 | function this = plot_design_matrix(this)
% plots the design matrix scaled for display
%
% Y = MrGlm()
% Y.plot_design_matrix()
%
% This is a method of class MrGlm.
%
% IN
%
% OUT
%
% EXAMPLE
% plot_design_matrix
%
% See also MrGlm
% Author: Saskia Bollmann & Lars Kasper
% Created: 2018-05-08
% Copyright (C)... |
e0bb860f8aff3463f259bd8e5f64e7e3850c076e1583decb5c9a78e807deba93 | MATLAB | 853 | 24 | function pstruct = tapas_hgf_whichworld_namep(pvec)
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2013 Christoph Mathys, TNU, UZH & ETHZ
%
% This file is part of the HGF toolbox, which is released under the terms of the GNU General Public
% Licence ... |
f8f0610fbe59a5cdd3c82a718c4308defce416c8df0ca79a2c548a79abe0e045 | MATLAB | 853 | 32 |
d = dir(..) % Data folder
fnames={d.name}';
seed= [30,60,30]+1; % Seed voxel
maxlag=100;
v_list=load(..); % Coordinate list.
for i=1:length(fnames)
rmax_all=zeros(1,68100);
lags_all=zeros(1,68100);
try
load(['..' '/mreg_ts.mat']); % Load VLF filtered data
catch
continue
end
s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.