sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
b463b19f5c42182f791fbe8c5f40d1493a4596ca4c5fe0787c277aba416465da | MATLAB | 2,028 | 65 | function [sx, dsdx, dsdp] = VBA_sparsifyPrior (x, logExponent, smoothness)
% // VBA toolbox //////////////////////////////////////////////////////////
%
% [sx, dsdx, dsdp] = VBA_sparsifyPrior (x, varargin)
% parameter transformation that emulates Laplace priors (L1-norm)
%
% IN:
% - x: input value to be transformed
%... |
bc78994a8cda2bc52b9a907da76b5c57fb4421d112ddad128cf30db6f98bffa3 | MATLAB | 2,028 | 66 | % FT_POSTAMBLE_PREVIOUS adds the cfg structure from the input data
% structure or structures to the current configuration structure.
%
% Use as
% ft_postamble previous inputvar
% ft_postamble previous inputvar1 inputvar2
% ft_postamble previous varargin
%
% See also FT_PREAMBLE, FT_POSTAMBLE
% Copyright (C) 2011... |
d7f0ca1b47cebc45c363d664b86e07c16a3dd2b1563bc28b8ae1b6f9dfc392a4 | MATLAB | 2,028 | 77 | function [pE,pC,D,is_logscale] = spm_hdm_priors_hdm3(m,M)
% Same as spm_hdm_priors_hdm2 in toolbox, but other versions
% spm_hdm_priors_hdm4/6 have additional parameters switched on, ie pC>0
% returns priors for a hemodynamic dynamic causal model
% FORMAT [pE,pC] = spm_hdm_priors(m,[h])
% m - number of inputs
% M.... |
ee2e996c64b59d35ed97459a9bc7acc848338a10fff2fc2b51fb6c52ae2c0977 | MATLAB | 2,028 | 55 | function [ ICC, idx_fail] = do_ICC(Y, time, Cov_w, Cov_b, sID)
% [ ICC ] = do_ICC(Y, time, Cov_w, Cov_b, sID)
% Compute the ICC map of
% Base on toolbox of Jorge Luis Bernal Rusiel
% Input
% Y: Data matrix (nm x nv, nv # locations) whos colums can represent data
% vectors for each voxel/vertex.
% Time: Vector indicatin... |
f63b1518957970dbafd43cf49f3ff004f0781f4dd9e843dd8e12cc58249e5455 | MATLAB | 2,028 | 71 | function u = nvecs(X,n,r,opts)
%NVECS Compute the leading mode-n vectors for a tensor.
%
% U = NVECS(X,n,r) computes the r leading eigenvalues of Xn*Xn'
% (where Xn is the mode-n matricization of X), which provides
% information about the mode-n fibers. In two-dimensions, the r
% leading mode-1 vectors are the ... |
2d33d7006d1bb052ed6dbebd764663f99d2b1ebdb4df0465180b752e560f570b | MATLAB | 2,031 | 27 | close all
clear
meter_list=ThorlabsPowerMeter; % Initiate the meter_list
DeviceDescription=meter_list.listdevices; % List available device(s)
test_meter=meter_list.connect(DeviceDescription); % Connect single/the first devices
%or ... |
f9c788e514d3cce4504d8e4459269c316f058a9f567cdae523f08c669d43aaba | MATLAB | 2,031 | 77 | function [pE,pC,D,is_logscale] = spm_hdm_priors_hdm4(m,M)
% Same as spm_hdm_priors_hdm2 in toolbox, but other versions
% spm_hdm_priors_hdm4/6 have additional parameters switched on, ie pC>0
% returns priors for a hemodynamic dynamic causal model
% FORMAT [pE,pC] = spm_hdm_priors(m,[h])
% m - number of inputs
% M.... |
41a1fffc4a27ed5c18489d070e22060297a1c90a34321dddf46e8632bef69a8b | MATLAB | 2,032 | 49 | %% How To
% Here we show how non-MATLAB users can get access to numerical data in
% .mat files without resorting to software such as scipy's readmat. In the
% two main pipelines in github (figures_pipeline.m in human_analyses_acwdr
% and figure_pipeline_acwdr.m in mice_analyses_acwdr folders) there are
% referenc... |
456732ab260a9c5c58be982ae15639527a4f6fa78a598e6e3ca1cd9daf39371c | MATLAB | 2,032 | 60 | function elec = read_asa_elc(fn)
% READ_ASA_ELC reads electrodes from an ASA electrode file
% converting the units to mm
% Copyright (C) 2002-2013, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
% FieldTrip is free software: you can ... |
f0254b8cf4e485fc65a05dce1b719f4a82969a75a5d975b299f76315e4e9d129 | MATLAB | 2,032 | 60 | function elec = read_asa_elc(fn)
% READ_ASA_ELC reads electrodes from an ASA electrode file
% converting the units to mm
% Copyright (C) 2002-2013, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
% FieldTrip is free software: you can ... |
4d3c1f5fa7fe9b482a667d7b0e77c13af0c8f343457c44d91df811c6a092d040 | MATLAB | 2,033 | 70 | function [h, f, ylimits] = HumanOdorRep_plot_signals(signals, x, plot_color, error_type)
%% function [h, f, ylimits] = HumanOdorRep_plot_signals(signals, x, plot_color, error_type)
%
% plots the mean and some error of signals stored in 2D array
% rows: observations/trials/segments, columns: samples.
%
% Optional a... |
6ba4a668652d6ee90736e76448b566e94eb1ad5d290e422c22af5014a82f6287 | MATLAB | 2,033 | 106 | function [xd,dxddk,dxddx] = apply_distortion2(x,k)
[m,n] = size(x);
% Add distortion:
r2 = x(1,:).^2 + x(2,:).^2;
r4 = r2.^2;
r6 = r2.^3;
% Radial distortion:
cdist = 1 + k(1) * r2 + k(2) * r4 + k(5) * r6;
if nargout > 1,
dcdistdk = [ r2' r4' zeros(n,2) r6'];
end;
xd1 = x .* (ones(2,1)*cdist);
coeff = (re... |
9199dba145c9a2f8b79b12f901cfe03a2c7b4781db8f7d5907e6392913d97ac7 | MATLAB | 2,033 | 67 | function [lineOut, fillOut] = stdshade(amatrix,alpha,acolor,F,smth)
% usage: stdshading(amatrix,alpha,acolor,F,smth)
% plot mean and sem/std coming from a matrix of data, at which each row is an
% observation. sem/std is shown as shading.
% - acolor defines the used color (default is red)
% - F assignes the used x axi... |
94bc7f9d4680d194f8318d855dc3ecf4dc54633e191f260b02bb0f7aa92c2771 | MATLAB | 2,033 | 55 | function [data_filter_above,data_filter_below] = loc_list_clusters_filter_area(data)
answer = inputdlg({'Enter Minimum Area per Cluster:'},'Input',[1 50],{'0.2'});
if isempty(answer)~=1
min_area = str2double(answer{1});
f = waitbar(0,'Filtering Based On Area...');
for i=1:length(data)
... |
064976ba39c367be42970868bdc351c99f44e0099ead6306226d4dee9095da2c | MATLAB | 2,034 | 80 | function [good_behavior] = remove_bad_behavior_ver2_withoutvelocity(behavior, behavior_filepaths, lick_stop_flag)
close all
if lick_stop_flag==0
lick_stop_frame = 1;
end
runs = behavior.ybinned;
sm_runs = smooth(behavior.ybinned);
diff_runs = [diff(sm_runs); 0];
time = behavior.t;
good_runs = [];
good_runs_index ... |
1fe2006fe60cee42856b925b708444c7e93ce38c96aec7d03f17db8b4a819f21 | MATLAB | 2,034 | 46 | function parallel_extract_FIR_VOI(stat_path,exp_folder,N,N_ROIs)
% ========================================================================
% Ruslan Masharipov, October, 2023
% email: ruslan.s.masharipov@gmail.com
% ========================================================================
for subji = 1:N
for j = 1... |
8f19b7798435f050e81f5f3cae5bf20e432e888ecb8b84333b0280e828d6795f | MATLAB | 2,034 | 62 | classdef TrivialGraph < dspace_graphs.AbstractGraph
%
%
%
%<PRE>
% This file is part of dspace-core.
%
% Copyright (C) 2020 University Zurich, Sepp Kollmorgen
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU Affero Genera... |
8fc442713d3a900b0307357efa512f17ad0be426e9f1b5ad3d4d9cdee1faed28 | MATLAB | 2,034 | 77 | function [pE,pC,D,is_logscale] = spm_hdm_priors_hdm5(m,M)
% Same as spm_hdm_priors_hdm2 in toolbox, but other versions
% spm_hdm_priors_hdm4/6 have additional parameters switched on, ie pC>0
% returns priors for a hemodynamic dynamic causal model
% FORMAT [pE,pC] = spm_hdm_priors(m,[h])
% m - number of inputs
% M.... |
1559c71d33b8170cc2d1bece2c444ec709354bdd68fecb0c74d3c47ded3743f7 | MATLAB | 2,035 | 70 | function lan_master_gui_spks_isi(ts, clu)
figure
maxlag = 500;
choice = 1;
bins = 500;
uibg = uibuttongroup('units', 'norm', 'position', [.55 .0 .45 .08]);
uicontrol('style', 'radiobutton', 'string', 'c1',...
'units', 'norm', 'position', [.1 .1 .2 .5], 'parent', uibg);
uicontrol('style', 'radiobutton', 'string',... |
569554ec8c65af418f7b8e04f78f29b5ab6428e5bb89d31514ca4197c7da4b69 | MATLAB | 2,036 | 69 | function y = ft_preproc_slidingrange(dat, width, varargin)
% FT_PREPROC_SLIDINGRANGE computes the range of the data in a sliding time
% window of the width specified. Width should be an odd number (since the
% window needs to be centered on an individual sample).
%
% Use as
% y = ft_preproc_slidingrange(dat, width, ... |
c56e9061e9c2fb3abef6a132d1117cb033547a7b663ebcaf40a44b5b1cc88dec | MATLAB | 2,036 | 82 | % 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 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,... |
c84e69c7f3289c81b6d38e419b0cb1ea0ca0ca00574b11000d7a1232ebab32ff | MATLAB | 2,036 | 84 | function CBIG_MFMem_rfMRI_run_1000_simulation_trainingGrp_resLow(save_dir_input)
%--------------------------------------------------------------------------
% CBIG_MFMem_rfMRI_run_1000_simulation_trainingGrp_resLow
%
% Input parameters:
% save_dir_input: Output file directory
%
% This function will run 1000 siml... |
6e7fd7717916c7959abee38a30f9ee699377d7c7737c96c2d70a4416775fcefb | MATLAB | 2,037 | 57 | function [Iout,Tx,Ty]=bspline_transform_2d_double(Ox,Oy,Iin,dx,dy,mode)
% Bspline transformation grid function
%
% [Iout,Tx,Ty]=bspline_transform_2d_double(Ox,Oy,Iin,dx,dy,mode)
%
% Inputs,
% Ox, Oy : are the grid points coordinates
% Iin : is input image, Iout the transformed output image
% dx and dy : ... |
98fca89002c8c9c7982599e34092c23fffbd6d5b6825f499983ab03db3fa345b | MATLAB | 2,037 | 77 | function [pE,pC,D,is_logscale] = spm_hdm_priors_hdm6(m,M)
% Same as spm_hdm_priors_hdm2 in toolbox, but other versions
% spm_hdm_priors_hdm4/6 have additional parameters switched on, ie pC>0
% returns priors for a hemodynamic dynamic causal model
% FORMAT [pE,pC] = spm_hdm_priors(m,[h])
% m - number of inputs
% M.... |
ec795ba1da859b22d66013f683f3d4af9f1d8847717cae3e51dd024fe06e2eb4 | MATLAB | 2,037 | 58 | function embedding=spectral_layout_binned(data, init, limit, ...
n_components, eigen_limit)
%SPECTRAL_LAYOUT_BINNED Given a large set of data, bin the samples into
% 8192 bins, then compute the adjacency graph of the bin means according to
% UMAP defaults. Then compute the spectral embedding as in
% spectral_layout... |
1d9c7365d67c69c9ccb209201d4ccb70570fd6724f757e767e71418526dbc62d | MATLAB | 2,038 | 64 | function [datsmooth] = ft_preproc_smooth(dat, n)
% FT_PREPROC_SMOOTH performs boxcar smoothing with specified length.
% Edge behavior is improved by implicit padding with the mean over
% half the boxcar length at the edges of the data segment.
%
% Use as
% datsmooth = ft_preproc_smooth(dat, n)
%
% Where dat is an Nc... |
87da121e0c0d0f9300bbe867f19a0de3ca4b3c3e10b709fcf3cba752dd53ab19 | MATLAB | 2,038 | 52 | %% SAT - app_input::
%% fill_ppdc
% Name: Phone Kyaw
% Date: 09/19/2024
% Description: Return a PP data cell object for SMM
% Parameters: pp_cell - Nx1 cell where N is a trial. Inside each
% cell is a Mx2 cell where M is sensor and the second column
% is the activation t... |
c3fe5b340be253e74a54dade553e616b2c0c31dad543b46b9343df85e5d76ff5 | MATLAB | 2,038 | 67 | function [order, chordal, cliques, numpa] = maxCardinalitySearch(G, initNode)
%% Compute the perfect elimination order of a chordal graph
% Uses the Maximum Cardinality Search algorithm
% chordal = false if graph is not chordal
% Also returns maximal cliques of the graph, in an order
% that satisfies running intersect... |
d12c4fbc5f75d2ebea6b8d499568e85d2ba0d1f43ffb95936bbcd86bde82f712 | MATLAB | 2,038 | 68 |
%% Global Default Options
GlobalOpts.Subject='p1';%'p1','p3';
GlobalOpts.TaskName='FaceScratch3'; % used for folders and file names
GlobalOpts.TaskFileName='FaceScratch3'; % To use with LoadConvertedData
% Analyses phases and windows for trial response and temporally resovled
% response (TR)
GlobalOpts.Pha... |
e62fcfbe68df21efd5704ed16c1a03f16fe3ab57d151462b48b1c55758d0808d | MATLAB | 2,038 | 82 | % This script loads model and NIfTI data when availble
% It can be used as a starting point
%
% Copyright SNM 2017-2022
%%
restoredefaultpath;
addpath(fullfile('../engines/bem_fmm_engine/'));
%%
load(fullfile(model_path,strcat(patno,'_',model_name,'_bemfmm_mesh.mat')));
%load('CombinedMesh'); % load pr... |
f37b5e4c08ae65923826eeec62d627143e3a0e74814c2de8c588f4ab4d239eda | MATLAB | 2,039 | 55 | function [varargout] = ismatrix(varargin)
% ISMATRIX is a drop-in replacement for the same function that was
% introduced in MATLAB R2010b.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% see https://github.com/fieldtrip/fieldtrip/issues/... |
08face679ca3d7416709d2df561ad01863b720b62a4aa34088d8cd44ac6777dd | MATLAB | 2,040 | 55 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Function to realign each discharge time with the maxima of each MU action
% potential (identified over the channel with the highest peak-to-peak
% amplitude)
% Input:
% EMG = raw EMG signal
% EMGmask = flagged EMG channels with artifact... |
d217f45e2eac0cfb0af0ba5917459c5b94b0832c64718b7f13a85cc0620b39fb | MATLAB | 2,040 | 51 | function [Fx,Fy]=backwards2forwards_2d_double(Bx,By,H)
% This function will turn a backwards transformation field into
% a forwards transformation field.
%
% [Fx,Fy]=backwards2forwards_2d_double(Bx,By,H);
%
% inputs,
% Bx,By : The backward transformation fields
% H : The Splatting kernel
% outputs,
% ... |
dccde970f2885a6c2e69a5098253f224ca1f4852d5d0edd1172129fd1b22cb97 | MATLAB | 2,040 | 86 | function mdir = make_legacy(tdir)
global mvgc_root;
if nargin < 1 || isempty(tdir), tdir = [tempdir 'mvgc_legacy']; end
fprintf('Populating target directory...');
syscmd = ['cp -r ' mvgc_root filesep '* ' tdir];
status = system(syscmd,'-echo');
if status == 0
fprintf(' done\n');
else
fprintf(2,' failed\n');
... |
a26124067ffb9824011d790035acd746ccb3de99304890d8af6366cbee306635 | MATLAB | 2,041 | 58 | function [y,iflaw]=fmlin(N,fnormi,fnormf,t0);
%FMLIN Signal with linear frequency modulation.
% [Y,IFLAW]=FMLIN(N,FNORMI,FNORMF,T0) generates a linear frequency
% modulation.
% The phase of this modulation is such that Y(T0)=1.
%
% N : number of points
% FNORMI : initial normalized frequency (default: 0.0)
% F... |
b46b8bf1eb93d96026af849f49eccc875449b0f16d418850ee42acf99621fc8e | MATLAB | 2,041 | 70 | function [AdjM,cn] = AdjMtx(Surf,maskvtx)
% AdjM = AdjMtx(Surf,maskvtx)
%
% This function finds the adjacent vertices for all vertices along the
% surface.
%
% Input
% Surf: Surface. It is a structure with Surf.tri = t x 3 matrix of triangle
% indices, 1-based, t=#triangles and Surf.coord = 3 x nv matrix of
% coord... |
de8190669afae2b0fc89334bd71f6212daff1c895302c38f36f4694a610d0518 | MATLAB | 2,041 | 48 | %% This is an example using subsamplingMMD.m.
%% Based on SimulatedDatasets.m, our goal is to learn a transformation h(X) = diag([4,2,3,5]) * X + [100,-40,-60,800].
%% First, we attach all required subfolders and run SimulatedDatasets.m to generate datasets.
addpath(genpath(pwd));
SimulatedDatasets
%% Currently, subs... |
55ca26251c043b9bbc8d4f1aa22acf6e18f11077d9b7ae51d7cff9d2e6a90e69 | MATLAB | 2,042 | 50 | function [Features,info] = Level_based_Feature_extraction_kSVD(Data,Matrix_Coeff,Residual,dError,dx)
if nargin==3
dError = [];
dx = [];
elseif nargin==4
dx = [];
dEV = sum(abs(dError),1);
p = dEV / sum(dEV);
Ent = -sum(p.*log2(p));
Ent(isnan(Ent)... |
9adb3bc3a2b361ff0f93a9aef00381a60967227525b187a054ae64c61289a0ed | MATLAB | 2,042 | 86 | %% Demonstrate block-based inference in a 2d grid of a noisy image of an X
% Based on
% http://www.cs.ubc.ca/~schmidtm/Software/UGM/block.html
% PMTKslow
%% Get model and data
% This file is from pmtk3.googlecode.com
setSeed(0);
load X.mat % binary image of an 'X'
Xclean = X;
X = Xclean + 0.5*randn(size(Xclean));
[n... |
17792435390ff10bd48d3bc979006232aa29ef502a791fa1928dab311e6ef368 | MATLAB | 2,043 | 67 | function [dx, dy] = GaussGradient(im, sigma)
% GAUSSGRADIENT Like gradient but using Gaussian derivative
%
% GaussGradient(im, sigma)
%
% for sigma == 0 this just calls gradient
%---------------------------------------------------------------------
% license
%-----------------------... |
765dab795e88a865406bb8a921baf0c8f252a7266b6eb40e8df486bad4a4db7f | MATLAB | 2,043 | 60 | function textprogressbar(c)
% This function creates a text progress bar. It should be called with a
% STRING argument to initialize and terminate. Otherwise the number correspoding
% to progress in % should be supplied.
% INPUTS: C Either: Text string to initialize or terminate
% Percentage... |
e17bac777d4a04ca2bd28935c43ba3ddda57ff6a19431b87e9158b519047280f | MATLAB | 2,043 | 68 | function s1 = appendstruct(varargin)
% APPENDSTRUCT appends a structure to a structure or struct-array.
% It also works if the initial structure is an empty structure or
% an empty double array. It also works if the input structures have
% different fields.
%
% Use as
% ab = appendstruct(a, b)
%
% See also PRINTSTR... |
f36bc921c3a5cedc841ce805b1fe4cef97266934badc6a15f477a038cf7f9a20 | MATLAB | 2,043 | 85 | %% Two hypothetical two-sided power curves: B dominates A
%
%%
% This file is from pmtk3.googlecode.com
figure('Color',[1,1,1]);
domain = -pi:0.01:pi;
f1 = @(x)-cos(x)+0.03;
f2 = @(x) -cos(2*x./3);
linewidth = {'LineWidth',2.5};
plot(domain,f1(domain),'-b',linewidth{:}); %curve B
hold on;
plot(domain,f2(domain),'-r'... |
1d7880efa9cfe06532e3f39c535e0dcde511fa5a79ea038018345d78931b4488 | MATLAB | 2,044 | 68 | classdef ShiftArrowMovieNavMode
enumeration
NEXTTIMELINE ('Next shown in timeline')
NEXTTIMELINETHRESH ('Next where timeline stat exceeds threshold')
NEXTLABELED ('Next labeled')
NEXTTRACKED ('Next tracked')
% NEXTIMPORTED ('Next imported')
end
properties
prettyStr
end
methods
f... |
992c81e3aa6eb5656ae9cef447c2ffcfb37ce3da672e64d64f559408828fac15 | MATLAB | 2,044 | 26 | for RecordingNum=1:length(Recording)
warning(['Cleanup for Rec#',num2str(RecordingNum)])
if exist([ScratchDir,Recording(RecordingNum).StackSaveName,dc,'TempFiles',dc])
warning('Deleting Temp File Directory...')
rmdir([ScratchDir,Recording(RecordingNum).StackSaveName,dc,'TempFiles',dc],'s');
... |
1735d5a90db657ecfc67345344c5a10d1fb5d65f864aa95ca61a0a9d25ea4c3a | MATLAB | 2,045 | 85 | function lan_erp_plot(time,data,chanlocs,trial,chan,accept)
% <*LAN)<]
% v.0.0.2
%
% lan_erp_plot realiza un grafico del ensayo del erp de la condicion, con
% la posibilidad de graficar el scalp.
% 22.06.2012
% 17.08.2011
% Pablo Billeke
%global handle01
%global handle02
if nargin<6
accept = ... |
6d9f147ed24e098930408d27a37380f29982591396cee483a4d9849cbcf5c267 | MATLAB | 2,045 | 44 | clear all
%%
%Note that this code does not synthesise the Monte Carlo data directly. The MCOutputs folder provides the MC estimates for the default parameter options
%%
%Define Parameters
[opt] = ParameterOptions();
%%
%Define flip angle array
alpha=10:10:170;
%%
%Calculate analyical and b-value distribution solution a... |
8f1cf86d941340f868f8a559e92a9a90af57ea114c72b98747f8e79496f14d47 | MATLAB | 2,045 | 81 | function [h,X,Y] = ellipseupdate(h,a,b,x0,y0,phi,lineStyle)
%ELLIPSEDRAW can draw an arbitrary ellipse with given parameters.
% The properties of that ellipse plot can be customized
% by setting the ellipse handle.
%
% hEllipse = ellipsedraw(a,b,x0,y0,phi,lineStyle)
%
% Input parameters:
% a ... |
ea85be903f9377ae786947b5d2eda349f66c7094e82cba73a7c2e8ce1c4e31c6 | MATLAB | 2,045 | 78 | %% GSA_Init: initialize the variables used in the GSA computation
%
% Usage:
% pro = GSA_Init(pro)
%
% Inputs:
% pro project structure
%
% Output:
% pro project structure
%
% ------------------------------------------------------------------------
% Citation: Cannavo' F., Sensitivi... |
0ef49e6d0cfe3d9fe33e1851305ff572edeb51ec3830826da1f4479d5721420b | MATLAB | 2,046 | 77 | function [matrix, extra] = read_mat(fn)
% READ_MAT reads a matrix from an ascii or binary MBF format file
%
% Usage: m = loadmat('file');
% or [m,extra] = loadmat('file');
%
% LOADMAT('file') returns the matrix stored in 'file' and
% the extra information stored at the bottom of that file.
% LOADMAT... |
831cfed80ea4149a3df4e771419f9b839de915ca214cfe3922593b215348b97e | MATLAB | 2,046 | 66 | function [x,y,r]=MagnetGInput(h,N,TEST)
% MAGNETGINPUT(h,N,test)
% Given the handle of the plot, h, MAGNETGINPUT will either
% return the position clicked (upon right button press) or
% the location of the datapoint closest to the position
% clicked (upon left button press)
%
% If N is provided, MagnetGInput wil... |
aa3117709e024969a72e4da0e1d642c548fab0d24dce50cc27c42fc9ad602110 | MATLAB | 2,046 | 82 | function [rest, rhist, FunHist,parhist] = EstRankGreedily(ObjFun,estfun,r0,maxrank,stepthresh,histfile)
% check dimensions of r
[P1, P2] = size(r0);
if P1==1
rest = r0;
P = P2;
else
rest = r0';
P = P1;
end
rhist = rest;
if isempty(stepthresh)
stepthresh = 0;
end
% Initialize with ranks-r0
% [sha... |
3e5c1daf4353e77155d7e931fbf582ca9dc4f3606ccc94dfa6b4fb3f85968c77 | MATLAB | 2,047 | 66 | function mesh = add_blob(mesh, blob)
% mesh = add_blob(mesh, blob)
%
% Adds circular (2D) and spherical (3D) anomalies
% to mesh.
%
% mesh is the mesh variable or filename.
% blob contains the anomaly info.
% blob should have the following format, depending on mesh type
%
% for a STANDARD mesh:
% blob.x - x position
% ... |
28f4d6f1ac394fcd18f4c821c87d0c5f80b2304c93628eba89f68c6b991e1990 | MATLAB | 2,048 | 62 | function [varargout] = plgndr(varargin)
% PLGNDR associated Legendre function
%
% y = plgndr(n,k,x) computes the values of the associated Legendre functions
% of degree N and order K
%
% implemented as MEX file
% the original implementation was based on "Numerical Recipes in C", version 2.0
% but has been replaced wi... |
343cd144b659cbe80b9acc4302f2da707aa03fa16a2bced6b8505e82e5de187e | MATLAB | 2,048 | 72 | %% cpsd_xform
%
% Transform cross-power spectral density for reduced regression
%
% <matlab:open('cpsd_xform.m') code>
%
%% Syntax
%
% SR = cpsd_xform(S,AR,SIGR)
%
%% Arguments
%
% See also <mvgchelp.html#4 Common variable names and data structures>.
%
% _input_
%
% S cross-power spectral density (cpsd... |
7d49d36bf84c4751cc1b08dd0a0612d7d74925bfe7b6a2265fbecdca057d79bd | MATLAB | 2,048 | 80 | function [hEllipse,X,Y] = ellipsedrawpatch(a,b,x0,y0,phi,lineStyle,varargin)
%ELLIPSEDRAWPATCH can draw an arbitrary ellipse with given parameters.
% The properties of that ellipse plot can be customized
% by setting the ellipse handle.
%
% hEllipse = ellipsedraw(a,b,x0,y0,phi,lineStyle)
%
% Input paramet... |
432c04dbb637eb79a217122cb267f3ea099f72ee8725ad5abbcf3a29675ca29e | MATLAB | 2,049 | 51 | function linearModelCoef = defineLinearModelCoefficients()
% Define linear model coefficients for different light levels and photoreceptor types.
% This function provides coefficients of a linear model fit to the responses
% of the full model of each photoreceptor type to low contrast stimuli at discrete li... |
9dec09dd3d513d4c8561e8a13a85a1a77812fa26bd976b6b5bf53ca6a11d53c1 | MATLAB | 2,049 | 45 | function cellmdl = paramsToStructFlashes(mdlparams, gridcent, dgrid)
%PARAMS_TO_STRUCT_FLASHES Converts model parameters to a structured format.
%
% This function takes a vector of model parameters (mdlparams) and
% additional information about the subunit grid (gridcent, dgrid) to
% create a structured array (... |
a62f802ced2c58de5bf460de86d16e4d145e2acdd3a3e79c603be6ecb2c5da6f | MATLAB | 2,049 | 71 | % 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 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,... |
496ee2ce64544bbc64ec17410e6ee757870fb1d5392b334000635c1053bf388f | MATLAB | 2,050 | 69 | classdef GTSuggestionType
% Currently unused, see GTSetNumFramesType.m for current (very similar)
% treatment
enumeration
RANDOM % each MFT row drawn equally likely
BALANCEDMOVIE % number of rows per movie approx equal
BALANCEDTARGET % number of rows per target/movie approx equal
end
meth... |
76855b7525b2e8fef9ac947bd23d8d783e44a4cb6878fc0a66133c4f0b967cf6 | MATLAB | 2,050 | 55 | function EEGtemp = preprocessing_ICA(EEGtemp,params)
% Wraper for performing steps 4, 5 and 6
% 4. REMOVE ARTIFACTS WITH ICA
try
EEGtemp = pop_runica(EEGtemp,'icatype','runica','concatcond','off');
EEGtemp = pop_iclabel(EEGtemp,'default');
EEGtemp = pop_icflag(EEGtemp, params.ICLabel); % flag artifactual c... |
eac1d9f4f8a79b94d949a585169a5b0f2225938493f9731d590e37aa51529a9e | MATLAB | 2,050 | 69 | function [mappedX, mapping] = fa(X, no_dims)
%FA Perform factor analysis (FA) on dataset X
%
% mappedX = fa(X, no_dims)
%
% Perform factor analysis on dataset X in order to reduce its
% dimensionality to no_dims dimensions. The reduced data representation is
% returned in mappedX.
% This file is part of the... |
4054f966d35108d36ffa4a0e4cb16ef2cc8471d0cf9e14b6621fff43b9d06bbb | MATLAB | 2,051 | 71 | % read_erplabheader() - import ERPLAB dataset files
%
% Usage:
% >> header = read_erplabheader(filename);
%
% Inputs:
% filename - [string] file name
%
% Outputs:
% header - FILEIO toolbox type structure
%
% Modified from read_eeglabheader
%1234567890123456789012345678901234567890123456789012345678901234567890... |
3776c335a0697ffbeee7241a433b309f10757faf7a6cd505a0db8f73c1502ab8 | MATLAB | 2,052 | 70 | % This demo exemplifies the post-dictive interval on a simple GLM
% Let us assume that observed data are given by: Y=aX+b+e, where e are iid
% residuals. We want to portrait our uncertainty regarding "postdicted"
% data, i.e. draw something like a confidence interval around the
% regression line.
clear all
close all
... |
672a21b3cec486e8f0449ced0567c4e67844fc54af5636ae485ceeaa48bd77dd | MATLAB | 2,052 | 60 | function process_kilosort(basepath,varargin)
% Function for processing kilosort
%multishank=1 when multiple shanks and =0 when single shank
p = inputParser;
addParameter(p,'overwrite',false,@islogical);
addParameter(p,'multishank',false,@islogical);
addParameter(p,'ssd_path',"C:\kilo_temp"... |
1195b655dc933a1b91ba0019a760691a76ea1209eeb70521f24e143db8e88516 | MATLAB | 2,053 | 57 | clear;
%%
% This script creates three files: In current directory (can move them
% later)
% 1) BinaryMatrix*.txt (ascii file)
% 2) BinaryMatrix*.edge (ascii file for BNV)
% 3) BinaryMatrix*.mat (matlab data file)
% example output:
% BinaryMatrix_cerebellum_patient_control_13-29Hz_2_25.mat
% Binary... |
7cfa081d072542e390676f9ebfa6f3723e26d579edac3f9ba12e8a3ee2a54553 | MATLAB | 2,053 | 55 | function [X0,LB,UB] = exgauss_start_vals(y)
% EXGAUSS_START_VALS estimates starting values and bounds for optimization
%
% DESCRIPTION
% Estimates starting values for optimization algorithm. The approach is
% based on Lacouture & Cousineau (2008).
%
% SYNTAX
% [X0,LB,UB] = EXGAUSS_START_VALS(y);
%
% y - Nx1 vec... |
307f5b9944c7eca911093cfc10850c037f8b55cef0328ca8f20eb8516bf2b48d | MATLAB | 2,054 | 67 | function [elec] = read_brainvision_pos(filename)
% READ_BRAINVISION_POS reads electrode positions measured with the Polhemus
% tracker in one of the F.C. Donders EEG labs. The polhemus software is actually
% not from Brainvision.
%
% Use as:
% [elec] = read_brainvision_pos(filename)
%
% This returns an electrode st... |
3d559e5225933c364ff86ba59f1711756bc8400a6971079db858ecb7ae964374 | MATLAB | 2,054 | 53 | function [ctxidx, hpidx] = getCellIdx(animalDir, animalprefix, sectionDay, epoch, isSimulatedData)
% [ctxidx, hpidx] = decode.getCellIdx(animalDir, animalprefix, sectionDay, epoch, isSimulatedData);
%
% Each row is formated as (tet, cell)
%% Set up
singleDay2019Animals = {'ER1','KL8','JS14','JS15','JS17','JS21'};
%... |
d383bf5bd2f4b20818c8152c0c421e7576c6c676814139437409b5d757b77814 | MATLAB | 2,054 | 67 | %% Constructs smoothed 3D construction for videos listed in file
addpath ~bransonk/behavioranalysis/code/Jdetect/Jdetect/filehandling;
addpath ~bransonk/behavioranalysis/code/Jdetect/Jdetect/misc;
addpath /groups/branson/bransonlab/projects/flyHeadTracking/code/
addpath ~bransonk/tracking/code/Ctrax/matlab/netlab
in... |
ec8ca51e96e791f17f5b49a60bcc87ede5d45bb6b21d85232afa8367422cd75f | MATLAB | 2,054 | 38 | %% RELAX-Jr EEG CLEANING PIPELINE, Copyright (C) (2024) Aron Hill & Neil Bailey
% 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
% any la... |
5855d0cc8df9a334e6a60b9216f5b46c78e6d07d7d9f5c10253bad4aed8a18ab | MATLAB | 2,055 | 78 | function newevlist = wlAux_getReconFromParams(oldevlist)
% function newevlist = wlAux_getReconFromParams(oldevlist)
%
% This function fills in "times", "wave", "mag", "freq", and "phase" in a
% seires of event records by calling wlSynth_makeOneBurst() using the
% extracted event parameters. s1 and s2 are adjusted acco... |
732b55b724cabef40dcda11b100eebea9b1d1836019f4114a35ad55c9f21f0d8 | MATLAB | 2,055 | 77 | function A = makehatch_plus(hatch,n,m)
%MAKEHATCH_PLUS Predefined hatch patterns
%
% Modification of MAKEHATCH to allow for selection of matrix size. Useful whe using
% APPLYHATCH_PLUS with higher resolution output.
%
% input (optional) N size of hatch matrix (default = 6)
% input (optional) M width of lines a... |
9b931ddc5bae90c3a5d50cb9529a161c7afa640140639a777473fb64a530c23f | MATLAB | 2,055 | 71 | %% Test that multiple plot_task analyses run correctly and dont interfere
% Setup base path
clear;
basefolder = fileparts(fileparts(fileparts(mfilename('fullpath'))));
codefolder = [basefolder,'/code'];
toolsfolder = [basefolder,'/tests/tools'];
addpath(genpath(codefolder));
addpath(genpath(toolsfolder));
% Load Da... |
b25bfe416c1b55d58be4b48efa67a850c3e3ba99196268de5f087bf8f4f0d4a2 | MATLAB | 2,055 | 77 | function [IDIF_raw, TACs_selected, xyz, number_of_final_voxels] = extract_raw_IDIF(PET_dyn_path, t_PET_emi, anatomy, qc_path, mask_path, options)
try
NII_mask = load_nii(fullfile(mask_path,[anatomy '_mask.nii']));
catch
exception=MException('IDIF_extraction_tool:Fail','Required Anatomical seg... |
c875aa5531130a653da39d1d7ecf41e5521c421ef0930c47da48914304defd7f | MATLAB | 2,055 | 66 | function [Uout, UoutAll] = propagate_field(field,params,sg_flag,crop)
% [Uout, UoutAll] = propagate_field(Uin, lambda, dx, z, field.phi, nidx)
%
% Simulates optical propagation through a medium with phase masks applied
% at specified points. The inputs are
%
% - Uin - incident field.fieldin
% - lamb... |
cc396c651f0b575b7f41bae5647d72117d59711b5a9c488d84f8b67942731020 | MATLAB | 2,056 | 59 | % RollData.m
% Sarah West
% 4/12/22
function [parameters] = RollData(parameters)
% Display progress message to user.
MessageToUser('Rolling ', parameters);
% If the roll dimension is greater than the roll window plus 1 step
% (can get at least 1 roll out of it)
% Figure out how many rolls you ca... |
0818baa480eb855f19f0673c21933fc910ed17ad222e82f2c0d89e7a42d174ae | MATLAB | 2,058 | 50 | % AUTHORSHIP
% Primary Developer: Stephen Meehan <swmeehan@stanford.edu>
% Math Lead & Secondary Developer: Connor Meehan <connor.gw.meehan@gmail.com>
% Bioinformatics Lead: Wayne Moore <wmoore@stanford.edu>
% Provided by the Herzenberg Lab at Stanford University
% License: BSD 3 clause
%
function Insta... |
4d27f05916eacd1d961635697970681971a0f65a76754987eb7a12e1a4767d65 | MATLAB | 2,058 | 75 | function y = contract(x,i,j)
%CONTRACT Contract tensor along two dimensions (array trace).
%
% Y = CONTRACT(X,I,J) contracts the entries of X along dimensions I
% and J. Contraction is a generalization of matrix trace. In other
% words, the trace is performed along the two-dimensional slices
% defined by dimens... |
9a8eceb42451376a627de55442690e6139845ab3d31ca43b346b908cb7f4c4c2 | MATLAB | 2,058 | 61 | function [ele node new_elem_region new_node_region] = ...
call_improve_mesh_use_stellar(e, p)
% Check if mesh has region information
if size(e,2) > 4
region_ids = unique(e(:,5));
elseif size(e,2) == 4
region_ids = 1;
e(:,5) = ones(size(e,1),1);
else
error('Mesh needs to be tetrahedral.');
end
if min... |
da900484b59b27298720e85e636939c7991a1335132bb3aead4defb645f936b7 | MATLAB | 2,058 | 74 | function gr = lme_Gradient(X,Zcols,W,invH,L,phi,re,ni)
% gr = lme_Gradient(X,Zcols,W,invH,L,phi,re,ni)
%
% Gradient vector for the restricted log-likelihood.
%
% Input
% X: Ordered design Matrix (according to time for each subject).
% Zcols: Vector with the indices of the colums of X that will be considered
% as rando... |
5315c65a6c70c8f72166942179629578b7dd0faec72402b7322abcb702268e52 | MATLAB | 2,059 | 58 | function [output] = volumethreshold(input, thresh, str)
% VOLUMETHRESHOLD is a helper function for segmentations. It applies a
% relative threshold and subsequently looks for the largest connected part,
% thereby removing small blobs such as vitamine E capsules.
%
% See also VOLUMEFILLHOLES, VOLUMESMOOTH
if nargin<2... |
491919122b043cb628f459a7896de023e80142d02dadb95883381871b2537c1c | MATLAB | 2,060 | 67 | function [x, y] = generateSquarePoints(corners, numPoints)
% GENERATESQUAREPOINTS Generate points along the sides of a square
% Inputs:
% corners - 4x2 matrix of [x,y] coordinates of square corners in order
% numPoints - total number of points to generate (default 1000)
% Outputs:
% x, y - vectors... |
798f94eb88955279a354cc63a98aad5f3ac83b8a11a4c98a1c3b930701180224 | MATLAB | 2,060 | 57 | function [y,am]=anabpsk(N,Ncomp,f0);
%ANABPSK Binary Phase Shift Keying (BPSK) signal.
% [Y,AM]=ANABPSK(N,NCOMP,F0) returns a succession of complex
% sinusoids of NCOMP points each, with a normalized frequency F0 and
% an amplitude equal to -1 or +1, according to a discrete uniform
% law. Such signal is only 'quasi'-a... |
9f7204da3aa499dbbf5fa73cff62f90ccb2311fd3ecfb25510b09b4ea7f33a28 | MATLAB | 2,060 | 69 | %{
Copyright (c) 2025 Axion BioSystems, Inc.
Contact: support@axion-biosystems.com
All Rights Reserved
%}
classdef(Abstract = true) Entry < handle
%ENTRY base class for all Axion file entries
%
% EntryRecord: Record that indicated this recod in the file.
%
% Start: Location (#... |
e4873b9fd865e42832771bdf7479b451520cc9ccbd8491a26ab43d76b7cae203 | MATLAB | 2,060 | 69 |
function y_snle = snle(y, goodWires, varargin )
%
% usage: y_snle = snle( y, varargin )
%
% INPUTS:
% y - input data, m x n where m is the number of wires and n is the
% number of points
% goodWires - which wires have good data for which it is worth
% calculating the smoothed non-linear energy. This is... |
ea351efa416be8043ac131c1648c693b68403cba055a06a074a73ff9fb1fd54c | MATLAB | 2,060 | 55 | % concatenateVelocities.m
% Sarah West
% 10/12/21
% Takes 3- second behavior periods per mouse and saves them all in the same
% matrix.
function [] = concatenateVelocities(parameters)
% Give parameters their original names
mice_all = parameters.mice_all;
dir_exper = parameters.dir_exper;
digitNu... |
20f105a0eb9f39d1d63063edc8306097599d1b4d14214e98e4d323345cc7dd32 | MATLAB | 2,061 | 54 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This script corrects the obtained results for multiple comparisons using%
% the Benjamin and Hochberg approach %
% %
% Author: ana.tr... |
a31d381a09f591ca4744083ee36db3a3ebf66f8dc8486765673425e6e6a4d1d6 | MATLAB | 2,062 | 70 | % Wrapper for pca_apply that allows for application to large X.
%
% Wrapper for pca_apply that splits and processes X in parts, this may be
% useful if processing cannot be done fully in parallel because of memory
% constraints. See pca_apply for usage.
%
% USAGE
% same as pca_apply
%
% INPUTS
% same as pca_apply
%
%... |
b9c8be3c3ed879dd3bc7162410f18f66ac4cb3a0cd6936b7f02666ceff9c2a8e | MATLAB | 2,062 | 69 | %% NVR epoching around R-peaks and exclusion noisy epochs
% 2017 (edited 2018) by Felix Klotzsche
% 2024 update by Antonin Fourcade
function NVR_07_epoch(cropstyle, mov_cond, path_data, epoch_begin, epoch_end)
%% 1.Set Variables
%clc
%clear all
% if needed, set voltage threshold for epoch exclusion
% th_exclusion = 1... |
c82833fd61ec6ff2e885f6683f70569db9881a004d1640e9bde82ec00edfbd53 | MATLAB | 2,062 | 78 | function [rew,y1,y2] = runGame_2players(info1,info2,nt,stdx)
% simulate an interative game btw 2 players
% IN:
% - info1/info2: structures containing the following fields:
% .f_p: handle of evolution function
% .g_p: handle of observation function
% .theta: evolution params
% .phi: observation... |
d0dc34c182a9111f28b40b694528bea178bdd47f42619114e35503b56136e337 | MATLAB | 2,062 | 70 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% e1_prepare_raw_data_multi.m %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
raw_data_path = fullfile(dipole_folder, ...
strcat(patno,'_',model... |
7c6b243709dbb590a8d957b48fc59e7e8f87987abc0297b03cdeea4191ba7098 | MATLAB | 2,063 | 64 | disp(' ');
disp('fdct_wrapping_wavedemo.m - Curvelets propagating in vacuum');
disp(' ');
disp('A sum of two curvelets is taken as initial condition for the 2-D acoustic');
disp('initial-value problem in a uniform medium with speed of sound c = 1. The');
disp('domain is the periodized unit square [0,1]^2. The interplay... |
f68d51b835595d68b2c38adb082cd07724c97686cbb3d1d0f32cda65dbb970f9 | MATLAB | 2,063 | 68 | %% pxTools_splinePx
% Probability distributions behave poorly when there are values of 0 probability
% for states within the domain; spline existing probability columns to
% estimate what these experimentally un-observed values should be. Uses
% 'pchip' as a splining function
%
% Also compatible with the joint sd... |
ff0b319f172feb315f5c058a520c60fda7daf035ae98977d624d4eba8a65093f | MATLAB | 2,063 | 65 | function dG = GaussD(sigma, n, varargin)
% create an Nx1 Gaussian derivative kernel of std dev s
%
% dG = GaussD(sigma, n)
% dG = GaussD(sigma, n, dimension)
%
% the Gaussian is separable so we only need one dimension at a time
% n is the order of the derivative
% optional: dimension 1,2... |
2444d4141843613080aeda2cd31acee68f9f9c96f20719abd71299c875f14eff | MATLAB | 2,064 | 28 |
fprintf(1,'\nStereo calibration parameters:\n');
fprintf(1,'\n\nIntrinsic parameters of left camera:\n\n');
fprintf(1,'Focal Length: fc_left = [ %3.5f %3.5f ] ± [ %3.5f %3.5f ]\n',[fc_left;fc_left_error]);
fprintf(1,'Principal point: cc_left = [ %3.5f %3.5f ] ± [ %3.5f %3.5f ]\n',[cc_left;cc_l... |
4039c598e62999a2ff7968e98b16d7b6e35dd7acff8f40cbb2324b4d8e028bc6 | MATLAB | 2,064 | 61 | % SCE frequency
figure
[NRace] = extract_variables ('SCE',[],resultsPath,'NRace',[]);
[restEpochsIndex] = extract_variables ('mvm',[],resultsPath,'restEpochsIndex',[]);
[si_img] = extract_variables ('si_img',[],resultsPath,[],[]);
for recCounter = 1:size(NRace,2)
SCEfreq(recCounter) = NRace{recCounter}/(length(rest... |
4e1292f5a07f242b96f11e2c98714b0dfe52d252c0e61f294fb6c31fac870298 | MATLAB | 2,064 | 86 | %% Plot p(mu, sigma^2 | D) in 2d using an uninformative prior for different n
%
%%
% This file is from pmtk3.googlecode.com
function gaussInferMuSigmaDemo()
setSeed(1);
muTrue = 5; varTrue = 8;
X = randn(500,1)*sqrt(varTrue) + muTrue;
muRange = [0 10]; sigma2Range = [0.1 12];
npts = 100;
mus = linspace(muRange(1),... |
884ac88fb48d351300a45878fe09351c6d06c753b0787fa48ac87f91aa35ce83 | MATLAB | 2,065 | 93 | function [yi, xi] = downsample_scnlab(y, orig_samprate, new_samprate, varargin)
% Uses linear interpolation to resample a vector from one sampling
% rate to another
%
% :Usage:
% ::
%
% [yi, xi] = downsample_scnlab(y, orig_samprate, new_samprate, [doplot])
%
% :Inputs:
%
% **orig_samprate:**
% sampling rat... |
c6c7d043bc1b3ee09077d3fce8bf8373c760f09feb65cf7601fb605b8acb7e4c | MATLAB | 2,065 | 78 | %% Conditioning a 2D Gaussian
%
% Take a horizontal slice thru a 2d Gaussian and plot the resulting
% conditional
%%
% This file is from pmtk3.googlecode.com
fs = 12;
mu = [0 0]';
rho = 0.8;
S = [1 rho; rho 1];
figure;
subplot(1,3,1);
gaussPlot2d(mu, S, 'color', 'k');
axis equal
hold on;
[U,D] = eig(S);
sf= -2.5;
l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.