sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
31d479393b256d9cac20f5b787064898575b4e358f358cd88534cecd76df332c | MATLAB | 5,976 | 114 | %% 共空间模式 | common spatial patterns (CSP) 不可在main中调用,仅可单独使用
%% one vs rest Multiclass or two-classes 白化法
% how:N个类别得到N个投影矩阵,对每个投影矩阵取最佳的2m个方向(前后各m个),特征矩阵为2m*N维
% 优点:N类需要计算N个投影矩阵,即使N很大,计算量也不会很大
% 缺点:由于rest类别是混合类别,内部特征并不统一,因此很难找出最优的投影方向,即结果可能并不是最优的
% Inputs
% EEG_train: 训练集各类别的所有trials:
% EEG_train.x: EEG... |
6a81dd841908bafa13354579d702be6227d61707dbfc2637a302b23da3489b6b | MATLAB | 5,976 | 185 | classdef WaitBarWithCancel < handle
% Cancelable waitbar
%
% When using the builtin waitbar-with-CreateCancelBtn, the client must
% poll state set by the asynchronous cancel callback to determine if a
% cancel has occurred. WaitBarWithCancel incorporates this polling so it
% is automatically done at every update-how-mu... |
092ab1f5357f0dcb2c7acfbef100f92b64711508ad7be5d98a473d7ada8097c4 | MATLAB | 5,977 | 161 | function G_in = create_G_in(modelParam, network, ithEnv, isPFSim, varargin)
% G_in = create_G_in(modelParam, network, ithEnv, isPFSim)
%
% Creates a Poisson input conductance for either PF or preplay simulation.
%
% Inputs:
% - modelParam: Structure containing model parameters
% - network: Structure containing netw... |
5fb6aed088b4fc3f5c78cdbacb350a8d48ce3c737660f310519315ea051d5046 | MATLAB | 5,979 | 116 | classdef MFTSetEnum < MFTSet
% Some "canned" MFTSets
enumeration
CurrMovTgtEveryFrame (...
MovieIndexSetVariable.CurrMov,FrameSetVariable.AllFrm,...
FrameDecimationFixed.EveryFrame,TargetSetVariable.CurrTgt)
CurrMovTgtEveryLblFrame (...
MovieIndexSetVariable.CurrMov,FrameSetVariable.Lab... |
f535a6389eac1499330458466b152f137e27cb4409dc2eb1d4e02077930394b6 | MATLAB | 5,979 | 127 | function TSrenamefields(Lev,Old,New)
% Renames the fields at level Lev whose names are given in the 'Old' cell
% array with the new names given in the corresponding cells of the 'New'
% cell array. The Lev input must be one of the following strings:
% 'Experiment','Subject','Session','Trial' or 'Info'
%
% Syntax TSren... |
91a7d79efb7a8783d2f91b5ba97802000aab457657180bb855aebc1d9bb717f4 | MATLAB | 5,983 | 151 | function [] = plot_ground_truth_resampled(log_odd,option,method)
% Get index for PRE, RUN, POST
% states = [-1 0 1 2 3 4 5]; % sleepPRE, awakePRE, RUN T1, RUN T2, sleepPOST and awakePOST and multi-track
% states = [-1 0 1 2 3 4]; % sleepPRE, awakePRE, RUN T1, RUN T2, sleepPOST and awakePOST
states = [-1 0 1 2];
epo... |
30a8cd3efa5295dbbb369d579075139610268b0c3052296904d6659e395e3798 | MATLAB | 5,986 | 239 | function Mn = powermanifold(M, n)
% Returns a structure describing a power manifold M^n = M x M x ... x M.
%
% function Mn = powermanifold(M, n)
%
% Input: a manifold structure M and an integer n >= 1.
%
% Output: a manifold structure Mn representing M x ... x M (n copies of M)
% with the metric of M extended ... |
c4020b062527256488792edc6533ee09bba5a7e4815b28657b55a96542181f5d | MATLAB | 5,986 | 100 | % SPIKE COUNT FOR BAYESIAN DECODING
% INPUTS:
% place fields: matrix or []. Place fields that want to be used as a template in the decoding. If empty, it will load place fields for the whole session (extracted_place_fields_BAYESIAN.mat)
% start_time & end_time: single value, vector or []. Might want to enter start and ... |
fe9f8019af351e6347f4554715b5624fff2a566756e9ce883d59d6b349e6b905 | MATLAB | 5,986 | 162 | function Obj = SOFAupdateDimensions(Obj,varargin)
%SOFAupdateDimensions
% Obj = SOFAupdateDimensions(Obj) updates the dimensions in the SOFA
% structure
%
% Obj is a struct containing the data and meta.
% The dimension sizes are created as .API.X and updated corresponding to the
% conventions
% flag is 'nodat... |
84f0936cf0de3415fc46b9d3c8cc0fee31c458efb446801979088469b124b68c | MATLAB | 5,987 | 180 | function widgetAPI = createClimWindowOnAxes(hAx,clim,maxCounts)
%createClimWindowOnAxes Create draggable window in imcontrast tool
% widgetAPI = createClimWindowOnAxes(hAx,clim,maxCounts) creates a draggable
% window on the axes specified by the handle HAX.
%
% This is used by IMCONTRAST.
% Copyright 2005-2008... |
d07c3235120a56fc5596e58ce7a6b1d7569f6bf9bbe93bda592b6b58ee2921ce | MATLAB | 5,988 | 185 | % 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,... |
d75fe8792b764f04ad1470ddcf3cd1eb35266bfb1968f4a5997458fbde53f802 | MATLAB | 5,988 | 180 | function [warped]= individual2sn(P, input)
% INDIVIDUAL2SN warps the input coordinates (defined as Nx3 matrix) from
% individual headspace coordinates into normalised MNI coordinates, using the
% (inverse of the) warp parameters defined in the structure spmparams.
%
% this is code inspired by nutmeg and spm: nut_mri2m... |
a882aa02dd502956416cfda583c48624de03c3bc73d724f969930d33dbb014e1 | MATLAB | 5,992 | 258 | function [dist,PP0] = pointTriangleDistance(TRI,P)
% calculate distance between a point and a triangle in 3D
%
% Copyright (c) 2009, Gwendolyn Fischer
% All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are ... |
e27be8e8e589a4b4dc65a8066c403cd9beb1004bbec1b80e1b57dcdc9cb22dc1 | MATLAB | 5,992 | 182 | clc;clear all;close all;
load ADWT_fig1.mat
%% model
fps=30;
figure('Position',[100 100 500 150]);
subplot(1,2,1)
time=1:1200;time=time/30;
time_all=time;
ymean = AD.tm';
ystd= AD.ste;
plot(time_all,ymean,'-','linewidth',2,'Color',"b")
hold on
% h=fill([time_all,time_all(end:-1:1)],[ymean-ystd... |
dcabce673fb6d240115c6031638d8ac1af17b8c7602f1d6b4c2832c3dc81225a | MATLAB | 5,997 | 198 | function [nearest, distance] = find_nearest(pnt1, pnt2, npart, gridflag)
% FIND_NEAREST finds the nearest vertex in a cloud of points and
% does this efficiently for many target vertices at once (by means
% of partitioning).
%
% Use as
% [nearest, distance] = find_nearest(pnt1, pnt2, npart)
% Copyright (C) 2007, Ro... |
ce5b0296ba34ac622bcaf7deac37ef70f9c5ea2af30b01e9c347bf0a4861d052 | MATLAB | 5,998 | 246 | function [hfig,savenames] = PlotAPOverX(varargin)
[gtdata,nets,legendnames,colors,exptype,...
n_train,conddata,labeltypes,datatypes,...
statname,hfig,figpos,savedir,savenames,dosavefig,xl,savekey,logscaley,annfn,lw,extras] = ...
myparse_nocheck(varargin,'gtdata',[],...
'nets',{},'legendnames',{},'colors',[],'e... |
f1002dfbfb84d75431b246c0a68b0121525f9cb0f9de87cc168f6cb28b59bf98 | MATLAB | 5,999 | 148 | function Step2_ICA(config, pid, run_check_or_fix, visitnum)
% Step2_ICA will:
% 1) Carry out ICA on preprocessed data ("run")
% 2) Open the interactive component checker GUI ("check"), or
% 3) Backproject components to be removed and run channel repair ("fix")
%
% NOTES:
% - Check participants who... |
caa3b90d2e166b0ba710873e8e87785ea8e296da65405808abec5f6e49db5215 | MATLAB | 6,000 | 104 | %% Description
% This example is concerned with time-tagging of the photons. The
% time-of-flight is registered and binned when(if) the photon hits the
% detector, which in this demonstration is spatially-resolved in addition
% to time-resolved. Therefore, the output "image" is 3D, with two spatial
% dimensions and one... |
a7c381d551ffe1c5c02885cb2ae94e410cb6ecbc9191cd748ff0f292ff6983a5 | MATLAB | 6,001 | 151 | classdef RealtimeFeatureNNGraph < dspace_graphs.AbstractGraph
% k-NN-Graph based on a feature defined in the underlying datasource.
%
%
%
%<PRE>
% This file is part of dspace-core.
%
% Copyright (C) 2020 University Zurich, Sepp Kollmorgen
%
% This program is free software: yo... |
158003d45ab4b806296cc5b561b68af6a1a4fd09b821079b34b739c8241c4d77 | MATLAB | 6,003 | 138 | % GetStackList.m
% Sarah West
% 10/11/21
% Makes a list of stack file names within a day folder to use.
% Inputs:
% mouse- a character array; is the name/number of the mouse.
% day- a character array; is the name/date of the day
% parameters - is all the other parameters you're using in your pipeline,
% including t... |
d586bdfc2ed88823b00bf67471f68cf291bd1da15c88d0ac5e3db17e62291582 | MATLAB | 6,005 | 177 | % A color-mapping function for plotting the SDO matrix which sets the 0
% components to a standard white/translucent
% Because the negative components are always >= magnitude of (+), there
% needs to be a scale warping to result with zeros where expected.
%_______________________________________
% Copyright (C) 2024... |
aa47b56a29639d2a29da4c807f0d3f8b264d6e535b7329621cafb64e319a4dbc | MATLAB | 6,008 | 133 | % Fig 3E: LO delta Bandpower spared/impaired during ictal, postictal, late
% run DataAnalysis_V1_241017 with:
% AnimalID = 'Impairedsz',and 'Sparedsz'; HCstim = 'all'
% SavedFile\Impairedsz-all\DateTime\LODeltaBP.mat
% SavedFile\Sparedsz-all\DateTime\LODeltaBP.mat
%
% Fig 4E: LO delta Bandpower hit/miss during ictal
%... |
0b9b04a1c85d37854b8d825b34ec943b57361043ae492f2ea3378959284395f4 | MATLAB | 6,010 | 142 | %% Initialize some file locations
clear all;
%close all;
ssname='sub07';
data_dir='/home/amax/YZY/20220523data/sub07/session01/surfacedata';
%% 1back_GLM
outpath='/home/amax/YZY/20220523data/sub07/session01/GLManalysis/1back';
%% Set surface drawing function for GLMdenoisedata
% generally, this section is a copy-and... |
b0a0bcde38d9fe5f7347b1a7ebe047bb9bbd0cfa6b5bb8e3f8f10349a368b846 | MATLAB | 6,011 | 244 |
% load data
% contact Lead Author for data
%% plot distribution of correlation scores
figure
for n=1:length(c)
subplot(3,3,n);
[x,p]= ksdensity(c{n},'width',0.05);
hold on
plot(p,x,'k')
[x,p]= ksdensity(cs{n},'width',0.05);
hold on
plot(p,x,'k--')
[r1,p1]=kstest2(c{n},cs{n},'tail','larger');... |
2823129d58ca4e34e6b888361b2ec666ba7caf2f23df464a4e800c843bbb8242 | MATLAB | 6,014 | 200 | function [fx,dfdx,dfdp] = f_HRF2(Xt,P,ut,in)
% Balloon (HRF) model evolution function in log-space
% function [fx,dfdx,dfdp] = f_HRF2(Xt,P,ut,in)
% This function evaluates the evolution function derived from the balloon
% model for the hemodynamic response function. It can be called in two
% ways: (i) as a "stand-alone... |
74699fce61537d54974b8195330af5765368d51e82bf40bf2821a5902b0f481e | MATLAB | 6,016 | 125 | %% Description
% In this example, we show two things: The use of cyclic boundary
% conditions and how to calculate the reflectance of a sample, including
% how to provide an estimate of the statistical error of the value.
%
% The geometry is similar to that of example 1, although we will run it
% both with and without ... |
ce796555430c14824d98addefdb9e940ad51e60fa424109b21e6d862b0340d80 | MATLAB | 6,018 | 154 | %% Main lag script used to compute time delay matrix and lag projection
% Version 2:
% In this version, I modified the computation of probability flow
% projection map. The positive and negative value in the map will be
% normalized to 1, respectively.
%
% This script was orignally obtained from Github (https://g... |
65597e265a65419db376b0479a68f08c8d7a549b857947f6f9f282cb504a3198 | MATLAB | 6,020 | 160 | function ft_sourcewrite(cfg, source)
% FT_SOURCEWRITE exports source-reconstructed results to gifti or nifti format file.
% The appropriate output file depends on whether the source locations are described by
% on a cortically constrained sheet (gifti) or by a regular 3D lattice (nifti).
%
% Use as
% ft_sourcewrite(c... |
916d5a3c857d1bdf04dc9a64cd823dd3c22ed181e7142b597931feb0c57406b7 | MATLAB | 6,020 | 160 | function ft_sourcewrite(cfg, source)
% FT_SOURCEWRITE exports source-reconstructed results to gifti or nifti format file.
% The appropriate output file depends on whether the source locations are described by
% on a cortically constrained sheet (gifti) or by a regular 3D lattice (nifti).
%
% Use as
% ft_sourcewrite(c... |
ebda6d314e62265730e345f071428342700c64a54c384f25cf98fe41089a5e31 | MATLAB | 6,023 | 161 |
function extract_spikes_phy
rat= input('Rat name: ','s'); % J-GRE, J-BLA
date=input('Date and time: ','s'); % eg. 2017-08-17_15-22-00
session= input('Session (e.g.Day XX): ','s'); %Task, Sleep1, Sleep2 or Day XX
project=input('VC or HIPP: ','s');
if strcmp(project,'HIPP')
path= (sprintf('%s%s%s','X:\Bendorlab\Dr... |
317b1e9ab97d1fe61b19c84cb0581d6b5a53296786d7f938f2a3a8132b501662 | MATLAB | 6,024 | 142 | classdef ArgumentClinic < handle
properties(SetAccess=private)
fig;
app;
H;
argsObjs=cell(1,3);
jDlgClinics=cell(1,3);
end
methods
function this=ArgumentClinic
this.app=BasicMap.Global;
this.fig=Gui.NewFigure(true, 'off');
f... |
418151e2eaa07a71c4fb4f05d45534beae30b0e686c0f61beb855b49fbdd83a7 | MATLAB | 6,025 | 220 |
if ~exist('n_ima')|~exist('fc'),
fprintf(1,'No calibration data available.\n');
return;
end;
if ~exist('no_image'),
no_image = 0;
end;
if ~exist('est_alpha'),
est_alpha = 0;
end;
if ~exist('center_optim'),
center_optim = 1;
end;
if ~exist('est_aspect_ratio'),
est_aspect_ratio = 1;
end;
if ~e... |
2124d74584806a7b5c79a7e1f48a8ac02074ef1de0a8b84d547effb06ccae3ef | MATLAB | 6,026 | 154 | %% First level analysis, more contrasts, written by Jin Wang 3/15/2019
% All you need to do with this code is to comment out the lines from 97 to
% 155 from a typical firstlevel code (e.g. firstlevel_generate_bids_ELP.m).
% Then you can specify the new contrast you want. It will call
% more_contrast.m code which will ... |
26aaffbb1bebbdd52c9f6c6509233a032f654b8e7ea241dd46f1abce3e31fec1 | MATLAB | 6,028 | 154 | %% Main lag script used to compute time delay matrix and lag projection
% Version 2:
% In this version, I modified the computation of probability flow
% projection map. The positive and negative value in the map will be
% normalized to 1, respectively.
%
% This script was orignally obtained from Github (https://g... |
910685285dd9fabf6aab310df7b30dac48c56eccbf7d0424a80a71bb5d385084 | MATLAB | 6,028 | 154 | %% First level analysis, more contrasts, written by Jin Wang 3/15/2019
% All you need to do with this code is to comment out the lines from 97 to
% 155 from a typical firstlevel code (e.g. firstlevel_generate_bids_ELP.m).
% Then you can specify the new contrast you want. It will call
% more_contrast.m code which will ... |
fa5da6be7a87545486215ce83eb890f695492b13e4b4f48b5e56c0f6893ed23b | MATLAB | 6,030 | 200 | function [Mean_MMT_Shoulder] = Muscle_Moment_G8(x)
% MATLAB code provided by Seyed Mohammad Ali Rahmati
% Affiliation: Biomechanics and Motor Control Lab, Department of Biological Sciences, Georgia Institute of Technology, Atlanta, GA.
% This script computes the maximum muscle moment averaged over the cycle as a funct... |
249960da80c7e96c004af28366e93c54051040f98a1a1dcafc472fe8df0c57c8 | MATLAB | 6,032 | 175 | % note: change current folder to figure "number"
clear all;close all;clc;
rawPath=pwd; %displays the current working directory - set it to the figure "number"
savePath=rawPath;
addpath Panels/
addpath Functions/
load("CellIDs_features_width900_Population_All")
load("colors")
%% Figure 3
dataPath = [rawPath,'/Panels'... |
09e8adb86bc0f4257f77d28fc07fefe0c96a944323af27901e196b79543f5c81 | MATLAB | 6,036 | 155 | %{
Copyright (c) 2025 Axion BioSystems, Inc.
Contact: support@axion-biosystems.com
All Rights Reserved
%}
classdef ContinuousBlockVectorHeaderEntry < CombinedBlockVectorHeaderEntry
%CONTINUOUSBLOCKVECTORHEADERENTRY Summary of this class goes here
% Detailed explanation goes here
properties(Ge... |
944a1c4adaed17934bb13871f4e9b09a14e04b09b1390b0faa1a08d697d246bf | MATLAB | 6,036 | 143 | function [ALFFBrain, fALFFBrain, GHeader] = y_alff_falff_Surf(InFile,ASamplePeriod, HighCutoff, LowCutoff, AMaskFilename, AResultFilename, CUTNUMBER)
% Use ALFF method to compute the brain and return a ALFF brain map which reflects the "energy" of the voxels' BOLD signal
% Ref: Zang, Y.F., He, Y., Zhu, C.Z., Cao, Q.J... |
9cf072fd242ce042ed15bea29690cf1397df50040e375752e6e2c09fa3d640fa | MATLAB | 6,037 | 209 | function [Mean_MMT_Elbow] = Muscle_Moment_G2(x)
% MATLAB code provided by Seyed Mohammad Ali Rahmati
% Affiliation: Biomechanics and Motor Control Lab, Department of Biological Sciences, Georgia Institute of Technology, Atlanta, GA.
% This script computes the maximum muscle moment averaged over the cycle as a function... |
ad6208d35fff9e4d40d2cebf4207d98f8a4e493400ef9a4aa2301709530ef383 | MATLAB | 6,038 | 184 | function varargout=wt(d,varargin)
%% Continous Wavelet Transform
% Creates a figure of wavelet power in units of
% normalized variance.
%
% USAGE: [wave,period,scale,coi,sig95]=wt(d[,params])
%
% d: a time series
% wave: the wavelet transform of d
% period: a vector of "Fourier" periods associated with wave
% scale: a... |
accb98cbcc7408c3ff4c351b934c06ef554f35d8902c7fd193e2dcd9ea2ef3be | MATLAB | 6,041 | 145 | function [lh_proj_data, rh_proj_data] = CBIG_RF_projectColin2fsaverage(input, interp, lh_map, rh_map)
% Usage: [lh_proj_data, rh_proj_data] = CBIG_RF_ProjectColin2fsaverage(input, interp, lh_map, rh_map)
%
% This function projects an input volume to fsaverage.
%
% -----------
% DEFINITIONS
% -----------
% Input argume... |
bf17c23dff7c23fdf5a41085f554baee0cc0372981a991b40daf3effb4a7bbf5 | MATLAB | 6,043 | 220 |
if ~exist('n_ima')|~exist('fc'),
fprintf(1,'No calibration data available.\n');
return;
end;
if ~exist('no_image'),
no_image = 0;
end;
if ~exist('est_alpha'),
est_alpha = 0;
end;
if ~exist('center_optim'),
center_optim = 1;
end;
if ~exist('est_aspect_ratio'),
est_aspect_ratio = 1;
end;
if ~e... |
57ad59096230504df8080783028d1695d7a7f6461bb5157788ae96d050db0dda | MATLAB | 6,047 | 96 | %%combine and analyze novel aligned data
%Chad Heer
%INPUTS
%Analysis_out = output of axon_analysis for all sessions
%above_SNR_thresh = ids of axons above threshold
%SNR_thresh = SNR threshold
%OUTPUTS
function[normalized_novel_aligned_F_smooth, combined_novel_aligned_Fc, combined_novel_aligned_F_good_beh, combin... |
aac83c36976594d0ae27fc9d89b89f9a79868e5c1bc07a6cb2e8f016f3c66164 | MATLAB | 6,048 | 166 | function ie_cube(n,occ,p,rank_or_tol,method)
% IE_CUBE An example usage of strong skeletonization, solving a
% first-kind integral equation (Laplace single-layer potential) on the
% unit cube. Sane defaults are provided for all parameters.
%
% IE_CUBE(N,OCC,P,RANK_OR_TOL,SKIP,METHOD) runs the example on a regular... |
5d55da2cfaf340b361694edff191de6766417b818d2d32a6b965fb229ddbbdbe | MATLAB | 6,051 | 168 | function h_f = plotMediaProperties(nFig,model)
h_f = figure(nFig);
set(h_f,'WindowStyle','Docked');
clf reset;
h_f.Color = 'w';
cmap = colormap(lines);
G = model.G;
T = NaN([G.nx G.ny G.nz],'single');
T(:) = model.HS.T; % model.HS.T may be scalar or 3D
FD = NaN([G.nx G.ny G.nz],'single');
FD(:) = ... |
9c956eabaffa1000e3bff2ef9c36572a9cd4138b4f91c1d62e12bb7425e75ec3 | MATLAB | 6,051 | 192 | function [DCM,err] = VBA_spm_dcm_clone(DCM0,VOIfnames,SPMfname,DCMfname,Unames,Ynames)
% clones an existing DCM structure and replaces appropriate data and inputs
% function [DCM] = VBA_spm_dcm_clone(DCM0,VOIfnames,SPMfname,DCMfname,Unames,Ynames)
% IN:
% - DCM0: original DCM structure to be cloned
% - VOIfnames: c... |
43449de38eac6e2a02d5de454646c84cca1352d6c4f5690610254ebc9638bfe1 | MATLAB | 6,053 | 164 | function [ titleStr, settings, results ] = DBScanOnCurrentSelection( dataview, settings )
% Clustering of selected datapoints in the given feature space using
% <a href="matlab:web('https://en.wikipedia.org/wiki/DBSCAN', '-browser')">DBScan</a>.
%
% Use for up to ~30k datapoints.
%
% The p... |
4dbc33e047f8ae8da3f1caed3807d7b8ba6bde2b79b1c997c316143a96bd9f80 | MATLAB | 6,054 | 148 | function varargout = see_replay(varargin)
% SEE_REPLAY MATLAB code for see_replay.fig
% SEE_REPLAY, by itself, creates a new SEE_REPLAY or raises the existing
% singleton*.
%
% H = SEE_REPLAY returns the handle to a new SEE_REPLAY or the handle to
% the existing singleton*.
%
% SEE_REPLAY('CALL... |
0766bdc79874150f8b7634126b31cb3946839cd18e46a390a304ef879373801e | MATLAB | 6,055 | 238 | function Gradient_Visualization(Result, OutDir, opts)
% =========================================================
% OUTPUT DIR (GUI SAFE)
% =========================================================
if iscell(OutDir)
OutDir = OutDir{1};
end
OutDir = char(string(OutDir));
if ~exist(OutDir,'dir')
mkdir(OutDir);
... |
1867ae1dfda8faa01c526703f2b13b842c7f6b55602f1fff0d995a41d27e0745 | MATLAB | 6,057 | 121 | % Several examples for using StructDlg
%%
% Note: The values the user enters to the dialog box for numeric fields are being 'eval'-uated,
% so inputs such as (sin(0.34)+2)^my_func(34.2) are possible.
% The field's numeric limits can be displayed by placing the mouse over the field.
%
%
% Free Strings: Limited to one l... |
d9c67183cbd34a7bd782bf864615ffff0d65a9aac3ff8aba1340149fedd648c5 | MATLAB | 6,057 | 180 | function vocoded_x=vocoder(x, rate, nchan, cutoff , vocoder_type, verbose)
% Implementation of cochlear implant simulation, referred to as vocoder.
% The first argument is the signal.
% The second argument is the sampling rate (preferred 16Khz)
% The third argument is the number of spectral channels between 2 and 9.
% ... |
ef174eb686b23d11243bb5daff62f75b4880b5c0d00fa85c2490c58e65a62098 | MATLAB | 6,059 | 235 | function [xc,good,bad,type] = cornerfinder_saddle_point(xt,I,wintx,winty,wx2,wy2);
%[xc] = cornerfinder_saddle_point(xt,I,wintx,winty);
%
%Finds the sub-pixel corners on the image I with initial guess xt
%xt and xc are 2xN matrices. The first component is the x coordinate
%(horizontal) and the second component is the ... |
eac95c5bff77f17ee469e4b243b5108d85f73ff0fda4990b89101fbfe66c0e69 | MATLAB | 6,061 | 221 | function [stats,st,a] = lme_mass_RgFSfit(X,Zcols,Y,ni,Dist,model,prs,e)
% [stats,st,a] = lme_mass_RgFSfit(X,Zcols,Y,ni,Dist,model,prs,e)
%
% Linear mixed-effects estimation by the Fisher scoring algorithm for a
% whole region.
%
% Input
% X: Ordered (according to time for each subject) design matrix (nmxp, nm
% total... |
bc1f4aa63dd3379748518bae21384a71c4c6b0e021eb5820f57b05212676467f | MATLAB | 6,065 | 153 | function ExportToPlx(spkDat, plxFile)
[wL, nChan, ~] = size(spkDat.waves);
pk = spkDat.peakLoc;
wP = spkDat.wavePad;
wL = wL - 2*wP;
pts = (1:wL) + wP;
Fs = spkDat.Fs * spkDat.upsample;
spkDat.waves = spkDat.waves(pts,:,:);
% delete any repeated timestamps
[~, ia] = unique(spkDat.ts);
repeatTs = unique(spkDat.ts(setd... |
baf998e4938cc12cf5608dade313ee124fa301605e0047346ef7966a8617e60a | MATLAB | 6,069 | 141 | function [success,S,el]= initEyeTracker(windowID,S,runID)
%EYETRACKERINIT Initialise Eyetracker Parameters
% Usage: [ success ] = eyeTrackerInit( windowID , S , runID );
%
% Inputs:
% : windowID - ID of the current window as returned by
% Screen('OpenWindow')
% : S - struct cont... |
a37178a44f399e88164fa35390a845d2d54ee6c4611e660808b180833e2226f9 | MATLAB | 6,076 | 150 | function trialAll = ActiveProcess_3_6Dur(epocs, choiceWin)
narginchk(1, 2);
if nargin < 2
choiceWin = [0, 600];
end
%% Information extraction
trialOnsetIndex = find(epocs.num0.data == 1);
trialOnsetTimeAll = epocs.num0.onset(trialOnsetIndex) * 1000; % ms
soundOnsetTimeA... |
45ae5a208012bd0a119dfd6a8dfe6f0ba02ebd9e16883ade3f4b56afd37aa119 | MATLAB | 6,079 | 142 | function lan_master_gui_ldev(LAN_var, mainfig, parent_)
LAN = LAN_var;
if nargin < 2
mainfig = figure;
end
figure(mainfig);
File = ''; Path = '';
cfg_control(1) = uicontrol('style', 'text', 'units', 'norm', 'position', [.04 .92 .2 .05],...
'string', 'full path : ', 'horizontalalignment', 'right');
cfg_control... |
8c279b1299806d48bacc550a7ca8b74599bc2ca911536dd22e9100e7ddfa82c7 | MATLAB | 6,081 | 196 | function palm_miscwrite(varargin)
% Write various scalar data formats based on the struct X.
%
% palm_miscwrite(X);
%
% See 'palm_miscread.m' for a description of the contents of X.
%
% _____________________________________
% Anderson M. Winkler
% FMRIB / University of Oxford
% Aug/2013
% http://brainder.org
% - - -... |
f1103c041b62ecc514d0dcf6560d47a63639a35db3a3f0f6c34ed974ff4f4f6b | MATLAB | 6,081 | 186 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% [mriImg] = ctf_svl_mriReslice(mriFile, xVoxels, yVoxels, zVoxels, svlResolution, xmin, xmax, ymin, ymax, zmin, zmax, interp_method)
%%
%% reads and reslices CTF MRI (.mri) file to match a corresponding .svl image
%% and saves the MRI in A... |
6db6df2322f219bf6d35388865489bc215a52ea8ba20a8240f1eea227befdae8 | MATLAB | 6,082 | 122 | function [ vcontribs ] = electrodesContributions( M, subjstructs, kernel, param, cutoff)
%ELECTRODESCONTRIBUTIONS Compute the coefficients of activated vertices.
%
% Computes contribution values of subject electrode grids at affected brain
% model vertices (those vertices that are near the electrodes as spec... |
ca15e56d9b2daaa87b112044dd82f0cc65067326b454bd75cb6855d221a7caf4 | MATLAB | 6,083 | 95 | function [fx,dF_dX,dF_dTheta] = ERP_dcm(x,Theta,u,in)
% neural mass evolution function (DCM for ERPs)
% function [fx,dF_dX,dF_dTheta,d2F_dXdTheta] =
% ERP_dcm(Xt,Theta,ut,in)
%
% This function ouputs the state-transition associated with the
% 5-populations neural mass microcolumn:
% - 2 inhibitory populations in the ... |
a6b26cbda1289d87cd7acf58495bac0a1f4ba0dce2b674be7becad533f8cff96 | MATLAB | 6,085 | 191 | function [spectrum] = specest_nanfft(dat, time, varargin)
% SPECEST_NANFFT computes a fast Fourier transform in the presence of NaNs
% in the data
%
% Use as
% [spectrum] = specest_nanfft(dat, ...)
% where
% dat = matrix of chan*sample
% time = vector, containing time in seconds for each sample
% spec... |
4feacc00a9a32c8c7f39f236b32d6bdaff543c70ef5f33901f49130972a64672 | MATLAB | 6,089 | 159 | % Five-point stencil on the unit square, constant-coefficient Poisson equation,
% Dirichlet boundary conditions.
%
% This example solves the Poisson equation on the unit square with Dirichlet
% boundary conditions. The system is discretized using the standard five-point
% stencil; the resulting matrix is square, real, ... |
9c94efbc31012a9d49d6ff3be54aa3a1d60aaa2657cae41a0d3590e64e5b0419 | MATLAB | 6,089 | 232 | %%% INPUT THE IMAGE FILE NAME:
if ~exist('fc')|~exist('cc')|~exist('kc')|~exist('alpha_c'),
fprintf(1,'No intrinsic camera parameters available.\n');
return;
end;
KK = [fc(1) alpha_c*fc(1) cc(1);0 fc(2) cc(2) ; 0 0 1];
disp('Program that undistorts images');
disp('The intrinsic camera parameters are assumed to... |
c2f81a653ca39d3a6318b1cd031589d4c20b011f3080e97889c32aadc3d9e80f | MATLAB | 6,094 | 171 | classdef BgClient < handle
% The BgClient is responsible for launching the polling loop via parfeval(), and
% communicating with the resulting process. But when it receives a message
% from the background process about a new poll result, it simply passes it on
% to its parent BgMonitor.
properties
polle... |
c2596fd8d62355a47f14706ac39516f87152da77235467cfab9842dc9a53edbd | MATLAB | 6,095 | 141 | function [A] = boundary_attenuation(n_incidence, varargin)
% BOUNDARY_ATTENUATION returns attenuation of photon fluence rate on a
% boundary as caused by the mismatch in refractive indexes.
%
% SYNTAX:
% [A] = BOUNDARY_ATTENUATION(N_INCIDENCE)
% [A] = BOUNDARY_ATTENUATION(N_INCIDENCE,METHOD)
% [A] = BOUNDARY_ATTE... |
0de22136372417ab4bada673d0cf852c077bd0d7d642883ee7da6d6386b58846 | MATLAB | 6,096 | 198 | function [kernels] = VBA_getVolterraKernels(posterior,out,nt)
% Estimation of the system's 1st-order Volterra kernels
% function [my,vy,mg,vg,mx,vx] = VBA_getVolterraKernels(posterior,out)
% IN:
% - posterior,out: the output of the VBA system inversion. Note that the
% Volterra kernels are estimated given the input... |
ac744703df745a488d53b08ecb0da96d8dc44e46625192760639546d69eb36e9 | MATLAB | 6,097 | 205 | function bootstrapping_onsets_rsa(within,across,diff)
% set parameters
bootstrap_samples = 1000;
chance = 0;
% input data
data_W = within(:,11:110);
data_W_base=within(:,:);
data_X= across(:,11:110);
data_X_base=across(:,:);
data_D = diff(:,11:110);
data_D_base=diff(:,:);
%% bootstrapping
rng('shuffle')
for bs... |
5ad70c9200212be5b6575067b07731f0b303bf2ec0956ec1ee1d19f2a66120ef | MATLAB | 6,098 | 150 | function [s, cfg] = ft_statfun_actvsblT(cfg, dat, design)
% FT_STATFUN_ACTVSBLT calculates the activation-versus-baseline T-statistic on the
% biological data (the dependent variable), using the information on the independent
% variable (ivar) in design.
%
% Note that it does not make sense to use this test statistic ... |
91e2815791c29aedc72870ccf963c77645cbcdb8061ab9c476e36723e36f7812 | MATLAB | 6,098 | 150 | function [SNR_overall,SNR_synapses,nsynapses] = analyze_mExR_validation_strip(fov,params)
% Analyzes validation data, with same proteins stained in consecutive rounds
% Outputs
% SNR: the overall image SNR in each round for each channel
% SNR_synapses: the SNR for each synapse over each round
% nsynapses: the number o... |
ddd9f70dadc0553a3d40a503b05a2a84ecd3bb180e81d32f5a2d99acc7de221f | MATLAB | 6,101 | 147 | function Step4a_FrequencyAnalysis(config, pid, visitnum)
% Step4a_FrequencyAnalysis uses spectral analysis on time-frequency
% representations of data to test hypotheses based on spectral power.
% The virtual sensor data from the beamforming step is loaded in and
% frequency analysis is performed on sliding timewin... |
cde454c1404099f947e04212a95d00a0d1b06203e84ae903c2e3b71058696de2 | MATLAB | 6,102 | 168 | % Covariance matrix on the unit square, squared exponential kernel.
%
% This is essentially the 2D version of COV_LINE1.
%
% Inputs (defaults are used if not provided or set empty):
%
% - N: number of points in each dimension (default: N = 128)
% - OCC: tree occupancy parameter (default: OCC = 64)
% - P: square r... |
7b3d11423c8ac9e3b6fee96b3f52ffd57913fbf6877988ee163532b5d24c568a | MATLAB | 6,103 | 189 | function [Xbest,idx,totalcost,poslambda] = ...
ChooseBestTrajectory(X,appearancecost,varargin)
% Select trajectory through CPR-generated replicate clouds
%
% X: [DxTxK] full CPR tracking results
% appearancecost: [TxK] scalar cost for each shape
%
% Xbest: [DxT] selected replicates representing "best" traj
% idx: [T... |
a2512281795058edd4a78c41d27e1d6db0237fe64949de13d187be35f99d8d4b | MATLAB | 6,105 | 143 | function [OutputBins UnSortedEntries]=CustomBinning(InputVals,BinEdges)
%Use Bin Edge of NaN to automatically include or Inf to include anyting that is not 0
if ~iscell(BinEdges)
NumEntries=size(InputVals,2);
NumBins=size(BinEdges,2)-1;
NumCats=size(BinEdges,1);
OutputB... |
d11f9c4d5d2d48cbe95fe600e927714b58590c4cfc6106231a9872baceffa0dd | MATLAB | 6,105 | 207 | function [out1,out2,out3] = ginput2(arg1)
%GINPUT Graphical input from mouse.
% [X,Y] = GINPUT(N) gets N points from the current axes and returns
% the X- and Y-coordinates in length N vectors X and Y. The cursor
% can be positioned using a mouse (or by using the Arrow Keys on some
% systems). Data points a... |
c60a6eef364212cc86f97382e966a5889e4091325ef09ad8280b7a5597b36147 | MATLAB | 6,110 | 213 | function [vert, face] = read_ply(fn)
% READ_PLY reads triangles, tetraheders or hexaheders from a Stanford *.ply file
%
% Use as
% [vert, face, prop, face_prop] = read_ply(filename)
%
% Documentation is provided on
% http://paulbourke.net/dataformats/ply/
% http://en.wikipedia.org/wiki/PLY_(file_format)
%
% See ... |
d127dd0215fb952267f44dcb01ce0b1e5a2769c5342b978c9865051080968a30 | MATLAB | 6,111 | 138 | %% Imports
addpath("HelperFunctions")
load(fullfile(DataPath, "ForceEquivMulti.mat")) % Mech amp est
load(fullfile(DataPath, "AmpDiscrimMultiChanRaw")) % multi chan discrim
load(fullfile(DataPath, "ForceEquiv_UC.mat")) % Mech amp est
SetFont('Arial', 9)
pow_fun = fittype('a*(x+o)^b');
lin_fun = fittype('m*x+c');
forc... |
98745b8926637cefd58d94e2e97bcd92c480d4a36e8394458ecbe4f8d35ad6cd | MATLAB | 6,114 | 142 | % note: change current folder to figure "number"
clear all;close all;clc;
rawPath=pwd; %displays the current working directory - set it to the figure "number"
savePath=rawPath;
addpath Panels/
addpath Functions/
load("MovingBars_DifferentSpeeds_Population_All")
load('colors.mat')
beta_colors=[-0.85 -0.5 0.1 0.6];
be... |
935a9ab00c49b2a1f1b4b78af848a1df4c7a2dcf908374d69fa371074c826007 | MATLAB | 6,117 | 179 | function [Results]=SUA_BasicAnalysis(AllTrialData,Phase,unit,timeWindow,opts)
%%(AllTrialData,Phase,unit,timeWindow,opts)
% unit=[1 57 1];
% Phase='Go1';
% timeWindow=[.5 1];
% opts.BaselinePhase='CueTarget'
if iscell(opts.BaselinePhase)
cTrialDataBaseLine=Analyze.SubSelectTrials(AllTrialData,opts.BaselinePhas... |
fb8a43a3200a32e20d65b90d2a3f617da281fb2aeab2a574f05c1e00904511d9 | MATLAB | 6,117 | 170 | % Better Stitcher v 1.01, released 2021 0326
% An improved version of the wably stitcher done by YTW in YK lab
% UPDATE: 20220201 Multiple Input Option added by FK
%
% Takes input as the full path to a .csv sheet with all settings
% and stitches one sample after another
clear
close all
%% USER INPUT %%%... |
e1e18a0659e20b74130dc1536fe9514b4df6e085bd46ee4f4bfa837e0ba285c5 | MATLAB | 6,120 | 105 | %% 共空间模式 | common spatial patterns (CSP) 不可在main中调用,仅可单独使用
%% one vs one Multiclass or two-classes 白化法
% how:N个类别中任意两个做CSP,共得到CN2=N*(N-1)/2个投影矩阵,对每个投影矩阵取最佳的2m个方向(前后各m个),特征矩阵为2m*N*(N-1)/2=m*N*(N-1)维
% 优点:每次计算CSP投影矩阵时,2个类别都是单纯的类别,更容易找到两类差别最大的投影方向
% 缺点:N类需要计算CN2个投影矩阵,N很大时,计算量会大大增加
% Inputs
% EEG_train: 训练集各类别的所有tri... |
9021c025321ef5e97ab09590bbdd1a9a090e9a90532fd804d4ed13469c3ef228 | MATLAB | 6,123 | 193 | %% plot_staPxt (STIRPD)
% Common Plotter for the spike-triggered averaged probability(x,t)
% [Spike-triggered Inpulse Response Probability Distribution - STIRPD]
%
% Essentially a heatmap of discrete state by discrete time bin around
% spike; useful for interpretting the SDO and predicting if there will be
% significan... |
9ff46817556b0d920f053c4e19f83c76e3aeb727cee596737845fd29ecefbec2 | MATLAB | 6,125 | 216 | function h = CBIG_DrawSurfaceMaps(lh_data, rh_data, ...
mesh_name, surf_type, min_thresh, max_thresh, colors)
% h = CBIG_DrawSurfaceMaps(lh_data, rh_data, mesh_name, ...
% surf_type, min_thresh, max_thresh, colors)
%
% This function visualizes a given surface data in freesurfer space.
% Threshold can be define... |
e0dd316bd93e0132be51aacc414c161f7b29709812b4980e22caacc3543380d6 | MATLAB | 6,127 | 202 | function [configuration] = ft_documentationconfiguration(filename)
% FT_DOCUMENTATIONCONFIGURATION is a helper function to maintain the online
% documentation of all configuration options.
%
% Normal users will not be calling this function, but will rather look at
% http://www.fieldtriptoolboxorg/reference/configurati... |
2994ff4d4b460b35716dd3c18cfe27df919686858c4547eac6fdfc495c7ce8d1 | MATLAB | 6,129 | 174 | function [collect] = ft_channelcombination(channelcmb, datachannel, includeauto, dirflag)
% FT_CHANNELCOMBINATION creates a cell-array with combinations of EEG/MEG
% channels for subsequent cross-spectral-density and coherence analysis
%
% You should specify channel combinations as a two-column cell-array,
% cfg.cha... |
3b9c02cdb824b759a0aed62b3e70fd9b20dc24d050bfd0fe034d595665652537 | MATLAB | 6,129 | 187 | %%% cutoff_planes.m
%%% helper script to determine angles and offsets of the cutoff planes
%% clear and load engine
restoredefaultpath;
clear all;
addpath('Engine');
%% define subject variables
subject = '110411'; % MODIFY ACCORDING TO THE SUBJECT!!
mesh_folder = fullfile('data');
SKIN_file = fullfile(mesh_folder,s... |
b05e93d87f1025070b654712cde77af1ef8443e31d6021b7f6c826afbe24d30f | MATLAB | 6,129 | 211 | function ie_fmm3dbie(ik,npu,norder)
% IE_SPHERE An example usage of strong skeletonization, solving a
% second-kind integral equation (Helmholtz combined field potential) on a
% wiggly torus
%
% - OCC: The occupancy parameter, specifying the maximum number of
% points a node in the octree c... |
a3a7ed7e8e0b4f349d3ba33bca539725f56b409cc24a5251d7ecca9f07a7edbb | MATLAB | 6,131 | 174 | function [collect] = ft_channelcombination(channelcmb, datachannel, includeauto, dirflag)
% FT_CHANNELCOMBINATION creates a cell-array with combinations of EEG/MEG
% channels for subsequent cross-spectral-density and coherence analysis
%
% You should specify channel combinations as a two-column cell array,
% cfg.cha... |
697b7b5e348500afe289cb473c7117f64ab48a981fbaa219bc73e5f3894d8dba | MATLAB | 6,133 | 172 |
%Load the set of all pixels of all puncta across all rounds from the
filename_pixels = sprintf(fullfile(params.punctaSubvolumeDir,sprintf('%s_punctavoxels.mat',params.FILE_BASENAME)));
load(filename_pixels)
fprintf('Loaded.\n');
%This is the size of the cropped images, corresponding to ~15um pre-ExM
filename_punct... |
ed16f1451e6d9383e5eac12445b20408b1f34363f1d4520fb55080c99fec5bc1 | MATLAB | 6,135 | 183 | function [ROI_mean, ROI_mean_temp, output_all, image_sum, total_volumes, vol_per_file] = analysis_by_stack_v4 (file_list_to_load, file_size, flcount, parameter_name, noise_threshold)
load(parameter_name)
image_sum = zeros(pixel, pixel, channel, sliceNum);
%variables for image registration
usfac = 1;
total_frames ... |
48c2a60896bf84b03c86c9c619355dd6c8fb585b7fa48e236a672e66a6ff798b | MATLAB | 6,136 | 151 | function [C, log] = SOFAmerge(A,B)
%SOFAmerge
% [C, log] = SOFAmerge(A,B) merges the SOFA objects A and B to a single one, C.
%
% A and B are structs containing the data and meta. A and B
% must be of the same SOFA conventions.
%
% C is a struct containing merged data
% log contains log data
% SOFA API - fu... |
17024d77ae50f30094782712009b8b2fb044713e73578b0bf3b84de4d661c8e5 | MATLAB | 6,138 | 137 | function forest = forestTrain( data, hs, varargin )
% Train random forest classifier.
%
% Dimensions:
% M - number trees
% F - number features
% N - number input vectors
% H - number classes
%
% USAGE
% forest = forestTrain( data, hs, [varargin] )
%
% INPUTS
% data - [NxF] N length F feature vectors
% hs ... |
451531118418407732154ea9857a7de213468551c0f187b2a2a13f4dc61b063c | MATLAB | 6,138 | 182 | function handles = VBA_displayGroupBMCbtw(ep,out)
% displays group-level BMC between-conditions analysis results
% function handles = VBA_displayGroupBMCbtw(ep,out)
% IN:
% - ep/out: output structures of VBA_groupBMbtwC.m
% OUT:
% - handles: structure containing the handles of the graphical objects
[nm,ns,nc] =... |
b71adcc3a57a676ca51b9abee3da18d8fc9911576f0b4621c007c4d01137bffb | MATLAB | 6,138 | 168 | % Covariance matrix on the unit square, Matern 3/2 kernel.
%
% This is basically the same as COV_SQUARE1 but using the Matern 3/2 kernel.
%
% Inputs (defaults are used if not provided or set empty):
%
% - N: number of points in each dimension (default: N = 128)
% - OCC: tree occupancy parameter (default: OCC = 64)
... |
3c000a2af51d1c1cfe054c5e41f57f3fbe3cb59ed571b91c094565c7fe58a579 | MATLAB | 6,140 | 164 | function [posterior, out, summary] = demo_sources ()
% // VBA toolbox //////////////////////////////////////////////////////////
%
% [posterior, out] = demo_sources ()
% Demo of observation distribution specification
%
% This demo shows how to simulate and invert models having different, and
% possibly multiple, data ... |
a326dff992510988a874f8ec0986170f8705c0124245da0373a2a9bfb0f9ab51 | MATLAB | 6,140 | 171 | function [] = linfieldsPlaceFields(linfields, network, modelParam, varargin)
% plots.linfieldsPlaceFields(linfields, network, modelParam)
%
% Plots the place fields in the linfields structure
%
% Inputs:
% - linfields: linear place field cell array matching Jadhav lab
% structure
% - PFpeaksSequence: PFpeaksS... |
3992983f78f05ed7990be04a8c63e9cdccccfce75a36c08fa0d0a52095fdb10d | MATLAB | 6,141 | 171 | function mrf = mrfCreate(G, varargin)
%% Create a markov random field
% G is undirected graph, (an adjacency matrix) representing the node
% topology. Currently the interface only accepts potentials
% on nodes and edges, however support for general
% clique potentials may be added later.
%% Named Inputs
%
% 'nodePots' ... |
6719a0b495c64f12d4a8abc7bc930b0a0a1d63c13a961a6de2a2e709aab07c6a | MATLAB | 6,141 | 149 | clear;clc;close
rdfile='Data_exp1.xlsx'; % File for reading data
rdrange='A3:N642'; % Range for reading data
wrfile='Results_exp1.xlsx'; % File for writing results
wrsheet = 'Each participant'; % Sheet for writing results
wrrange1='E2'; % Range for writing TSs
wrrange2='E4'; % Range for writing results
n... |
9e1f115cdb4352aa4c822a3a538e62c17d15c17f586aa1b217a08344ba163298 | MATLAB | 6,142 | 157 | %% ----------------------------------------
% PCA analyses on LIP single-trial data
%% ----------------------------------------
%% Load data
load(fullfile(saveLoc, 'par_sess'))
%% Generate across trial averages and repeat PCA
corr = 1; addRL = 0;
preCut = 100; tic
par = par_sess{1};
par.tsl = round(par.t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.