sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
056e9fc9761b535ac2245eae06af7f0d6bc34b8cc5ac3765898b2ed8fc63698d
MATLAB
3,780
86
function Points = Find_Distance_From_Midline(Points,Axes,Scale_Factor,Step) % This function computes the signed distance of each point from the midline. % Dorsal is defined as positive distance and ventral as negative. % The midline points are given from head to tail. % Step=1 indicates that the other axes (besid...
fa5e4ffe032072e6b61490f80bfd7acb764182608c93431cb21c3393948f99e8
MATLAB
3,783
83
function [tapers,pad,Fs,fpass,err,trialave,params]=getparams(params) % Helper function to convert structure params to variables used by the % various routines - also performs checks to ensure that parameters are % defined; returns default values if they are not defined. % % Usage: [tapers,pad,Fs,fpass,err,trialave,para...
f4f170813e556003e2842ea7cc6f6bf191761ee7b3063d67775bbe77cc7436f2
MATLAB
3,785
121
function result = savepathonly(outputfile) %SAVEPATHONLY Save the current MATLAB path to the file pathdef.m % % SAVEPATHONLY saves the current MATLAB path to the current pathdef.m file. % % SAVEPATHONLY(OUTPUTFILE) saves the current MATLAB path to the % file specified by OUTPUTFILE. % % This is essentially a pa...
5e1bd7154fc217458b6f682607b5ee97663854319be287d518c165c4e9426c01
MATLAB
3,786
136
[cols,alpha] = chooseColors; %% plot removal from time dependent decoders for config = 1:4 figure('Position',[100 100 300 300]) hold on % set lims and labels xlim([0 21]) set(gca,'XTick',[0 5 10 15 20]) set(gca,'XTickLabel',-3:1) xlabel('Time (s)') ylabel('Accuracy (%)') % indi...
8d543601aa082f6a10c7da566feecc970e37ef5755319f7558ac3de4919d758d
MATLAB
3,786
130
function [inspk] = wave_features(spikes,par) %Calculates the spike features scales = par.scales; feature = par.features; nspk = size(spikes,1); ls = size(spikes,2); if strcmp(par.max_inputs,'all') par.max_inputs = ls; elseif par.max_inputs < 1 par.max_inputs = ceil(par.max_inputs*ls); end % CALCULATES FEATURE...
db6715d9760df5523ee9364c355082b35c95d7a5e9922e9a0a9c9f2f8fc7a575
MATLAB
3,786
92
function [y_med, y_mean] = ecg_den_wavelet(x, varargin) % ecg_den_wavelet - A wavelet-based ECG denoiser using majority voting or % averaging between multiple wavelet denoising configurations. % % Syntax: % [y_med, y_mean] = ecg_den_wavelet(x) % [y_med, y_mean] = ecg_den_wavelet(x, params) % % Inputs: % x: Matr...
4c80682577801dadfcae61ab2ef4cbf2964a993b522642e290b3d3644e08b4bd
MATLAB
3,790
130
function [Cell]=mnl_CalculateSomaValues(Cell,Scale,cData,BkgMean) %% Step 1 - Get the voxels involved in each soma dim=size(cData); Scount=size(Cell,2); for i=1:Scount NumPoints=size(Cell(i).dxyz,1); for j=1:NumPoints %Convert the surface points to voxels dxyz(j,1)=round(Cell(i).dxyz(j,1)); ...
dd7d5615d5160afc22b9f79f5921c9f3105963a56bae13139581ef09b57140c0
MATLAB
3,791
113
function structGAM=pyGAM2struct(pGAM) stats=struct(pGAM.statistics_); stats.pseudo_r2=struct(stats.pseudo_r2); % stats.cov=double(stats.cov); stats.GCV=[]; stats.cov=[]; stats.edof_per_coef=[];%struct(stats.edof_per_coef); stats.m_features=int64(stats.m_features); stats.n_samples=int64(stats.n_samples); stats....
e09d8aba64a301267ca4303421d2d8f27a57011862c5184eae3f33e15e453efb
MATLAB
3,792
130
function [s_cap,n_regions] = eq_caps(dim,N) %EQ_CAPS Partition a sphere into to nested spherical caps % %Syntax % [s_cap,n_regions] = eq_caps(dim,N); % %Description % [S_CAP,N_REGIONS] = EQ_CAPS(dim,N) does the following: % 1) partitions the unit sphere S^dim into a list of spherical caps of % increasing colatitude ...
3f2b9d04f9dd5f7133aad97938f908c6f8a7de35d298d5787883cee84692b896
MATLAB
3,793
143
function xlswritefig(hFig,filename,sheetname,xlcell) % XLSWRITEFIG Write a MATLAB figure to an Excel spreadsheet % % xlswritefig(hFig,filename,sheetname,xlcell) % % All inputs are optional: % % hFig: Handle to MATLAB figure. If empty, current figure is % exported % filename (string) Nam...
991685bf654e7a937befc8bf2945b55c90c85d09bc57f04c5b8657afde56ac07
MATLAB
3,794
139
% Simulated scatter plots and ICA % clear; close all; a = 2; b = 2; % t = asin(1/b) + [0:.01:18*pi 0]; % t = asin(1/b) + [0:.01:2*pi 0]; t = 0:.01:20*pi; N = length(t); r = a * (1-b*sin(t));% + .2*randn(1,length(t)); [x,y] = pol2cart(t,r); z = 2*cos(t); % z = t/10; A0 = [-1 1 -2; 1 1 1; -.2 1 1]; x...
3810acf5f13595daebbc371d8d37a99607d2ac459207d3e574af0b9f7ab9a269
MATLAB
3,796
100
function varargout = wave_clus_aux1(varargin) % WAVE_CLUS_AUX1 M-file for wave_clus_aux.fig % WAVE_CLUS_AUX, by itself, creates a new WAVE_CLUS_AUX or raises the existing % singleton*. % % H = WAVE_CLUS_AUX returns the handle to a new WAVE_CLUS_AUX or the handle to % the existing singleton*. % % ...
377a86a18e34c5eef7d9b817a9376c39d21296efe4345e28f6fcf06f135af5f8
MATLAB
3,797
111
% Control script to get info on bursts occurance in time relative to single % peaks (Hung / Bernardi method). clear clc % close all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Parameters P = analysisParameters(); Participants = P.Participants; Sessions = P.Sessions; Paths = P.Pat...
1e1bb70a25e386c4cf8cf0d90bc65b09bf7a3e7ca3fc4bc2d6e5ba5b4207adb9
MATLAB
3,799
137
function ha = plotFitPars(fitPars,t,climsXYZ,climsRTP,isVertical) % function ha = plotFitPars(fitPars,t,climsXYZ,climsRTP,isVertical) % % 16/3/16 - Added a little trick so that 'isVertical' can also be of the % form [handle1 handle2] for the two subplots to plot into % % 16/6/23 - New hack so that if 'isVertical' is a ...
e9f58cb170e7d967631ee03ae22e1f5850b086d34c330d6874e1c618c14b0ef8
MATLAB
3,799
100
function varargout = wave_clus_aux2(varargin) % WAVE_CLUS_AUX1 M-file for wave_clus_aux.fig % WAVE_CLUS_AUX, by itself, creates a new WAVE_CLUS_AUX or raises the existing % singleton*. % % H = WAVE_CLUS_AUX returns the handle to a new WAVE_CLUS_AUX or the handle to % the existing singleton*. % % ...
c94512c14e26dde12061265db21921cde09e48944140a437d941895da4e44671
MATLAB
3,800
100
function varargout = wave_clus_aux5(varargin) % WAVE_CLUS_AUX1 M-file for wave_clus_aux.fig % WAVE_CLUS_AUX, by itself, creates a new WAVE_CLUS_AUX or raises the existing % singleton*. % % H = WAVE_CLUS_AUX returns the handle to a new WAVE_CLUS_AUX or the handle to % the existing singleton*. % % ...
772d2e507e1d694ba6d415791a9759d251f8f1238984d16f3497a076e3780609
MATLAB
3,801
127
function hb_res = hb_det_2(varargin)%ecg, threshold, inverse, bp, use_bp) %HB_DET_2 Summary of this function goes here % Detailed explanation goes here ecg = varargin{1}; threshold = varargin{2}; inverse = varargin{3}; if length(varargin) > 3 bp = varargin{4}; use_bp = varargin{5}; if isempty(bp) ...
8374fcbfccf6244fc8e7e37683e7d58f6ebeeba85f5186e4353f16231c5fdd05
MATLAB
3,801
100
function varargout = wave_clus_aux4(varargin) % WAVE_CLUS_AUX1 M-file for wave_clus_aux.fig % WAVE_CLUS_AUX, by itself, creates a new WAVE_CLUS_AUX or raises the existing % singleton*. % % H = WAVE_CLUS_AUX returns the handle to a new WAVE_CLUS_AUX or the handle to % the existing singleton*. % % ...
c900b3af9f13a1d16d15fee5c3217b8019ba883d1243f593dcb4d0a33732641c
MATLAB
3,801
100
function varargout = wave_clus_aux3(varargin) % WAVE_CLUS_AUX1 M-file for wave_clus_aux.fig % WAVE_CLUS_AUX, by itself, creates a new WAVE_CLUS_AUX or raises the existing % singleton*. % % H = WAVE_CLUS_AUX returns the handle to a new WAVE_CLUS_AUX or the handle to % the existing singleton*. % % ...
1827c2918df8dbfcc30e0c08a07a37321c027390be03aec1620d2b83e520f291
MATLAB
3,802
96
function Bursts = detect_bursts(EEGBroadband, ChannelIndex, EEGNarrowbands,... NarrowbandRanges, CriteriaSets, KeepTimepoints) arguments EEGBroadband struct ChannelIndex (1,1) {mustBeInteger, mustBePositive} EEGNarrowbands struct NarrowbandRanges struct CriteriaSets struct KeepTimepoints = o...
e6f385a97ae589975d321d7bc15ad43cf6ddd19884a60e5d48242f1a3c5d8da7
MATLAB
3,803
100
function E=efficiency_wei(Gw,local) %EFFICIENCY_WEI Global efficiency, local efficiency. % % Eglob = efficiency_wei(Gw); % Eloc = efficiency_wei(Gw,1); % % The global efficiency is the average of inverse shortest path length, % and is inversely related to the characteristic path length. % % The ...
572005ab9599002efb685d7aa8987c4caa748fcc0cf27399b0b9573debc05a1c
MATLAB
3,804
84
function [lead_fields,UnitMDip] = Forward_OPM_single_sphere_XYZ_dir(x,y,z,slots_all,normal_unit,sphere_origin) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% mean_sphere_origin = sphere_origin; %% number of channels Nch = size(slots_all,1); %% voxel position in CTF and in metres vox_pos_ctf...
f02086f2d1e711b1ac338960ecd0ee56ff66f2da568790a12994d8d5171951f4
MATLAB
3,805
93
clear clc %% % Needs to be in D:\Data\IR data Shira_May_14_2022 windows = {40:50, 40:60, 40:45, 40:55, 65:125, 75:125, 85:125, 95:125, 100:130, 140:150, 140:160, 140:155}; relevant_windows = [1, 5, 10]; win = ["early"; "steady"; "off"]; [file, path] = uigetfile('*.mat','MultiSelect','on');%When the user clicks the lo...
3937ed28a57b09c9f263d09c8184b8983137e7dd02c96c5be9aabb83eced5ad5
MATLAB
3,807
118
function Y = timelag(X,lags,time_window) % Take an input matrix, X, and create multiple time-lagged versions of the % the matrix. % % Parameters: % X: matrix % A matrix of size (M x C) where M is the number of samples % and where C is the number of channels % lags: vector % A vector of length L wher...
d806b9619bace806897c54d1e8642dc349a85a7d6bb3a41aa95c59f0b53b5b3b
MATLAB
3,807
154
function [AAAt_ECGpeak222 AAAt_BPfoot222 AAAt_footIndex222]=riallinea_BP_ECG_v04(AAAt_ECGpeak,AAAt_BPfoot,AAAt_footIndex) % figure AAAt_ECGpeak1=unique(AAAt_ECGpeak); AAAt_BPfoot1=unique(AAAt_BPfoot); AAAt_footIndex1=unique(AAAt_footIndex); if AAAt_BPfoot1(1)>AAAt_ECGpeak1(2) AAAt_ECGpeak1(1)=[]; end imin3=dif...
0d6121e3b38a0d3734d66f3a46fb2cd7c11b5453d9803a7b204c62251f8572e9
MATLAB
3,811
89
function MSN20200107 global dpath3 % % trimtfile=strtrim(tfile); Old=cd; cd(dpath3) LS=ls; for i=1:length(LS(:,1)) % Sc#_SS_##.t@ƒtƒ@ƒCƒ‹‚ð‰ñ‚· trimFL=strtrim(LS(i,:)); if length(trimFL)>4 && strcmp(trimFL(end-1:end),'.t'); trimtfile=strtrim(trimFL); nttfile=[trimtfile(1:3),'.nt...
8f223414cf3c88f18538de057d36866e65b639e4b81d6e443cd353fefff35854
MATLAB
3,811
111
% "example_nufft1_reverse.m" % This m-file is an example of applying the NUFFT method "in reverse," % meaning that you have a nonuniformly-sampled signal spectrum in hand % and you want to try to "compute its inverse Fourier transform" % to get uniform set of signal samples. In the nomenclature of the 1999 % SIAM J Sc...
a602aecb7d6fce1b7970be46bd0b43f3fc602be615a78932d8f156d4a6b25aa3
MATLAB
3,811
109
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Software developed by Javier Lucas-Romero % July 2023 % This is the master script for the execution of ASTA3. % The purpose of this software is to provide a user-friendly tool to % classify the different firing patt...
99e8cc05851004cb77f724e216033228d8825f8278c137372cdaaa9d20094e4c
MATLAB
3,813
130
function [Cell]=mnl_CalculateSomaValues_v2(Cell,Scale,cData,BkgMean) %% Step 1 - Get the voxels involved in each soma dim=size(cData); Scount=size(Cell,2); for i=1:Scount NumPoints=size(Cell(i).dxyz,1); for j=1:NumPoints %Convert the surface points to voxels dxyz(j,1)=round(Cell(i).dxyz(j,1)); ...
6cb29cf69d83daa240977d11b5bf25c0a76203b362f931ded24cd51d527e041c
MATLAB
3,814
110
function ThreePhaseSpike320190516 %¶‘«‚̃^ƒbƒ`‚̊Ԃ̂ǂ±‚ʼnEƒ^ƒbƒ`‚ª‚ ‚Á‚½‚©Ì¶‘«‚̃^ƒbƒ`ŠÔ‚łǂ±‚ŃXƒpƒCƒN‚ª‚ ‚Á‚½‚© % global cd('C:\Users\C238\Desktop\CheetahWRLV20180729\119\2017-6-7_20-8-33 11901-51'); dpath=('C:\Users\C238\Desktop\CheetahWRLV20180729\119\2017-6-7_20-8-33 11901-51\'); dpath3=('C:\Users\C2...
7ac5a1d0439d41af3f26809e2925cfefc67a650ea0162fe4b6b2f8adee2e23db
MATLAB
3,814
106
function CV=carspls_mccv(X,y,A,N,method,num,selectLV,originalVersion) %+++ Cross validation of CARS, at each iteration, CARS is run on sub-training % data and tested on the lef-out test samples. Repeat N times, and % record the times each variable is selected, say z. So the selection % frequency can then be c...
8b900ef3e0701aa1694702828bfef7d9f7314505a035bc02d828e71d17658e2f
MATLAB
3,815
114
%% Plotting States Colors ********************************************* % Requeriment: % Plot Raster % Input % % labels_frames: Ensemble Labels in each frame % signif_frames: Significative Coactivity Frames % ColorState: Color of The Ensembles % Experiment: Raster Concatenated and Ensemble Sorted % fs...
97c82310a19a181020c6c2c9d275bb57f80a8a145a4bbbc0577487db90cec122
MATLAB
3,816
107
clear clc %% % Needs to be in D:\Data\IR data Shira_May_14_2022 [file, path] = uigetfile('*.mat','MultiSelect','on');%When the user clicks the load psetion button, a window should open to enable the user to select a file. cd(path) datafile = fullfile(path, file); %save path for i = 1:length(datafile) load(datafile...
80b7b029cf88671dfcbf904e572f50c25a70b031255096da189257e626bc088d
MATLAB
3,825
72
% Computes the metastatic mass via a first order quadrature % Growth PT follows model growth_model_PT (with parameters param_PT) % Growth of Mets follows model growth_model_met (with parameter set param) % flagNb = 0 or 1 depending on whether we want the number of mets to be % computed or not % Model is designed to be...
2d1b6b928c844a76c995923eadb6432533093f50957309aadd5e86ed9049088f
MATLAB
3,830
94
function [FD,RMS,FD_outliers,RMS_outliers] = spmup_FD(varargin) % simple routine that computes framewise displacement as a sum (FD) and RMS % Power et al. (2012) doi:10.1016/j.neuroimage.2011.10.018 % Power et al. (2014) doi:10.1016/j.neuroimage.2013.08.048 % % FORMAT: [FD,RMS,FD_outliers,RMS_outliers] = spmup_FD %...
5c4edf6da5605d30ff1d68738e7556504fdce7d2d4a3b833b3c59a06d800e140
MATLAB
3,830
166
clear all close all sigma=0.5; Veq=-76.72; Vth=-39.51; Vr=-41.70; tau=11.85; Vsp=-20; R=118.5; C=0.098; tau_Ref=0.1; P=10; taus=20; epsilon=0.02; Areward=0.9; Apostpre=1; Aprepost=-1; N_pres=1000; dt=0.1; % Coeffs=1; PLOTS=1; % ncoeffs=50; % Coeffs=linspace(0.11,7,ncoeffs); Coeff=3/7; wmax=0.2; wmin=0; %%%% ...
adf552db8b9b383a714a5f6bc36a2c775115d22d2915104dca11f6e2427db191
MATLAB
3,834
96
function layers = backward(layers, params) n = numel(layers); batchsize = size(layers{1}.a, 4); for l = n : -1 : 1 if strcmp(layers{l}.type, 'c') || strcmp(layers{l}.type, 'f') if strcmp(layers{l}.function, 'soft') % for softmax if (~strcmp(params.lossfun, 'logreg')) layers{l}.d = softder(layers{l...
c8ca6772d405e5ab89a068247d70fc10c9b1f4918ff328cafe914fb917d3ea1d
MATLAB
3,839
107
% function [mrFet12_, viSpk12_, n1_, n2_, viiSpk12_ord_] = fet12_site_(trFet_spk, S0, P, iSite, vlRedo_spk) function [siteFeatures, spikes, n1, n2, spikeOrder] = getSiteFeatures(spikeFeatures, site, spikeData, hCfg) %GETSITEFEATURES Get features occurring on primary and secondary (optionally tertiary) sites [si...
82256fa703715c062dc6ebb46a5270de36a231742778ba9854a753e99e105d36
MATLAB
3,840
99
function [y, W, A, B, C, lambda] = nonstationary_component_analysis(x, I, J, varargin) % nonstationary_component_analysis - Nonstationary Component Analysis (NSCA) % algorithm to extract temporal nonstationarities from multichannel data % % Usage: % [y, W, A, B, C, lambda] = nonstationary_component_analysis(x,...
7ea52a749685c632eff4e9ddbfdb2c6191cfb9cba51468b431a7bd821c7bf73b
MATLAB
3,841
102
function MakeMultimerNet_Group20160520 %MakeMultimerProb20160517.m(Exp=5‚̏ꍇj %MakeMultimerProb20160526.miExp=10‚̏ꍇj %‚É‚æ‚èˆê’v”‚²‚ƂɃtƒ@ƒCƒ‹‚ðì¬ %‚»‚ê‚ð—p‚¢‚ÄMultimerConProbAllƒtƒ@ƒCƒ‹‚ðì¬‚·‚éBMatching10–œ‰ñ‚ÌŒ‹‡”‚ª•Û‘¶‚³‚ê‚éB %MakeMultimerNet_Group20160520.m‚Ńlƒbƒgƒ[ƒNì¬ %ˆâ“`Žq”­Œ»—...
ff3b8553f3945a852e1267092aee0aa5e28da41fa4457f24ef99d6d81a13e7c8
MATLAB
3,845
112
% This script saves time series per subject per region of interest (ROI) % into a file called `subject_region_timeseries.csv`. % % The stimulation protocol can be found in the `.tsv` files, in the `func` % folder of the raw data. % % The stimulation parameters are: % % TODO: check this because the length is either s...
e74343c1444b80c3a71db14e5d164b014dac7641450a2352e949e14dcd9a0386
MATLAB
3,847
105
% Test script for SpatioTemporalInnovationsFilterDesigner, which estimates an innovations filter from ensembles of multichannel random % processes. % % The Open-Source Electrophysiological Toolbox (OSET) % https://github.com/alphanumericslab/OSET % Reza Sameni, Feb 2023 close all clear clc case_study = 'EEG'; % 'EEG'...
191a5e833603c0a68df2906ce9654398a9765ac26c3cb360bcfcf1cded76aecc
MATLAB
3,848
95
clc clear [file, path] = uigetfile('*.mat','MultiSelect','on');%When the user clicks the load psetion button, a window should open to enable the user to select a file. cd(path) datafile = fullfile(path, file); %save path %% windows = {40:50,65:125,140:150}; all_sugnificnt_cells = []; all_p_val = []; for z = 1:length(wi...
7b7f736916ff4e4a95d77cf456eee4a22708c097f3b6a944eb42238255203986
MATLAB
3,849
97
clear all close all clc constants; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Load parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% import_data; import_covariates; folder_fit = './fit_PT_met_SAEM'; [param_inds, param_ind_d] = compute_param_inds(...
3dccc7042cf9e0f6a3a2ac82aa0d583e510e23302271a444d01ddda6f7c7b39f
MATLAB
3,850
98
function Data = Classify_PVD_Points(Data,Clusters_Struct) % TODO: move to parameters file: X_Min_Max = [-2,2]; Y_Min_Max = [-1,1]; XFunc = @(x) rescale(x,X_Min_Max(1),X_Min_Max(2),'InputMin',-pi/2,'InputMax',pi/2); YFunc = @(y) rescale(y,Y_Min_Max(1),Y_Min_Max(2),'InputMin',0,'InputMax',pi/2); Classific...
7ec0b312ad0765a0b4fc052da4c5e2b236f0b16df259a7ded313ff37ed1cb7d1
MATLAB
3,855
105
close all clear clc % Convert all dat files in bash using this command: find ./*/ -type f -execdir wfdb2mat -r {} \; % datafilepath = '../../../../DataFiles/physionet.org/files/ptbdb/1.0.0/'; % directory_list = dir([datafilepath 'patient*']); % % filelist = dir(fullfile([datafilepath, '**/*lr*.mat'])); % get list o...
188db4d23d2e6a2fa125a8b8f38488d8d68bd50387ce01ec93c14e1458de33e6
MATLAB
3,857
135
function varargout = stlreadNonCleaning(file) % STLREAD imports geometry from an STL file into MATLAB. % FV = STLREAD(FILENAME) imports triangular faces from the ASCII or binary % STL file idicated by FILENAME, and returns the patch struct FV, with fields % 'faces' and 'vertices'. % % [F,V] = STLREAD(FILENA...
ca2b2adffc17dbe8b96213d07efa5a94935e4bea8efe4fef0551642ef2ffc828
MATLAB
3,858
104
%% caculate parameters from all data (baseline) clear clc ploting =1 ; window = 2; %(on, sus, off) sus_window = 65:125; %% [file, path] = uigetfile('*.mat','MultiSelect','on');%When the user clicks the load psetion button, a window should open to enable the user to select a file. cd(path) datafile = fullfile(path, file...
b1e374b8839a33b66e02930dbdd3ef3003c902b319025d2ab77c1be570d40717
MATLAB
3,859
143
% read .COORD file and plot data % PGH Oct 2001 function lcmodelresults=readcoord(filename) % define output structure for results %lcmodelresults=struct('spectrumppm',0,'spectrumdata',0,'spectrumfit',0,'spectrumbasl',0,'metabconc',0,'linewidth',0,'SN',0); %lcmodelresults.metabconc=struct('name',0,'relconc',0,'abscon...
3cecfe54dc13385a31d742691a4dcf93d7c7982011734e7362805e04dd232713
MATLAB
3,865
137
function SpikeArray1=GetSpikeAll(dpath,fname) global StartTime FinishTime dpath3 % StartTime % FinishTime DurationB=FinishTime-StartTime; CurrentPath=pwd; % cd C:\Users\B133\Desktop\WR_LVdata\6721_160218 % load 6721_160218.mat % % % cd C:\Users\B133\Desktop\CheetahData %dpath='C:\Documents and Settin...
372a756cb4f4cb9596b7050d3c21f455cae7cd700ee4ba60edfade3a80ecf089
MATLAB
3,867
143
function [a r phi zm] = circ_plot(alpha, format, formats, varargin) % % r = circ_plot(alpha, ...) % Plotting routines for circular data. % % Input: % alpha sample of angles in radians % [format specifies style of plot % pretty, histogram, density, [] % [formats standard matlab stri...
e49c57e9c37d93bd5120a40466b928949077156143bce846d741a7a8de6d2caf
MATLAB
3,869
96
%% Figure 4A load(fullfile(pwd, 'stat', 'Figure4A.mat')) addpath(genpath(fullfile(pwd, 'plotting'))) colors = [[0, 0, 0]; [1, 0, 0]]; boxplot_pairwise(Rin, colors); %% Figure 4C load(fullfile(pwd, 'stat', 'Figure4C.mat')) ft = fittype('d+b/(1+exp(-(x-a)/k))', 'independent', 'x'); curves{1} = fit([2:8]', mean(spike_prop...
1c9cb30cf6729f1867821c87a65da1904684c09079a663765056f480fd2fc617
MATLAB
3,873
105
function stat_PERMS_MSPoI_Mikael(ResPath,atlas,NodeName,savepath) % Concatenate permutations atlas_name = atlas; numper = 10000; numruns = 50; Pval = []; Pair_diff_pos = {}; Pair_diff_neg = {}; Dissidents = {}; for reg = 1:3 TS_all = []; D_pos = []; D_neg = []; Diss = []...
cc0bd8591163bf3e2e2ca219061277b1e733621e3658a8450cc103f788835eee
MATLAB
3,875
134
% - use joint results and apply to single session % - rerun preprocessing without lowpass filter and compare % - define circle around centroid % - define cell area using threshold % - take cell out of circle -> ring % - correlate ring vs. cell (original / thresholded) %% clear p = params_2DAA; saveFig = 1; data_path...
4df3b26eb2c0bbdf18d5d6f06bc6d955d47ae62f2b983e7424fa0c78f20ac805
MATLAB
3,876
100
%{ ---------------------------------------------------------------------------- Analyzing behavioral data At least for the correct rate ---------------------------------------------------------------------------- %} function Figure2d_Dual_RL_analysis_220314_para_all_220909_2 close all analysis_folder = { ...
a28dd98de62274d59cc90481bb16853fc99c370ca1678c71d57e4d0f868f8009
MATLAB
3,876
103
function [weights, trainerr] = cnntrain_norm_mat(layers, weights, train_x, train_y, params) params = setparams(params); assert(length(layers) == 3); assert(length(weights) == 3); layers{1} = cnnsetup(layers{1}, 0); layers{1} = setweights(layers{1}, weights{1}); layers{2} = cnnsetup(layers{2}, 0); layers{3} = cnnset...
44ad8b6d3efa7d6b978a35be5cde7886201f8e713e08520b833fae1900bb1595
MATLAB
3,878
109
function splitDat(totalChan,timeWin,chan2pull,Fs,memToUse) %splitDat - Split Dat Files % % Usage: % splitDat(totalChan,timeWin,chan2pull,Fs,memToUse) % splitDat(totalChan,{},chan2pull,Fs,memToUse) - If splitting channels over entire recording % splitDat(totalChan,{t,'end'},chan2pull,Fs,memToUs...
4d79b4a14949c5b2c9f0d99b4dfc9cf8747566c5d4286948c06b522e74f5b426
MATLAB
3,879
129
%% Figure 2 plots clear all close all %read raw data por_data = xlsread('POR_data.xlsx','B2:AA23'); [~,odor_data] = xlsread('POR_data.xlsx','B25:AA46'); [~,gender_data] = xlsread('POR_data.xlsx','B47:AA47'); odors = {'hex','hex01','hex10','iaa','2oct','ani','hxa','gua','bza',... 'cit','neem','gar','chex','l...
a11d40549735b7db72e687ae469121be121ea99817b67de785197f318841bf4b
MATLAB
3,882
85
function [data] = createDataStruct(wsData,animalName,expDate) %%Create Data Structure from WaveSurfer to MAT function % % [data] = createDataStruct(wsData,animalName,expDate) % % Description: This file takes a data structure generated from the % extractH5_WS function and it organizes the acquired traces int...
c4ef6fc5658194839b80f91fcadd7895b93fa2d974e4b81b8b568cda716e0b56
MATLAB
3,883
91
% This script demonstrates how the burst detection works for multiple % channels. clear clc close all %% load the EEG data load("C:\Users\colas\Code\Matcycle\example_data\EEGbroadband.mat", "EEGbroadband") % EEG data needs to be a structure with fields "data" (channels x time % array), "srate" (sampling rate), and...
5fa31f03e4e0b2629dd8f36d884e95ce6570860fc0e1c7be208d136e189c441a
MATLAB
3,884
125
close all; clear; clc; resultfname = 'testICASubspaceAngles02.txt'; % parameters subject = {'Dog_1', 'Dog_2', 'Dog_3', 'Dog_4', 'Dog_5', 'Patient_1', 'Patient_2'}; f0 = 60; % powerline frequency Hz Q = 30; % notch filter Q-factor % wlen = [0.5 1.0 3.0 5.0 10.0]; % energy window lengths in seconds drop = 200; % remove ...
a7793542ef00777255f9fc71be55ee769a2fb207c4aa46c79e547556e63610c5
MATLAB
3,890
85
%% Process Parameters for Photometry Analysis %Created By: Pratik Mistry %Created On: 31 January 2019 %Edited On: 26 September 2019 % %Description: This is a script with different variables whose values can be %adjusted depending on the photometry signal that is being processed. The %name of this file can and sh...
56b0bebaf1772a99eec810a37f5a41b8cc2597ee8705787d5eee8ccf63d7f021
MATLAB
3,891
129
function hb_res = hb_det_2(varargin)%ecg, threshold, inverse, bp, use_bp) %HB_DET_2 Summary of this function goes here % Detailed explanation goes here ecg = varargin{1}; threshold = varargin{2}; inverse = varargin{3}; if length(varargin) > 3 bp = varargin{4}; use_bp = varargin{5}; if isempty(bp) ...
7f4f9444bf1689614245f46060e8f754bafa0b853095f971b828c0175dde2e9b
MATLAB
3,891
138
clear clc close all Info = analysisParameters(); Paths = Info.Paths; Bands = Info.Narrowbands; BandLabels = fieldnames(Bands); %%%% Choose a file %%%% %%%% Task = 'PVT'; % Game, Standing, Fixation Session = 'Session2Beam'; Participant = 'P04'; % P03 has almost no oscillations, P15 has tons %%%% %%%% %%%% Source = fu...
55f4db5cea841ffa53451d877b264cadbbfe0a8dd01bb179ac5db9845f3af301
MATLAB
3,892
92
% Rockland dataset % http://fcon_1000.projects.nitrc.org/indi/enhanced/ % % Data contains TR 645 and TR 1400 acquisitions using a ON/OFF checkerboard protocol. This is a subset (50) % of participants, the full dataset has hundreds of participants and lots of different scan modalities / experimental tasks. %% Set Pat...
47804b240498c3a7918a44444718bac13757832127f5e653f2335dd8885026ee
MATLAB
3,894
161
function [mov rest start_end_mov peaks_mov start_end_rest peaks_rest locs amp_mov ]=movrestepoch(TrackingData) %% % This function processes tracking data (assumes sampling rate 60 Hz) to extract movement and resting epochs. % The function returns various statistics related to the movement and resting data. % mov= mo...
f4097fd3c59e814b68f9cfc30c4a8c286764c53d363041a6d6015dddc833ca0c
MATLAB
3,894
111
% Using eyetracking data, identify when participants had eyes open or % closed. clear clc close all %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% load in and set parameters for analysis Tasks = {'PVT', 'LAT'}; RerunAnalysis = true; PupilDetectionMethodType = '2d c++'; % either 2D or...
ce04bc926bba434b6511427957bef63b93e6832969608eca0884568d728a79a1
MATLAB
3,896
110
function [lambda, AIC, MDL, NEW, ENSTh, ENS, fhand] = dimension_estimation(x, noisevar, varargin) % Estimates the dimensions of the signal space from noisy data % % Syntax: % [lambda, AIC, MDL, NEW, ENSTh, ENS, fhand] = dimension_estimation(x, noisevar, flagplot) % % Inputs: % x - Input data matrix (L x N), where L...
f48a45aceb4eee0180f7a40f6519880b635031583fb2926e558d5aff20f4ece5
MATLAB
3,896
150
function [pi_0_ehmm , coupling_tetha_ehmm , transition_ehmm ,ehmm_gmm_para, index_matrix ] = chmm_cartesian_product( pi_0_chmm , transition_chmm ,chmm_gmm_para ) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Converting CHMM to equivale...
2af2e08308e9254300b3c3fd7dde79ce667417fb7367403c60c007ee5ae94bb7
MATLAB
3,897
118
function probe = loadProbe(probeFile) %LOADPROBE Load a probe file try % first try to load probe from mat file pstr = load(probeFile, '-mat'); catch pstr = jrclust.utils.mToStruct(probeFile); end probe = struct(); % exactly one of 'channels' or 'siteMap' if isfield(pstr, 'c...
2cd3080ab0377008d295d97eb31dd26764b3432813cf7bdfb3d6066d108990e1
MATLAB
3,899
113
clear; close all; cd 'C:\Users\Admin\Git\repo\ZS-DeconvNet\Python_MATLAB_Codes\data_augment_recorrupt_matlab'; % change this path to your cloned path addpath(genpath('./XxUtils')); addpath(genpath('./GenData4ZS-DeconvNet-SIM')); % It should be noted that, the raw data loading code of this demo is based on the file str...
92966a020ef201e88554e91730a47e40aefa875859555068f93a5831141cd23a
MATLAB
3,899
102
clc clear [file, path] = uigetfile('*.mat','MultiSelect','on');%When the user clicks the load psetion button, a window should open to enable the user to select a file. cd(path) datafile = fullfile(path, file); %save path %% windows = {40:50, 40:60, 40:45, 40:55, 65:125, 75:125, 85:125, 95:125, 100:130, 140:150, 140:160...
507422253220528a26b8a9fc1d50e40844d0097e8a59290d38f378b725e5203d
MATLAB
3,900
77
function Workspace1 = Segments_Orientation(Workspace1) % Make a list of the coordinates of the 1st and last primary branches: Vxy1 = [[Workspace1.Branches(1).Rectangles(:).X]',[Workspace1.Branches(1).Rectangles(:).Y]']; Vxy2 = [[Workspace1.Branches(2).Rectangles(:).X]',[Workspace1.Branches(2).Rectangles(:).Y]'];...
35aaef950bfb27febf6561a771f5fc2ca159e01ddba275accf448af7ab6c092d
MATLAB
3,901
107
%% loading data load('dataFig2AB.mat'); load('dataFig2CD.mat'); %% Fig 2AB figure(21); clf; set(gcf,'Position',[50,10,400,840]); % V-I curve subplot(2,1,1); cla; hold on; xl=[-0.55,1.05]; yl=[-93,-27]; plot(amps/1000,potentialP,'-','color',[0.0,0.4,0.0]); plot(amps/1000,potentialA,'-','color',[0.0,0.0,0....
e9de2dc832be13389a3d4a6968cbe9f16a88b2c74a045edfa1632564c77fae7c
MATLAB
3,901
118
%% LDE iteration w/o figures % Output: Iteration firing maps, and L1 diff norm % Outflag: 'f(xn)' or 'xn' function [LDERepFinal,L2DiffNorm,L2DiffNormNeib,L2Diameter,LDEequv] = ... LDEIteration_16FuncMain(... PixInptCtgrUse,LDEIni,p,Epoc,... C_SS_mean,C_CS_mean,C_IS_mean,... C_SC_mean,C_CC_mean,C_IC_mean...
d74b1bdf07aeb93f01994837aa45246217e68d3d7d5c16bb2bf031e2eb2cbc48
MATLAB
3,904
139
function [fmri_out,V4] = spmup_skip(varargin) % routine that reads a 4D fmri data set and return a 4D set minus N initial volumes % % FORMAT fmri_out = spmup_skip % fmri_out = spmup_skip(fmri_in,n,options) % % INPUTS fmri_in is the name of the fmri data set % n is the nymber of initial volumes to...
f66264f70a08f1049619d18278f9e6fb98105724327e3132fd40b89e734085ff
MATLAB
3,907
121
function [Trace]=mnl_GetNeurolucidaTraces(s) NumTraces=size(s.mbf.tree,2); Tree=s.mbf.tree; nT=1; %Final Number of Fragments/Traces counter=1; while counter<=NumTraces TempTrace=Tree{1,counter}; %% Are there points? if isfield(TempTrace,'point')==1 [points,diameter]=mnl_GetPoints(TempTrace); ...
a083e790e08009caf172b230ec01c77d78c6446df9995bceaf0a5f1d47bc3203
MATLAB
3,909
135
% Histograms of FWF values in T1L for each MS patient % plot showing all the histfit curves overlapped on each other % box and whisker's plot showing the variability for all the pts clearvars close all addpath(genpath('/storage/stella/MATLAB_toolboxes/')); addpath('/storage/stella/Analysis/matlab_scripts/'); tstart ...
d11705c8496bfc33237f86e0eb173cf0668c87b47558f56af4ee3b2e8214535b
MATLAB
3,910
85
%% This function generates arbitrary large field with lgn indexes, given a 3*3HC input % Input: lambda_SOn_drive: LGNon input for all S cells. There should be % three unique values % temp: A template 1*N (same length of number of functions) that composes lambda_SOn_drive % ...
84c4a5b7dede19045bb7b10ca7c99d933d3c2b4991dda988278dbf6d2db8e8ab
MATLAB
3,915
123
% compare the tone component for different trial types and aligments: % 1) avoid vs. error at tone end % 2) avoid (action start) vs. error (tone end) % - comparison 1 should show that in avoid trials tone singal drops early % - comparison 2 should show that the drop is alinged between a and e % - this will allow u...
9521784fbb5906b691e66e213ad17140144b99316b62fc344677c1f4da5dc443
MATLAB
3,916
156
function [res,Names,msg] = SlurpData(path,conds,directory, tp,pb) % This function helps you to read well organized data from a directory into matlab % PATH is a wildcart to identify the files of one condition across all % subjects in the directory % CONDS is a cell array containing the tags for all conditions you w...
87dc1b88401c2b02d375544687dc3d08d913ed9f18ea4da1d74bda51601f2e86
MATLAB
3,919
177
function go_netviewer_gray(C) % only use to show full networks w matrtices of 1s and zeros cLims = [0,1]; % Set the sphere widths to 1 % sphereWidths = repmat(1,78,1); % Set them to only visible if a node survives thersholding sphereWidths = sum(~isnan(C))*0.5; sphereWidths = 3*sphereWidths./max(sphereWidths(:)); loa...
16f35d43db8c8383ac8f38b4b814cafd7a0321a370d43e4e80d341eba39a7316
MATLAB
3,920
96
function SpikeForm20191122 %CheetahWRLV20180729Part1‚ɕۑ¶‚³‚ê‚Ä‚¢‚é‚·‚ׂĂÌtfile‚̍זE‚̃f[ƒ^‚ɑ΂µ‚ÄHalfPeakwidth‚ÆPeaktoTrough‚ðŒvŽZ‚µ‚ăvƒƒbƒg % ScNumbers‚Í‘S×–E”H4×–E‚̏ꍇ‚Í3D % CellNumbers‚͍זE”ԍ†A1,2,3,4...A‚½‚¾‚µA0‚à‚ ‚éB‚ǂ̍זE‚É‚àŠY“–‚µ‚È‚¢‹L˜^iHj % DataPoints‚Ì1ŽŸŒ³–Ú‚Í32“_‚Ì“dˆÊA2ŽŸŒ³...
9d46c01bd5d0b08329c2bf76e21890e69bbafcf42c760a8d1e96d30b7e41e53f
MATLAB
3,922
75
function [tr, wl, int] = mselect_wls(file) %%%%%%%%%%%%% Loads scope files %%%%%%%%%%%%%%%%%% [s, w] = dos('dir/B c*.txt'); %display the filenames of the txt files in the current directory that start with rs txt = regexp(w, '.txt', 'split'); %splits the character array into cell array of strings ...
a4ec2cd02a96a968c51fed2379bbb7de600b9ef2d219606e2ddd8708f68de464
MATLAB
3,922
78
% ----------------------------------------------------------------------- % % Function plot_areaerrorbar plots the mean and standard deviation of a % % set of data filling the space between the positive and negative mean % % error using a semi-transparent background, completely customizable. % % ...
22728cf5b0261c61b689da07412389e08f201e1a97398c1b1ad7d2de195f9b85
MATLAB
3,923
107
clear clc %% % Needs to be in D:\Data\IR data Shira_May_14_2022 [file, path] = uigetfile('*.mat','MultiSelect','on');%When the user clicks the load psetion button, a window should open to enable the user to select a file. cd(path) datafile = fullfile(path, file); %save path for i = 1:length(datafile) load...
ce0732eff477d8a1982625bb46308ec6e85d7d17c29fe180241c7e11c4163d37
MATLAB
3,923
137
function[b_model,b_ind,b_loading,exp_var] = RaguEEG_Mod_r(eeg,n_mod,reruns,max_n,flags,ProgBarAxis) %function[b_model,b_ind,b_loading,exp_var] = RaguEEG_Mod_r(eeg,n_mod,reruns,max_n,flags) % EEG_MOD Create the EEG model I'm working with % % function[b_model,b_ind,b_loading,exp_var] = eeg_mod_r(eeg,n_mod,reruns,max_n)...
14c00147f3d4516bee188fe6402bbe7e750b5db05feceec6b8894d23283e50cb
MATLAB
3,930
142
% Simulated scatter plots and ICA % clear; close all; a = 2; b = 2; % t = asin(1/b) + [0:.01:18*pi 0]; % t = asin(1/b) + [0:.01:2*pi 0]; t = (0:.01:20*pi); N = length(t); r = a * (1-b*sin(t));% + .2*randn(1,length(t)); [x,y] = pol2cart(t,r); % A0 = [1 1; -1 1;-.2 1]; % xyz = A0*[x;y]; x = x ...
ccbdf46861ca80e2d606e2e3b2d05137af0ba263a8d0ebc2ed7242862a0292fe
MATLAB
3,931
134
function info = get_info() % Get global information % % Returns % ------- % - info: struct % - width: scaler % Width of the probes' grid % - height: scaler % Height of the probes' grid % - fix: vector % Saccade aligned presaccadic times % - sac: vector...
52dec9bfabcf49775518fa1f874634db7808bd972a301e1d8ce72bb821a7709a
MATLAB
3,934
65
%{ ---------------------------------------------------------------------------- Determine the time window for task relevant neurons %Start of task %Sound on %Sound off %Before choice %After choice (0sec) %After choice (1sec) %After choice (2sec) %p = 0.001 %Each epoch, predict the prior, sensory and choice...
7937cd5c46eb901b17f909d4f3d66f0645231ef26e062af1288993f89b5f51d2
MATLAB
3,935
153
function [bestMI, bestbin, p, SSI] = calc_MI(spikeCountCellArray, correction, optimiseBins, sigFlag, nMCSamples, nBinLim) % 1) Choose number of bins (stimulus and response) % - same as input, optimise to max info, pre-specified N % 2) Compute MI using this number of bins, optional correction... % 3) check significance...
912ed3aeb9eb0537385e62a0a1cc16c0775b72da1d5196537a2fdd4c3bb07345
MATLAB
3,935
134
function [ch, tim] = getkey(N,nonascii) % GETKEY - get a keypress % CH = GETKEY waits for a single keypress and returns the ASCII code. It % accepts all ascii characters, including backspace (8), space (32), % enter (13), etc, that can be typed on the keyboard. % Non-ascii keys (ctrl, alt, ..) return a NaN. C...
1eebc7d0f143ce25162feb462f6c3c7d878f92e7db9d883d42624df726982f8f
MATLAB
3,941
102
function computeMeanWaveforms(obj, updateMe, useRaw) %COMPUTEMEANWAVEFORMS Compute the mean waveform for each cluster if nargin < 2 updateMe = []; end if nargin < 3 useRaw = 1; end if isempty(obj.spikesFilt) return; end useRaw = useRaw && ~isempty(obj.spikesRaw)...
2702ac1dc98768e2dc6f232794f3d264bb4a16b0a8418b8811128d75d8de305a
MATLAB
3,942
145
% simulate effect of motion on a 2D-image clear close all run('addRetroMoCoBoxToPath.m') rng(0); % resets random number generator to get the same 'random' numbers each time code is run % load example image_original = imread(fullfile('images','col27_slice80.png')); image_original = double(image_original(end:-1:1,:,...
5d13a6751fed29bd5afec26e7e469a64a0b2cc5fefa90a97333aa7012dce7990
MATLAB
3,943
138
function [zHits,zFA,dprime,c,cprime,beta] = rst_sdt1(varargin) % implement signal detection theory % based on the book Detection theory A user guide % Authors N.A. Macmillan and C.D. Creelman % one-interval design - two-stimuli needs to be discriminated % % [zHits,zFA,dprime,c,cprime,beta] = bat_sdt1(100,100,80,30,1); ...
03b6cfe80435897f443cee119588af7315f63ce69693fc4fcc965d80cb83f6e3
MATLAB
3,945
102
%% review 2.2; % Simulation of cells. % Created by Xiang Zhang, Jan., 2024. clear; close all; %% parameters; file_lists = { 'E:\Social\15028\20210405\15028-10071\PC'; 'E:\Social\15029\20210420\15029-10068\PC'; 'E:\Social\15030\20210420\15030-10074\PC'; 'E:\Social\15032\20210407\15032-15037\PC'; 'E...
1c58bf259e3e965c5901f5c4f213a6d17ba69c3cb8e9908ae34c8823a5b682d8
MATLAB
3,945
91
% Mapping of ICs to RSNs for neuro-dynamic-covariance project. First thrsehold the raw probability maps from the IC and RSN. Then calculate % dices coefficient of the overlap between each IC and all RSNs, as well as the percentage of the IC mask that overlaps with each RSN (these are almost perfectly % correlated but p...
6ae91c189547fe1282e4cf5e3744b1c08e4d9416792fd9d88a54c71e374e185a
MATLAB
3,947
102
% ut_spmup_anatQA % % call spmup_anatQA testing with simulated data % that means all the data in GM and WM masks are used corresponding to the % values generated therein % % Cyril Pernet % ------------------------------------------------------------------------- % Copyright (C) spmup team %% load up the SPM tpm cl...
e297e37407b9bee86d80bb09b3726423584510dd7088d05c3630394e50c8d4fa
MATLAB
3,948
114
function untitled20190223 global ACresult ACresultW CCresultDrinkOn SpikeArray RpegTouchallWon LpegTouchallWon TurnMarkerTime RmedianPTTM RpegMedian LmedianPTTM LpegMedian... RpNum LpNum OneTurnTime CCresultSpike RmedianPTTM LmedianPTTM pksA1 pksA2 bin1=15; phaseR=zeros(1,bin1); for i=1:length(RpegTouchallWo...
fefe1a985deef45aa970744d1620e886db5fe961f813f64622d687b93e0c85a3
MATLAB
3,949
144
%Computes gradient using second-order methods %Shinjini Kundu (c) 2015 function [dIdx, dIdy, dIdz] = new_gradient(image, option) %inputs: image a 3D image % option 'first' or 'second' % choosing 'first' is the same as the result % ...