sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
7fd7402348aaf619358845d5f9c3ccc58edff516737ccf4fb088cab1ae405e68
MATLAB
965
40
function meta=remove_line_index(meta,index) % REMOVE_LINE_INDEX removes a line from the list of lines of the MetaBlock. % META=REMOVE_LINE_INDEX(META,INDEX) removes the line in the specified % index from the line-list of this metablock. % If index exceeds the length of the list then the line is removed from the % end ...
18741773edc981c4d544056442311a8727b21c32ae9ddce8c330d0bc04da9c2b
MATLAB
966
31
classdef (Abstract) InputOutputDevice < handle %INPUTOUTPUTDEVICE is a class for a generic i/o device. % It is an observable class that signals 'DataReceived' events if it got % input. 'DataReceived' events have an 'InputDeviceData' object with the % properties 'pin' and 'value'. In that manner, it maps directly ...
c8bacde88b0d2f29febe3ea9ab8efe41bff4cede79d0c6510cdc8f6b07cf8a82
MATLAB
966
21
function [] = MIBItestBackgroundParameters_graded(reuseFigure) global pipeline_data; point = pipeline_data.points.get('name', pipeline_data.background_point); countsAllSFiltCRSum = point.counts; labels = point.labels; capBgChannel = pipeline_data.capBgChannel; t = pipeline_data.t; gausR...
e0acc31b310571dc87c4c04f86050a05bdb8228cf3aa27220cc1566c666cfcdc
MATLAB
966
17
%----------------------------------------------------------------------- % Job saved on 19-Feb-2020 16:30:55 by cfg_util (rev $Rev: 7345 $) % spm SPM - SPM12 (7487) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- function matlabbatch=spm_func2atlas_normaliza...
c05f813fbf7743f9871766365bde25241e982b969c8acf1341843359a2916de8
MATLAB
967
36
function rpx_str=get_rpx_string(sig) % GET_RPX_STRING returns part of the relevant rpx file name according to the % signal and envelopes that are defined for the signal coordinator. % The part of the file name is of the form : % _<signal-name>_<env1-first-letter><number-of-such-env> % For example : str= '_FRQ_M3' -----...
3d9976598b5801061a21f80849bf9f7e8fe2b4f0f72069f1104735916dff3003
MATLAB
970
30
function comp= change_sweep_param(comp,varargin) % change_sweep_param(sig_comp, field_name1, val1, field_name2, val2...) % changes sweep's fields to the given values. % Sweep fields are: Sdata, Sdata_formula, Edata, Edata_formula, Num_data, % Num_data_formula, Reps, Reps_formula, Mode, Step. param_argin = varargin; ...
af0b4008b417a1393c26cc6b24ff0cea9fb0c3928f624dcb95d548730b12eab4
MATLAB
971
20
%----------------------------------------------------------------------- % Job saved on 27-Feb-2020 20:55:45 by cfg_util (rev $Rev: 7345 $) % spm SPM - SPM12 (7487) % cfg_basicio BasicIO - Unknown %----------------------------------------------------------------------- %% function matlabbatch=spm_realign_estimate(Dir_a...
413562829e2a353038636f4c7fb78fc39fc8e0beadc0c027e530c7c47d78fc12
MATLAB
972
32
function val = get(env,prop_name) % GET Get Envelope property from the specified object % and return the value. Property names are: % Name, Signal, Num_of_comps, Comp_list, Comp_list_str,ENVELOPE_NAMES, ENVELOPE_NUMBER. if isa(prop_name,'char') index=strmatch(prop_name,env.comp_list_str,'exact'); if ~isempty(...
4923b05ff036299ebcf2f1faca7ac1e68033c4a68755dc070945c62067bfc70e
MATLAB
972
41
function type = IdentifyType(toReward) switch toReward.beamind case 1 %infood1 type = 1; chanid = 'Port1/Line0:0'; case 2 %inwater1 type = 2; chanid = 'Port1/Line2:2'; case 3 %infood2 type = 1; chanid = 'Port1/Line1:1'; case 4 %inwater2 type = 2; ...
4d7596de9262d4893de55f9eb6f2678974c089ae8f6976596d21c3cded73dfdd
MATLAB
972
30
function [centroidDist] = centroidDist(obj,clusters,nCluster,useChans,maxDimension) %centroidDist Euclidean distance between centroids % clusters = Integer indices identifying clusters % nCluster = Number of clusters overall % useChans (optional) = logical array of channels to use % maxDimension (optional)...
a55bd8242cecc9b112cc9a4379a82d994b86735991de6d0b4d99dadf43820b8b
MATLAB
974
27
function printFields(level, obj) fields = fieldnames(obj); for i=1:numel(fields) field = getfield(obj, fields{i}); try if isstruct(field) disp([repmat(' ',1,level*3), fields{i}, ': {']) printFields(level+1, field) disp([repmat(' ',1,lev...
dd882952c939a5e79d4eb27f55e0835e8a5c86717766f340c65286c790e4a7fc
MATLAB
975
25
function arduinoPorts = findArduinoPorts() %FINDARDUINOPORTS find COM-ports auf connected Arduino devices % This function returns a cell-array of strings with all Arduino % COM-ports that could be found on the computer. % % Attention: This function is platform dependent and works on Windows % only. It depends o...
a63e0c7a5fe152bd0280dd165f6754dd76ef06da9dd0f2ca66e4e36a81818f93
MATLAB
977
30
function [ pendantPair ] = PendentPair( F, index, ind ) %% [ pendantPair ] = PendentPair( F, index, ind ) %% %% This function is the core sub-routine of the QueyranneAlgorithm.m %% %% First written by Shohei Hidaka Oct 22nd, 2015. %% Revised (added its description in comments) by Shohei Hidaka Jan 13th, 2016. %% %...
e615bd4760e561a5c9c54d623218980fa7ad9f82da7d317dfbc69cc3a43487ef
MATLAB
977
37
function [points] = tcp_server() h = tcpip('localhost',80,'NetworkRole','server'); % Wait for connection disp('Waiting for connection'); h.InputBufferSize = 6; fopen(h); flag = true; points = []; disp('gone into loop') while flag if(h.BytesAvailable) data = fread(...
76bc51ea30a7c321b7c1bc2deb2b6e96a4471c0b8ee5d69c8761e9bbe4a62cda
MATLAB
982
36
function p_m = marginalize(p,index,N,N_st) % --------------------------------- % PURPOSE: marginalize probability distribution p(X) % Input % p: probability distribution of X % index: marginalized out other variables than those indicated by index % % Output % p_m: marginalized probability distribution %---------------...
75925cb484931fd36d7ff17e6a5c2b1355db90fa47691c046b1e740e1baa5d17
MATLAB
989
28
function flank=FLANKING_BAND_CO(varargin) % FLANKING_BAND class constructor. switch nargin case 0 % if no input arguments, create a default object m_sig=Main_signal('FLANKING_BAND_CO'); flank.num_of_comps=6;% FLANKING_BAND has 2 more unique components beside the basic 4. % load filtercoefficients load(...
271959d35b5a03ccc9a4a00e5235fc6c78a51805b192d0244a8d395c3aec7d47
MATLAB
991
36
function lgd = plot_short_time_wrapper(t_axes, pinfo, param, zones) fname = sprintf('metadata_%04d-%02d-%02d_rat-%02d', pinfo.Year, ... pinfo.Month, pinfo.Day, pinfo.Rat); S = load(fullfile('..', 'data', fname)); metadata = S.metadata; [loc, trial] = get_defined_data(pinfo.Year, pinfo.Month, ... pinfo.Day,...
b1161afdf659f36dfdc05d65c6e1789d66eb7e3243b7be8b315c423ae898e62f
MATLAB
991
36
function [Xrec, shearletSystem] = MIRO_Shearlet_thresholding(X,Var,shearletSystem,thresholdingFactor,mode,smp,tophat) % Shearlet decomposition, microlocal thresholding and reconstruction %% Shearlet decomposition coeffs = SLsheardec2D(X,shearletSystem); %% Shearlet shrinkage switch mode case 's' ...
2d68011a2a64e6867eb5cc1ee34bebad9788ed678dc8fc25aa26631a1da27fd2
MATLAB
993
31
%BLED Black to red variation of the hsv colormap % % Examples: % map = bled; % map = bled(len); % B = bled(A); % B = bled(A, lims); % % A variation of MATLAB's hsv colormap, which starts in black and gradually % increases in color saturation. % % The function can additionally be used to convert a re...
74f82f9afffeefd6b08cc4c37f1b9f98c07bed632bb382cd8c88204060db9c6f
MATLAB
993
31
%WHED White to red variation of the hsv colormap % % Examples: % map = whed; % map = whed(len); % B = whed(A); % B = whed(A, lims); % % A variation of MATLAB's hsv colormap, which starts in white and gradually % increases in color saturation. % % The function can additionally be used to convert a re...
f7cb78a0e4c557106179db21760d76816a3acf66aaa7e1d0662254db99ac97d4
MATLAB
995
28
function flank=FLANKING_BAND_IND(varargin) % FLANKING_BAND class constructor. switch nargin case 0 % if no input arguments, create a default object m_sig=Main_signal('FLANKING_BAND_IND'); flank.num_of_comps=6;% FLANKING_BAND has 2 more unique components beside the basic 4. % load filtercoefficients loa...
339ce7c3acbe984d86e71bfa805199861599908c96a220206a3482a06ed9ff0b
MATLAB
996
32
function p = add_lines(ax, trials, start_time, zones, do_port_positions, time_colors) % JN 2020-07-02 lw = 2; if do_port_positions for i = 1:6 plot(ax, [-1 trials.t_fdb(end) + 2 - start_time], ... [1 1] * zones.AngleCenter(zones.AreaNum == i), 'color', ... [.8 .8 .8 .5]); %t...
bbf954d12cd249fd533393fb815724d72e37b4befb25d40c7b4b5e02cc3af8c4
MATLAB
996
28
function [counts, labels, tags] = loadTIFF_folder(path) % First we look for all TIFF files in the given path fileList = [dir(fullfile(path, '*.tiff'));... dir(fullfile(path, '*.tif'))]; if isempty(fileList) error(['No TIFF files found in ', path]); end files = {fileList.name}'; r...
6f3c7d764ccfe94de0c1e77b38b88cb9b5bf9818fac24812f1a8c79c72129de0
MATLAB
997
32
function saveTIFF_mibi(opts) fields = fieldnames(opts); argstring = ''; for i=1:numel(fields) field = fields{i}; arg = num2str(opts.(field)); if isnan(str2double(arg)) if contains(arg, ' ') arg = ['"', arg, '"']; end else ar...
a3b95e8233d34024fb7283f6e54bcf941bb1bffc40a9dbf3675b0622fca31f73
MATLAB
997
47
function MOV_DATA=fb_motion_correct(MOV_DATA,TEMPLATE,varargin) %motion corrects the data in MOV_DATA to match a template image using xcorr % % % upsample_factor=100; nparams=length(varargin); if mod(nparams,2)>0 error('Parameters must be specified as parameter/value pairs'); end for i=1:2:nparams switch lower(va...
13a9733c9db92a34abf5a2a0ca43dd55374a38934ed4b1d86ea065fe44bb196c
MATLAB
1,000
42
function [areaTable, centData] = setFuncArea(inputvector) loclen = inputvector(1)-3; locx = inputvector(2:loclen/2+1); locy = inputvector(loclen/2+2:loclen+1); x0 = inputvector(loclen+2); % center x y0 = inputvector(loclen+3); % center y R = inputvector(loclen+4); % radius centData = [x0 y0 R]; r1 = R/8; r2 = 3*R/8; ...
df3c4b633492bbabfb92a28d197011c0542f9bb644b3087a14b65f6ef4c28598
MATLAB
1,001
25
function PERFORMANCE_surrogate=get_classification_performance_surrogate(real_type,pred_type,n_surrogates) % markov chain permutations of predicted type [n_per_type,transitions_abs]=count_transitions(real_type); %exclude states that do not occur transitions_abs=transitions_abs(n_per_type~=0,:); transitions_abs=...
1f401a3139a24f5f4eb63c6cd63a832410bac642eb26d369bb6b1d67f606ac45
MATLAB
1,003
32
function bw=adaptivethreshold(IM,ws,C,tm) %ADAPTIVETHRESHOLD An adaptive thresholding algorithm that seperates the %foreground from the background with nonuniform illumination. % bw=adaptivethreshold(IM,ws,C) outputs a binary image bw with the local % threshold mean-C or median-C to the image IM. % ws is the ...
2a2ac6e044402b63d93c1d39af37bb9ded3af5a098dfcb61e11680908cd4ca99
MATLAB
1,003
31
function out=set_trial_data(out,data,trial_index) for electrode=1:out.num_elec % for electrode=1:2 if out.LFPmask(electrode) chan_data=data{electrode}; len=length(chan_data); if len>0 % tmp=zeros(1,len); % tmp(1:len)=chan_data; out.trial_data{trial_ind...
c5143225d25006d2feecb0697a56b6efe71b1f06a632c026ed84395274d904f6
MATLAB
1,005
36
function h = mctrans(b,t) % MCTRANS McClellan transformation % % % H = mctrans(B,T) produces the 2-D FIR filter H that % corresponds to the 1-D FIR filter B using the transform T. % % % Convert the 1-D filter b to SUM_n a(n) cos(wn) form % % Part of the Nonsubsampled Contourlet Toolbox % (http://www.mathworks.de/ma...
5aa42f4ab64760753fad49b160588951888fc101d3f94240a83635d20c6b8447
MATLAB
1,006
30
function R = mRespIndividual(gain, direction, PD, sigD, sponR, cparams1, cparams2, cparams3, cparams4) % gaussian shape tuning curve % direction = stimulus dir % sigD = tuning width % pd range: -180 ~ 180 if PD > 180 PD = PD - 360; end if PD < -180 PD = PD + 360; end % degree to radian dirD = (direction - PD)*pi/18...
adb005d863dc5511d7629f57da505b34109248a3d0fcc269e5a690049505b4f3
MATLAB
1,007
38
function meta=add_line_index(meta,line,index) % ADD_LINE_INDEX adds a line to the list of lines. % line_list of this metablock in the specified index. % META=ADD_LINE_INDEX(META,LINE,INDEX) adds the given line to the % line_list of this metablock in the specified index. % If index exceeds the length of the list then t...
e7e29bb962730efb466e3a4fe2ba33323fcea6d925e20e9e1e40e6ff2c561f16
MATLAB
1,007
30
function comp= change_sweep_param(comp,varargin) % change_sweep_param(sig_comp, field_name1, val1, field_name2, val2...) % changes sweep's fields to the given values. % Sweep fields are: Sdata, Sdata_formula, Edata, Edata_formula, Num_data, % Num_data_formula, Reps, Reps_formula, Mode, Step. param_argin = varargin;...
160ad66128da9efe0ee17103de7dfba8374ee2966f469dcf78dfa3a78037c426
MATLAB
1,011
30
function comp= change_sweep_param(comp,varargin) % change_sweep_param(sig_comp, field_name1, val1, field_name2, val2...) % changes sweep's fields to the given values. % Sweep fields are: Sdata, Sdata_formula, Edata, Edata_formula, Num_data, % Num_data_formula, Reps, Reps_formula, Mode, Step. param_argin = varargin;...
a4686326d1669635a4088803dba2708d03bf4a9070fa86b2394f1314c563cc76
MATLAB
1,011
22
load("timeseries.Yeo2011.mm316.mat"); for m = 1:316 subject_mx645 = corrcoef(transpose(subjects(m).mx645)); subject_mx1400 = corrcoef(transpose(subjects(m).mx1400)); subject_std2500 = corrcoef(transpose(subjects(m).std2500)); subject_mx645(24,:) = []; subject_mx645(:,24) = []; subject_mx1400(24...
a46d47a7d403b722fca33e632465ea5c16c426d7abdd7157eb585586bf4b34ad
MATLAB
1,014
22
function [event_timing_struct, t_behavior] = load_behavior(rat_dir) % Function load_behavior() reads the beh_struct_for_RIFF_player.mat that is produced by the pipeline. % % Inputs: % rat_dir - (str) - Location of the beh_struct_for_RIFF_player.mat, inside the experiment folder % % Output...
d6aceb499f76e2d31aa4c270dcb50551ea5f094c572ad682eaed1c5297f2575e
MATLAB
1,014
28
function write_tiff_folder(counts, labels, path) path = strsplit(path, '.'); path = path{1}; % normalizing name tiff = Tiff([path, '.tiff'], 'a'); for index=1:numel(labels) setTag(tiff, 'PageName', labels{index}); setTag(tiff, 'SubFileType', 0); setTag(tiff, 'Photometric', 1); ...
02b6bd2902aa5daec1addcf16be549bc82310cd2450b4554a338c3ba617e33e3
MATLAB
1,016
27
function samp_points=synth(sig,samp_rate,trial_dur,varargin) % SYNTH is NEW_SIGNAL synth function. % SAMP_POINTS=SYNTH(SIG,SAMP_RATE,TRIAL_DUR,VARARGIN) Samples the signal % according to the givan SAMP_RATE and TRIAL_DUR. Returns the sampled % points. % varargin holds the requested Frequency value and the requested Ph...
dd6d27e5bdc706337b6c64a0f0b6ebc993b5ed7ac0c1550995126fb094e96a39
MATLAB
1,016
40
function [I_CaL, df_L, dd_L] = L_type_Ca(V, d_L, f_L) g_CaL = 2.1; E_CaL = 50; if(abs(V + 45) < 0.0001) alpha_d_l = 16.72.*2.5 - 50.0.*(V + 10)./(exp(-(V + 10)./4.808) - 1); elseif(abs(V + 10) < 0.0001) alpha_d_l = -16.72.*(V + 45)./(exp(-(V + 45)./2.5) - 1) + 50.*4.808; else alpha_d_l = -16.72.*(V + 10 ...
ca841300436496f1b5fa65adaa90ac15a975ffcb33966476be37dfa6fdee4079
MATLAB
1,017
31
function J=thresholdImage(I,NThresholds) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % INPUTS : I is the input image % NThresholds is the number of thresholds required. NThresholds % lies between the 1 and (the difference between the maximum and % minimum graylevel prese...
391a708feaed7ec66cc2f84015534464a7899885d36674b3b3c32863379f7ade
MATLAB
1,019
34
function [start_trial_points,stime_points]=generate_timing_points(handles,line,trial_dur,circuit_samp_rate) % samp_rate=get(line,'Samp_rate'); stimlist = handles.stimlist; samp_rate=stimlist.T{line,'samp_rate'}; % minimum_stime=get_least_stime(line); minimum_stime = stimlist.T{line,'stime'}; num_points=ceil(samp_rate...
407cd7b311589dcb2e85c3aba3ea7cf394d7d65daf364e3be3cbec17f2bf09b6
MATLAB
1,019
49
%% calculate the mean angle of the right most cluster cmap = parula(11+1); cmap = cmap .* repmat([.9 .8 .9],size(cmap,1),1); thresh = 10; x = obs2obs(:); y = exe2obs(:); ind_min_rel = x>=thresh; x = x(ind_min_rel); y = y(ind_min_rel); % convert to angle angle = atand(y./x); n = sum(~isnan(angle)); nbins = round...
df03b3bdc88da708fe3ff7c2648b1660de57e309cc1ab63217fcfcb49614e372
MATLAB
1,021
36
function p_m = marginalize_table(p,index,N_st,sigma_table,pow_vec) % --------------------------------- % PURPOSE: marginalize probability distribution p(X) % Input % p: probability distribution of X % index: marginalized out other variables than those indicated by index % % Output % p_m: marginalized probability distri...
4cd48740ff307299ea12554662e17f6b05bc95d2ac90850f11253492b5bbda9c
MATLAB
1,023
29
function stats = getSessionStatsFromLog(el, headerStr, trialFilter) %GETSESSIONSTATSFROMLOG computes session statistics from an eventLog. % Arguments: % el - eventLog of a LogBook % headerStr - the field name of the trial struct that identifies the % grouping factor % trialFilter - optional: a function ha...
6c3dd83e2d3b72a6ffc235cd39befe6562d5e05be3924856a5c47489d82d9e99
MATLAB
1,026
27
function sig= change_sweep_param(sig,comp,varargin) % CHANGE_SWEEP_PARAM changes sweep's fields of the given component to the given % values and returns the updated signal. % sig=CHANGE_SWEEP_PARAM(SIG,COMP,FIELD_NAME1,VAL1,FIELD_NAME2,VAL2,...) % changes sweep's fields of the given component to the given values and % ...
c5504ff1d702d3d82606967896e6bf411462325d6e1735e0f9c5b809bc98d521
MATLAB
1,026
41
function asynchSound(q) send(q,'start'); qout=parallel.pool.PollableDataQueue; send(q,qout); fs = 192000; dev = audioDeviceWriter; dev.Driver = 'ASIO'; dev.Device = 'ASIO MADIface USB'; dev.SampleRate = fs; dev.ChannelMappingSource = 'Property'; dev.ChannelMapping = 1:14; dev.SupportVariableSizeInput = true; dev.Buffer...
7ec90a341e0e56369f66fe23864cd2146c5efdf237d3537c55e33bf491fbea18
MATLAB
1,027
41
function m_sig=remove_envelope_index(m_sig,index) % REMOVE_ENVELOPE removes an envelope from the list of envelopes of a Main signal. % M_SIG=REMOVE_ENVELOPE(M_SIG,INDEX) removes the envelope in the specified % index from the list of envelopes of the given Main signal. % If index exceeds the length of the list then the...
9f5238606dc3975d571f4d5b170344b36766cbc7a789d491f14bd6c681d85e10
MATLAB
1,028
32
% Create a function to smooth data right before interpolation % Updated: August 30, 2022 function [dendSmooth,dendSmoothIdx] = NeurSmoothData(dendId,dendSkel2,sFactor) % Initialize dendSmoothIdx = dendId; dendSmooth = zeros(size(dendSkel2)); % Find NaN values or values less than 1 (out of bounds) ...
dd8ed0d3c35b14ceae8e6b8644115c34adef8747776c1fa78e3e1f224c2ee042
MATLAB
1,029
17
function writeTriByu(filename, triangles, vertices) % writeTriByu(filename, triangles, vertices) % Writes a triangular mesh to BYU format % filename - path to BYU file to create % vertices - Mx3 matrix of vertex coordinates % triangles - Mx3 matrix of indices into the vertices matrix dlmwrite(filename, [1 size(vertices...
fa95f3c9b20cd9577715fd4804f4562e4536a3c6584fc8490c1865878d930ab3
MATLAB
1,031
32
%% % This function generates n random numbers that are integers % between rand_min and rand_max. % The distribution of these random variables is like a Gaussian % distribution with mean mu and std sigma, but rounded to the nearest % integer and wrapped around the interval [min,max]. %%% function [ z ] = CircRandNfu...
95b0b183496a0cdb7afe7b44a241aaf77807dc55a5863afeb44a7d3a66e8db77
MATLAB
1,032
29
function [electrodeTable,ROImap] = loadROItable(useSheet,mapping) %loadROItable Loads the ROI table. % Detailed explanation goes here if nargin<1 useSheet = 'ROI_table'; end dataPath = getLocalPath('ECoGmeta'); electrodeFilePath = [dataPath filesep 'ROITable' filesep]; orig_s...
05e21766866170ba9ee2209b06911163647ff1bb0053c8bf3c074eb871c67ef3
MATLAB
1,036
41
function [CROPPED,TM] = cropDATA(DATA_fulltm,sdftm,sdfwin) if size(DATA_fulltm,3) > 1 error('cropping only works on one dimensional stimulus. In the past we had "padrows"') disp('archived') disp(' padrows = repmat(pad,size(condition,1),1); % pads with NANs if you are not in that condition any more. ') ...
18e03cd33cd32f9412072cdddf757009e9ee45bb3c3b520723633252a93424c5
MATLAB
1,037
31
function stateTransition_plot_FigS6(theHbT,theEMG,theLFP,specT,specF,theTitle,plotTime,plotNum) titles={'Quiescent Awake to Quiescent Asleep','Quiescent Asleep to Active Asleep','Quiescent Awake to Active Asleep',... 'Active Awake to Active Asleep','Quiescent Asleep to Active Awake','Active Asleep to Active Awa...
0aa161c1c72ae1b00759565f0bdd058dfa944c22a6a638125723428ff5c35476
MATLAB
1,041
34
function m_sig=add_envelope_index(m_sig,env,index) % ADD_ENVELOPE_INDEX adds an envelope to the given Main-Signal list of % envelopes. % M_SIG=ADD_ENVELOPE_INDEX(M_SIG,ENV,INDEX) adds the given envelope (ENV) to the % envelope list of this Main-Signal(M_SIG) in the specified index % If index exceeds the length of the ...
bb3255cb765639c5323dc045d95dc6a850f8166fdfa4539be4b0ddde03acb2a8
MATLAB
1,041
24
function ExVivo_Setup_FromDiffusion(path) %% Changing path names from Sebastian's data: clc; load(fullfile(path,'Chiasm1_allecho','Image_lists_R2s_1stO.mat')); %figure; for indx = 1:16 [pthname, fname, ext] = fileparts(Porg{indx,1}); new_pthname = fullfile(path,'Chiasm1_allecho',num2str(indx)); fn...
a6a793e987883db4ded754aed64509ae7117322e9d14fe749fc557c34221b8c4
MATLAB
1,043
31
function plot_consecutive_bars(data, ylabel_string, ylimit) number_subjects = size(data,1); figure ax = axes; bar(1, mean(data(:,1)), 'k'); hold bar(2, mean(data(:,2)), 'r'); bar(3, mean(data(:,3)), 'b'); bar(4, mean(data(:,4)), 'g'); %Plot confidence intervals for i=1:size(data,2) plot([i,i], [mean(data(:,i))-s...
879ce0799cc4cec951f16e1ff524145ba3929276a7b94f753da65b7c3adcbf78
MATLAB
1,045
32
function env_counter_arr=get_num_spec_env(sig) % GET_NUM_SPEC_ENV returns an array that specifies the number of envelopes % of each kind on the specified signal. % ENV_COUNTER_ARR=GET_NUM_SPEC_ENV returns an array that specifies the number of envelopes % of each kind on the specified signal. % First cell represents MTF...
b576c69dca9de6007c136f018b36d32432f56f70b391a8e2560eb2a399cacf64
MATLAB
1,049
37
function [... dSL, dA, dTT, dU, dV_e, Force, dO_TnCa... ] = force_generation(V_e, SL, TT, A, U, data, Ca_i, ATP_i, ADP_i) F_kl = data.F_kl*5000; Ff = data.Ff; F_go = data.F_go; F_gl = data.F_gl; SL_0 = data.SL_0; N_c = data.N_c; F_k0 = data.F_k0; F_k1 = data.F_k1; FN = data.FN; F_k05 = data.F_k05; k_XBATP = da...
3611ac2836fdc59c5bd8b6fe7bf97ee16146cbf596f82d55d4779bb4122ac21a
MATLAB
1,052
30
function list=get_comp_list(main_sig,external_comp) % GET_COMP_LIST returns the list of components of a Main_signal object. % LIST=GET_COMP_LIST(MAIN_SIG) returns the list of components of a % Main_signal object including components that are part of it's Envelopes. % LIST=GET_COMP_LIST(MAIN_SIG,EXTERNAL_COMP) returns...
a58788ce3c240f511e3bb56019c3dadbc4a87db32d7d6a348229f7345481eb11
MATLAB
1,052
26
function [Result,arraydata,realDataSizeWords] = AO_GetNextBlock(sizeOfArrayWords) %% Function used to get the nex new block data coming from the embedded %sizeOfArrayWords :The max size of data the array can contain %arraydata :Pointer to an array to hold the new data ,the data contain stream format in ord...
a150c16a736edbb4754a4e209d507ef31d5767c670eda4366436747107e5e6c8
MATLAB
1,053
48
function beam_ind = InputBeams() s = daq.createSession('ni'); addDigitalChannel(s,'Dev1','Port0/Line0:3','InputOnly') addDigitalChannel(s,'Dev1','Port2/Line0:3','InputOnly') addDigitalChannel(s,'Dev1','Port4/Line0:3','InputOnly') data=inputSingleScan(s); while sum(data) == length(data) data=inputSingleScan(s)...
216a9997ea72d74f330a30ab5a0f9159dcdbf64abf2f2e02057cbb65361236a7
MATLAB
1,058
36
% GET_RELATIVE_LOCATION returns the relative location of the given value % within the range of possible values of the given component. % LOC=GET_RELATIVE_LOCATION(COMP,COMP_VAL) returns the relative location of % the given value (COMP_VAL) within the range of possible values of the % given component (COMP). function l...
ff62174d76b835e846c0d20fb185e886e922dd1d8b367372a1a6f12cfd67f154
MATLAB
1,060
26
function mapIntensityOnSurf (in_subj_surf_byu,in_qmri_nii, out_qmri_txt, out_qmri_surf_vtk) %in_subj_surf_byu='~/graham/scratch/test_surfmorph/surfmorph_dev/work/iter1/sub-CT01/propSurface_subjspace_nii.byu' %in_qmri_nii='~/graham/scratch/test_surfmorph/surfmorph_dev/work/sub-CT01/labels/t1/probseg/striatum_cortical.n...
e45b351c1d1ad6a0c7ac747c920d0d271b42310bfce0d70835794474553a683e
MATLAB
1,066
41
function dataForJASP = jasp_2x2_RESP(IDX) %% Goal % use gramm and plot the simultaneous congruent, incongruent, and monoc % preferred. % line plots using "methods for visualizing repeated trajectories" %% Initial variables conditNameForCC = IDX.allV1(1).condition.Properties.RowNames; TM = IDX.allV1(1).TM(1:560); cle...
f6ad5301dc99d1bd6da15cd6085f20cd2ca0c485b3f58f0e1184527759351bc8
MATLAB
1,067
42
function [res_pa5,succeeded,err]=reset(pa5) dev_num=get(pa5,'Device_num'); err=''; actx_cntrl=get(pa5,'Controler'); dev_num=get(pa5,'Device_num'); res_pa5=NaN; % if (invoke(actx_cntrl,'ConnectPA5','GB',dev_num)==0) % if (actx_cntrl.ConnectPA5('GB',dev_num)==0) % err_msg = invoke(actx_cntrl,'GetError'); % if leng...
7db4aefcf7692948141da643a00226a54ba7fdccc4a4c2ac2724370bce95e87f
MATLAB
1,072
29
function stats = getFalseAlarmStats(shamTrials) %GETFALSEALARMSTATS calculates the false alarm rate from sham trials. % Arguments: % shamTrials - a struct array with all sham trials % Output: % A struct with the following fields: % falseAlarmRate - the true false alarm rate % adjustedFalseAlarmRate ...
9ad874c79b1f30377db3fdacfccf12cf2a856ac24f646bf1a4623a1824d3aca7
MATLAB
1,077
43
% function values=get_values(line,num_groups,group_num_trials,comp,crid) % num_data=get(line,'Line_num_of_trials'); % mult=1;%multiply each value % if ~(crid==num_groups) % for k=crid+1:num_groups % num=group_num_trials(k); % mult=mult*num; % end % end % % times=1;% how many times to repeat the generation of values % ...
53752471040851b0a46545f47774926210b396da14f40a8cd8fffbff61d48c0f
MATLAB
1,079
29
% this function is going to interpret single spaces as regular spaces, and % anything larger (2 or more) consecutive spaces as 'tab' function [clean_string] = tabSplit(string_to_split) % then we'll remove any trailing spaces trailing_space_idx = regexp(string_to_split, '[ \t]+$'); if ~isempty(trailing_space...
c691275994d461156af732748b20646a8cb5aa32c6a5b79b7163f5dc212c8c7b
MATLAB
1,079
56
function [img, UserSelectedCancel, filename] = ReadTiff(varargin) UserSelectedCancel = 0; default = cell(4,1); for i = 1:length(varargin) default{i} = varargin{i}; end filename = default{1}; if isempty(filename) [file,path] = uigetfile('.\*.tif*'); filename = fullfile(path,file); if isequal(file,0)...
b40d8a35a9aba0dd25043fc9f11c9c3923b50d14ee1e24ff915711a7abfb1fbd
MATLAB
1,081
23
function generatePanels_FigS6(FigS6) %% P10 Arousal State Transitions transNames=fieldnames(FigS6.arousalTransitions); for transNum=1:length(transNames) for anNum=1:size(FigS6.arousalTransitions.(transNames{transNum}).Spectrograms.FiveSecSpec,3) emptyFlag(anNum)=max(FigS6.arousalTransitions.(tran...
09b13a939154c71d8cf586f5f83b6a051399794941cb1d055864ecd033a0f9ef
MATLAB
1,083
37
function val=get(meta,prop_name) % GET Get Metablock property from the specified object % and return the value. Property names are: % Run_mode,Line_list,Num_of_lines,Num_of_trials if isa(prop_name,'char') switch prop_name case 'Run_mode' val=meta.run_mode; case 'Line_list' val=meta.line_list; case ...
1a218788587ec136695d1c2f32c36aee13b2d1c8a5e01622739700b20c687bfb
MATLAB
1,086
33
%COLD Black-blue-cyan-white colormap % % Examples: % map = cold; % map = cold(len); % B = cold(A); % B = cold(A, lims); % % A black to white colormap through cold shades. % % The function can additionally be used to convert a real-valued array into % a truecolor array using the colormap. % % IN: ...
fa352cda5bc9b3ae9ebcf30ddac630de4f918505b2bd12d7fb6a8157ab8b3aa9
MATLAB
1,086
25
function [pval, realrho, realpval, nullrho] = cs_pvalvsNull_spearman(data1,data2,permno,wsname) %% This script was build based on the original script by Aaron Alexander-Bloch & Siyuan Liu, pvalvsNull.m, 2018-04-22 % written and edited by Christina Stier, 2022 % Calculate the p-value of correlation between two surface ...
562721af3dd29e65398a855728da73e746f870c8f668b34b137d81a905ebbf2f
MATLAB
1,087
27
% This scripts converts t-values into partial correlatin coefficients % (see e.g. R. Rosenthal, H. Cooper, L. Hedges, Parametric measures of effect size. The handbook of research synthesis 621, 231-244 (1994)) % Formula % r = sign(t)*sqrt(t^2 / N - rank(M) + t^2) % Load the results of the models (MEG markers ~ age ...
ec9ceedba161df6dbaed85e6c20334135b9c7a2b198ae8f4dc4ef6c32911b96f
MATLAB
1,087
33
%BONE Black-blue-white colormap % % Examples: % map = bone; % map = bone(len); % B = bone(A); % B = bone(A, lims); % % Similar to MATLAB's bone function, but also able to return a concise % colormap table. % % The function can additionally be used to convert a real-valued array into % a truecolor a...
1470e0d466924513beedfb851a7689372b80303ab83193489bd1797eacc53814
MATLAB
1,089
32
function loc=get_relative_location(comp,comp_val) % GET_RELATIVE_LOCATION returns the relative location of the given value % within the range of possible values of the given component. % LOC=GET_RELATIVE_LOCATION(COMP,COMP_VAL) returns the relative location of % the given value (COMP_VAL) within the range of possible v...
d445324dc7d8ff6c626a8179822e66316c414c3082dd520821c49bf28390b64e
MATLAB
1,090
39
function c = redblue(m) %REDBLUE Shades of red and blue color map % REDBLUE(M), is an M-by-3 matrix that defines a colormap. % The colors begin with bright blue, range through shades of % blue to white, and then through shades of red to bright red. % REDBLUE, by itself, is the same length as the current...
0b63c6d6e37eb8b1f1d0452c22ba6d817488b55458cff7cbff9bd280fbc2cbf3
MATLAB
1,091
60
function [hh,tt,jj] = boxresample(rr,R,S,Fs,t0) % boxresample resamples a signal with a sliding box % % Inputs are: % rr: raw signal [ntr ntt] % R: size of the box (in samples) % S: step size (in samples) % Fs: sampling frequency % t0: time of first sample in raw signal % % Outputs: % hh: resampled sig...
12b86c4e4637dc15eadfcb017adbc538fbc73e43e9540c2f07fb2e164adb2f3a
MATLAB
1,091
38
function test_cam_latency() % === Mount the camera object ==== imaqreset; cam = videoinput('tisimaq_r2013_64', 1, 'Y800 (1280x960)'); src = getselectedsource(cam); % === Set the parameters ==== flushdata(cam); cam.FramesPerTrigger = 1; cam.triggerrepeat = Inf; src.Strobe = ...
a4dbeee6c9b7a5ddc45c6eefaaab8074ded903ab87c6b5de93d8b16e04754d09
MATLAB
1,092
31
function make2CalibNoiseFiles(calib, varargin) %MAKE2CALIBNOISEFILES creates two bandpass filtered noise files. % Arguments: % calib - calibration structure % dur - duration in seconds [600] % level - target level [60] % sF - sample frequency [192e3] % cutoff - [4e3 60e3] % This file depends on 'makeSomeNo...
d3ce9c677d434c88e94b97ae380af3e252058bb0e0538675cbc61616ff8ac81b
MATLAB
1,092
40
function genBYUtoNiftiTransformFromCroppedAnalyze(in_nifti, in_crop_param_txt, out_xfm); %this function finds the transform to go from BYU to NIFTI when the nifti %is converted to analyze, cropped, and BYU surface generated (e.g. for the %template surface in ComputeSurfaceDisplacements) %in_nifti='lhipp.nii.gz'; %in...
5f1c7fc299b640dcc52160943371061649531c48d231b4b575f8b72fefe039ac
MATLAB
1,093
76
function [P,x]=fb_peak_probability(PEAKS,varargin) % % % % % % % select file to load nparams=length(varargin); exclude=[]; use_com=0; range=[-inf inf]; time_bound=[0 20]; win_size=.05; if mod(nparams,2)>0 error('Parameters must be specified as parameter/value pairs'); end for i=1:2:nparams switch lower(varargin...
579611e2a27fee6dae16acc0dbbb711019cd994c0eed177b477feebd3a061963
MATLAB
1,099
32
%PASTEL Black-pastel-white colormap % % Examples: % map = pastel; % map = pastel(len); % B = pastel(A); % B = pastel(A, lims); % % A black to white colormap with several distinct pastel shades. This % colormap converts linearly to grayscale when printed in black & white. % % The function can additio...
4e5162ef99f3c3b91b6e9102ecdabc5b0e9c380649edac438954c7fa3fa362e9
MATLAB
1,103
34
function [bw,level]=fcmthresh(IM,sw) %FCMTHRESH Thresholding by 3-class fuzzy c-means clustering % [bw,level]=fcmthresh(IM,sw) outputs the binary image bw and threshold level of % image IM using a 3-class fuzzy c-means clustering. It often works better % than Otsu's methold which outputs larger or smaller thresh...
18c7685b6a78f49f92e015c9df89e8606d7f940db2fb31eb35326d1912ae56aa
MATLAB
1,105
33
%HSV Red-yellow-green-cyan-blue-magenta-red colormap % % Examples: % map = hsv; % map = hsv(len); % B = hsv(A); % B = hsv(A, lims); % % Similar to MATLAB's hsv function, but also able to return a concise % colormap table. % % The function can additionally be used to convert a real-valued array into ...
bd4e8fb0bd3674fb3c48dc046df1eec5b0eb38bd8e95762574cec96872919d31
MATLAB
1,106
33
%BRIGHT Black-bright-white colormap % % Examples: % map = bright % map = bright(len) % B = bright(A) % B = bright(A, lims) % % A black to white colormap with several distinct shades of bright color. % This colormap converts linearly to grayscale when printed in black & % white. % % The function can...
5ab346921fdae5c12b2f87331f795c6a36675809eb0bac9982ab699f85c29be9
MATLAB
1,111
29
function env=add_to_comp_list(env,comp_type,comp) % ADD_TO_COMP_LIST adds a component to the given Envelope components % list % ENV=ADD_TO_COMP_LIST(ENV,COMP_TYPE,COMP) adds the given component % to the given Envelope components list and the given component name to % the given Envelope component names list. It retur...
1b105491dff819a690f14219afd66dc505ab6a4b751a1d2ea0ee67db3a2e6b43
MATLAB
1,112
34
function metadata = create_metadata(expdata, behavior_file_no, ... table_no, snr_times) out_folder = expdata.folders.out_folder_session; AO_plot_SNR_trigs(snr_times, out_folder); if behavior_file_no > 0 metadata.behavior_table = ... make_behavior_table(expdata.folders.behavior, ... expdata.exp...
08bfebe81fe11af5b3b756750c9f9fb10a2b75f2b8a41b4fe12f7c60814573e4
MATLAB
1,117
37
function [I, H, H_cond] = I_dis(p_past,p_joint,p_present) %------------------------------------------------------------------------------------------------- % PURPOSE: calculate mutual information % % INPUTS: % p_past: probability distribution of past state (X^t-tau) % joint: joint distribution of X^t (present) an...
d29314926401fb2d32e8065865de78a7393390ecc1add03c285ba584037b92d0
MATLAB
1,124
36
function [respMatrix, params, mResp] = makeRespMatWithConstantNoise(Npd, numRow, gain, direction, sigD, sponR, nTrials, corr, Fano, cparams1, cparams2, cparams3, cparams4, decoderN) [mResp, params, paramsRaw] = makeMeanResp(Npd, numRow, gain, direction, sigD, sponR, cparams1, cparams2, cparams3, cparams4, decoderN); ...
ec31416fb55b0a06c454fb778d3c6e54fa47c58a6eff8d3ffc90cbb682975858
MATLAB
1,128
27
load("timeseries.Yeo2011.mm316.mat"); output_dir = "full_data_linear"; mkdir(output_dir); count = 0; for m = 1:316 subject_mx645 = corrcoef(transpose(subjects(m).mx645)); subject_mx1400 = corrcoef(transpose(subjects(m).mx1400)); subject_std2500 = corrcoef(transpose(subjects(m).std2500)); subject_mx645(2...
3a34fe8c03dba0a05e695eb8b3e705703844802590f6ef29a28ec7ae9003ddb4
MATLAB
1,129
39
function testDump %TESTDUMP Test json.dump. fixtures = {... [], 'null';... 1, '1.0';... inf, 'Infinity';... -inf, '-Infinity';... nan, 'NaN';... true, 'true';... 'foo', 'foo';... {}, '[]';... struct(), '{}';... 1:5, '[1,2,...
9a0168d8440f2af9edcfbba21a0f49ffa23af0cb4258f18a2ec17c1ce26a3051
MATLAB
1,129
29
fields = fieldnames(fig3allbands); fields = fields(contains(fields,'envCorr')); bands = split(fields,'_'); bands = bands(:,2); dataTable = struct(); maxClust = 10; nROIs = length(fig3.ROIs); for iBand = 1:length(fields) thisField = fields{iBand}; thisBand = bands{iBand}; stabTable = table(); ...
38077a4fd9dc70a344979db66fab015e15680c3a1e8c5b170dc016e41dd9104a
MATLAB
1,133
42
clear clc behav_NE = readtable('./data/final_curves_NE_after_exclusion.csv'); behav_NM = readtable('./data/final_curves_NM_after_exclusion.csv'); eeg_NE = readmatrix('./data/EEG_NE_Cz_Grand Average Filtered.xlsx'); eeg_NM = readmatrix('./data/EEG_NM_Cz_Grand Average Filtered.xlsx'); eeg_NE(:,1) = []; eeg_NM(:...
3ac5a7b747e8ef4fbdb40b1abc9236d9229f3e88c485501009a4ce1c907150a1
MATLAB
1,134
38
function [result_pa5,succeeded,err]=set_atten(pa5,atten) err=''; actx_cntrl=get(pa5,'Controler'); dev_num=get(pa5,'Device_num'); cur_atten=get(pa5,'Atten'); if atten==cur_atten % if ~(atten==get_atten_display(pa5)) % invoke(actx_cntrl,'Display',['Att=',num2str(atten),'dB '],0); % ...
ed982e43f3834668b35c667f6975e8985ee0e73f8056f348633e0af329c7c136
MATLAB
1,135
30
function [] = analyze_collage() len = 5; % num of frames in a row of the collage area = 3; single_len = 200; led_loc = [6,6]; [file_name,~] = uigetfile('*.tif','Select a Movie'); info = imfinfo(file_name); collage_num = length(info); frame_num = collage_num*(len.^2); values = zeros(1...
38b794cd2be481a8890a8394b1f637ad52db38b431e832de9a50a557b291cf36
MATLAB
1,136
30
function [Result] = AO_AddBufferingChannel(ChannelID,SAmplingRate) %Function used to start gathering data for the channel defined in ChannelID %The total burffering is done for 15 sec,with the sampling rate defined in SamplingRate,therefore total samples number is 15*SAmplingRate %ChannelID :The channel id ...
be82559a06550561f5dede090e6ff570911177800887360a838c0ac8b920a93d
MATLAB
1,139
34
function trials = createGapStimuli(gapDurations, delays, repFactor) %CREATEGAPSTIMULI creates an array of gap stimuli. % Arguments: % gapDuration - an array of gap durations % delays - an array of delays [default: 1.25:5.25] % repFactor - replication factor [default: 1] % % The factors gapDurations and delay...
005641768da1b1165757e9a40f4cde5f8ba58515bb186ee3f080584e133c7324
MATLAB
1,141
40
function calc_geometry(doShow) %[x, y, center_x, center_y, radius] = load('cam_data.mat'); centData = cam_data.centData; center_x = centData(1); center_y = centData(2); radius = centData(3); areaTable = cam_data.areaTable; len_table = areaTable.area(end); x = radius*cos(areaTable.theta1)+center_x; y = radius*sin(areaTa...
cce15120f5b5be9e2aa96d25bb6541014e329780e10563d5047ec29eda91f4a8
MATLAB
1,141
46
clc clear close all load stat_for_fig04E.mat %% PLOT c = lines(7); figure('Units','normalized','OuterPosition',[.1 .1 .06 .14]) x = thresholds; hold on h(1) = plot_stats(x,m2,c(5,:)); h(2) = plot_stats(x,boundary,'k'); h(3) = plot_stats(x,m1,c(7,:)); xlim([4.5 15]) ylim([-20-5 50]) xlabel({'o2o threshold wrt', 'cha...