sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
258ce05e066318f3d7d946ebb67e7dbbd72601163581fc23146c2cf28b0b9ba0
MATLAB
813
27
classdef NWBContainer < types.hdmf_common.Container & types.untyped.GroupClass % NWBCONTAINER An abstract data type for a generic container storing collections of data and metadata. Base type for all data and metadata containers. methods function obj = NWBContainer(varargin) % NWBCONTAINER Constructor fo...
795d397dd85da1aa1498ba0135a2b7bb122032d0f8b65f6491643383e63ce90b
MATLAB
813
28
function [doog_filters, texton_data] = cluster_learning_create_image_filters; % create pair data angle_step = 15; filter_size = 5; sigma = 1.5; r = 0.25; % create DOOG filters num_angles=180/angle_step; doog_filters = zeros(filter_size, filter_size, num_angles); for (theta=0:angle_step:180-angle_step) ...
dcefd848abbdae53f683fd0b8bf3cf9e8fe2c2a52ed56b2bed5d98dd3c56034b
MATLAB
813
35
function [goodCycles, goodCS, z] = t2t_csNOcs_B(csTimes, cycleMat_cs, z, window) %% Find Good Cycles/Trials % Condition 1 z.csWindow_good = (z.sr_e * window(1)):(z.sr_e * window(2)); conds(:,1) = sum(cycleMat_cs(:,z.csWindow_good),2); conds(:,1) = conds(:,1) == 1; % Condition 2 z.csWindow_bad = 1:min(z.csWindow_go...
1d6d1b8749b03e9b7670cab98c98d49bdae803deacc0202c56de879879a8db04
MATLAB
814
22
function [deconv_options] = ml_cai_fixerupper_ms_deconvolve_cnmfe_to_neuron_hdf5(outputFilename, ms, deconv_options_0) numNeurons = ms.numNeurons; numTimeSamples = size(ms.FiltTraces,1); % The one found after deconvolving, not the one already found % since we need it to make the found spike series filtTraceMatrix = n...
3d93b2a6378e32a414cc2dbdf64a7634e52e7b9900fa43ba34aa989c53e0dcec
MATLAB
814
21
function [maxdV] = sumderivatives(eeg, framesinwindow) % SUMDERIVATIVES calculates the derivative of the signal at each point, and % then uses a moving window filter to sum derivatives in a given window % width. The maximum sum of derivatives in a window is normalised to the % signal variance. Related: https://doi.org/...
4e2996bc83c66bd703fe5a4c5e188c9df0e7abc28b241f0f983f31d0975134b9
MATLAB
814
30
% mglFillOval - draw filled oval(s) on the screen % % $Id$ % usage: mglFillOval(x,y, size, color) % by: denis schluppeck % date: 2006-05-12 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % inputs: x,y - vectors of x and y coordinates of center % size...
c514a1084059492d82fc41399c846ec55f26de79c99ecb7e80db6c42e0131dc4
MATLAB
814
33
function ISI=compute_ISI(units,startt,endt) %% compute_ISI calculates the Inter-Spike-Inverval of the population (units) between times startt and endt % %INPUTS % % units: structure containing the time of the spikes of all the units in % the population recording. units has dimensions 1 x number of units and % the time ...
cacc925cde17d2326d7d08334339607e46ffe570fc5c1a8a33946fa91adba3f6
MATLAB
814
42
% mglPause.m % % usage: mglPause() % by: justin gardner % date: 04/05/22 % purpose: pause that checks the keyboard w/out focus % function retval = mglPause(waitTime) % call mgl listener with all events to drain queue % check arguments if ~any(nargin == [0 1]) help mglPause return end if nar...
e17b0667fbe1024dca37e03a2421f58fc197587e3943a09213acaff0ea4a6064
MATLAB
814
25
function this = read_freesurfer_file(filename) % Low level reader of FreeSurfer files (ASCII triangle surface file) % FORMAT this = read_freesurfer_file(filename) % filename - FreeSurfer file % % See http://wideman-one.com/gw/brain/fs/surfacefileformats.htm %__________________________________________________________...
3556c1a73a1d067b093da8d2deaeb0e8b77cac8be1671925ca34f2b571f4e79a
MATLAB
815
38
function TR_OverlayDisplayAll(RGapp) % External function % Loop through all groups % Loop through all records of a group. Set start point as (0,0) % Plot all paths, each in a different color IDs.Group = RGapp.IDs.Group; fig = figure(1); NG = RGapp.Experiment.NumGrps; row = ceil(sqrt(NG)); colormap(jet) D = 0; for ...
4f52141687505405cf7625168f38c7578143ba6c90065cc96988adb4a74f3e4a
MATLAB
816
35
exps = 1208 % cords = ZoneMaster{1790,2}; load('ZoneMaster.mat') load('ExperimentNames.mat') dlgtitle = 'Input Movie File to Analyze'; prompt = {'Enter File Name with Extension:'}; definput = {'.mov'}; dims = [1 70]; file_specs = inputdlg(prompt,dlgtitle,dims,definput); file_name = file_specs{1}; ...
1bae47192565048a3b32010d1906024e197bf3fd3cdd9055e9e9c759e4912127
MATLAB
817
15
function [bestMap, bestCombination, metricValue] = best_flip_combinations(maps, comparisonMethod) comparisonMethod = lower(comparisonMethod); if strcmpi(comparisonMethod, 'mutualInformation') [bestMap, bestCombination, metricValue] = best_flip_combinations_mutualinformation(maps); elseif strcmpi(co...
095d73ff3cdb140a5736199aeb4b714e6d17d1782efb24ea72ac1c4da3febf06
MATLAB
818
23
function [task myscreen] = mglEyelinkCallbackCloseTracker(task, myscreen) % mglEyelinkCallbackCloseTracker - Assigns eye position to myscreen % % Usage: mglEyelinkCallbackCloseTracker(IP, conntype) % IP - the ip address of the eyelink eye tracker, defaults to 100.1.1.1 % conntype - the connection type: 0 opens a di...
adcd66175c66841956359372a24e4ef7ab2283ea73c4b963a3cd2b56748160aa
MATLAB
818
18
% Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024 function [T] = helper_add_group_labels_to_table(T, SessionsToGroups, eliminateUnmatched) % This is a helper function to be used with tables that have an animal % name and session name. It will add the group labels and ids. ...
bf53f79529c8a76d04d98673f871c7c864c8ebb4e233390c9c4987186a61d7ca
MATLAB
820
25
function mulana_savefig(hFig, outputFolder, fnPrefix, formats) for iFormat = 1:length(formats) format = formats{iFormat}; fn = []; if ismember(format, {'png', 'pdf', 'svg'}) fn = fullfile(outputFolder, sprintf('%s.%s', fnPrefix, format)); if ~exist(outputFolder, 'dir') ...
c1ee2b5d919bf8e773895de1e9046583bcfc914ef2bbd854fcf7b4e22ff6be71
MATLAB
821
20
% SONLASTPOINTSTIME returns the time for which a read will terminate % % Implemented through SONLastPointsTime.dll % % TIME=SONGETADCDATA(FH, CHAN, ETIME, STIME, LPOINTS, BADC {, FILTERMASK}) % % INPUTS: FH SON File Handle % CHAN Channel number (1 to SONMaxChannels) % STIME Searches back f...
1942da31a647cb27dfd187fa76f0a963f0446bee23533a2b0751be5736461232
MATLAB
822
29
function [im1] = rotate(j,pitch) im=pitch; sz=size(im); % 求出原图大小 h=sz(1); w=sz(2); c1=[h;w]/2; % 原图中心 a=45/180*pi; R=[cos(a),-sin(a);sin(a),cos(a)]; % 旋转矩阵45° R=R'; % 求出旋转矩阵的逆矩阵 hh=700; ww=700; % 画布的大小 c2=[hh,ww]/2; % 求画布中点 im1=uint8(zeros(hh,ww)*128); % 初始化目标画布 for m = 1:hh for n = 1:ww p=[m;n]...
1d16b9f2ea811d5ed4da8104f43b2bc1cee88ff1f1abbf9b2a5ede24eb5bd36a
MATLAB
822
30
% Example of parameter estimation problem % This example corresponds to MEIGO toolbox example: ex5.m % http://gingproc.iim.csic.es/meigo.html function [F R]=matlabPE(X) global texp yexp [tout,yout] = ode15s(@ex5_dynamics,texp,[100 0 0 0 0],[],X); R=(yout-yexp); R=reshape(R,numel(R),1); F = sum(sum((yout-yexp)....
6914f30788339e828f65cbb6b4228470f89a9221a334257dcc077769e319db87
MATLAB
822
24
function descrs = extendDescriptorsWithGeometry(type, frames, descrs) % EXTENDDESCRIPTORSWITHGEOMETRY Extend feature descriptors with geometric components % DESCRS = EXTENDDESCRIPTORSWITHGEOMETRY(TYPE, FRAMES, DESCRS) % extends the descriptorss DESCRS with either nothing (TYPE = % 'none') or XY (TYPE = 'xy') ...
74d3e0959a58c887aa52a579154ada7bde1b46dc1ba018b127d207bad8ee823e
MATLAB
822
33
function [roll_pos,roll_neg, pitch_pos, pitch_neg, yaw_pos, yaw_neg] = separate_velocity_channels(velocity) roll_pos = zeros(1,size(velocity,2)); roll_neg = zeros(1,size(velocity,2)); pitch_pos = zeros(1,size(velocity,2)); pitch_neg = zeros(1,size(velocity,2)); yaw_pos = zeros(1,size(velocity,2)); yaw_neg = zeros(1,...
41771f937974fafbf97dda2dfab2117ba1621234077a740e5e734c9d2002ad29
MATLAB
824
24
function output = concatRuns(input) % Function to permute and concatenate runs of fMRI time series % % INPUTS % input : (matrix or array) observed time series (time by voxels by unique stimuli by runs) % prediction : (vector or matrix) predicted time series (time by runs by voxels) <-- double check ...
64ffbccae2a69dffada0a36bd1e52ecbc76826d9b2a0deaa865d0b543c919170
MATLAB
824
20
function compareLMMs = compareLMMmodels(modelA, modelB, modelAName,modelBName) if ~exist('modelAName','var') modelAName = []; end if ~exist('modelBName','var') modelBName = []; end compareLMMs = compare(modelA,modelB); fprintf('Fixed Effects comparison:\n') fprintf('%s %s vs %s %s\n',compareLMMs.Model(1),mod...
a5c7b0c4fac06f3b9cf8e48bb3a8dc3e68e27ffbaddb3b3155a4cabd3c812d10
MATLAB
824
39
function [ax] = plotPDF2D(x,y,data,figprefs) %plotPDF2D.m cmap = colormap(turbo); tickdir = 'out'; dobox = 'off'; xL = optCheck(figprefs,'xlims',[],[]); yL = optCheck(figprefs,'ylims',[],[]); xLbl = optCheck(figprefs,'xlbl','ISI(n) (ms)',[]); yLbl = optCheck(figprefs,'ylbl','ISI(n+...
26c6557565ab06458f6cc5464b88afe85cf8f36673075c1350550ebf659272d4
MATLAB
826
29
% Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024 function [R] = get_animalnames_and_micegroups_from_table(T) % This function returns a table that contains the unique pairs of % animalName and mouseGroup in the table T. uniqueAnimalNames = unique(T.animalName); uniqueMouseGroups = ...
28506271f96ce0a45adc8933b4e7f85459f86cf0062db66c6f04c37b296eaebf
MATLAB
826
27
function [Vout, Ydata, XYZ] = gretna_read_image(Path_filename) %========================================================================== % This function is used to read volume data of single nifti image. % % % Syntax: function [Vout Ydata XYZ] = gretna_read_vol(Path_filename) % % Input: % Path_filename: % ...
5b34d8d18c544b5f8a374b6d3f071586b693bb131d1e0eb169f86b1fa1344b37
MATLAB
826
40
function plot_individualExampleCheck(chunkAs, chunkBs, chunkDiffs, segData, csInfo, z, windowSize) csInfo(~csInfo(:,1),:) = []; for i = 1:size(chunkAs,2) csTime_beh = round(csInfo(i,2) * z.sr_b); start_chunkA_beh = csTime_beh - ((windowSize/2)*z.sr_b); end_chunkA_beh = csTime_beh + ((windowSize...
6f54772457a107f7355a70343c26c126cd243d063a740cd472a4fc826f59cbfe
MATLAB
826
29
function angles = ml_alg_center_out_angle_continuous_bias(width, height, nSamples) % This computes the samples of center out angles when points are % picked uniformly at random from rectangular maps of size nX by nY centerX = width/2; centerY = height/2; angles = nan(1, nSamples); r1 = rand(nS...
b2014ab0983a0f570a70ae98f325597da1adb5cfcf754ac4e8e75fb7583c83eb
MATLAB
826
23
function value = read_moving_window(moving_window_file,window_index,key) load(moving_window_file); moving_window_struct = window_cell{window_index}; if strcmp(key,'format_string') value = moving_window_struct.format_string; % elseif strcmp(key,'remaining_seconds') % value = moving_window_struct.remaining_sec...
edf3a6bf7f532fe9da68f59d9468fb3818ea2e9d48bca88b733405d14f84996f
MATLAB
826
29
classdef MLTrialInterface < handle %MLTrialInterface An interface for a session's trial % An interface for a session's trial methods (Abstract) getName(obj) getSliceId(obj) % id of this trial getTrialId(obj) getContextId(obj) getDigs(obj) % return ...
01d9b54a5ab245e5850becf95b782a1f8121d31d18e46cc1be946b167621eef6
MATLAB
827
36
function [S,lags] = spikeSurvivor(delta_mat,time_dim) %spikeSurvivor.m % inputs: % delta_mat: binary matrix, spike occurrence = 1 % time_dim: 1 if time down rows, 2 if time across cols % outputs: % S: vector (row, col for time_dim 2,1) % survival function up through max lag in delta_mat % lags: survival times at whic...
fba54c320c52003e1246134280e951d5311bc124a8a3f2e7bc6f29c5ed9c1038
MATLAB
827
25
function [task myscreen] = mglEyelinkCallbackNextTask(task, myscreen) % mglEyelinkCallbackNextTask % % Usage: mglEyelinkCallbackNextTask % IP - the ip address of the eyelink eye tracker, defaults to 100.1.1.1 % conntype - the connection type: 0 opens a direct link, 1 initializes a % dummy connection ...
0a66f74fe4135df1196222fe1c49a66c2cd81b1ffee6a04be1576c175bca44fe
MATLAB
828
21
function [ind1,ind2,ind3]=get_subsample(data,N,group, groupN,groupInd,Seed) test=rng(Seed) sizeG=floor(length(find(group==groupInd))./N); dum1=find(group(:,1)==groupN(1)); % HC dum2=find(group(:,1)==groupN(2)); ...
2a8c4ce1d3f849e81d7e38630230551f3df6f7486a46459d132d1a07acecb349
MATLAB
828
40
%select source and sink Ch source = [1:2 5:6 9:11] sink = [29:30 33:34 37:39] k = 1 for x = source; for y = sink; ch_comb(k,1) = x; ch_comb(k,2) = y; k = k+1; end; end; %load data = load('Connectivity_result.mat','GC_raw'); %extract targeted combination for i = 1:...
3446affbb7d6dbeb7c8cca0c8b5d5f8acbd05ceaa93cbe13066e04f9694ed780
MATLAB
828
17
function [sorted_eigen_values, eigen_vectors] = myPCA( matrix ) %get the eigen values and vectors to do PCA %mean center mean_centered = matrix - (diag(mean(matrix, 2))*ones(size(matrix))); %get the covariance covariance_matrix = cov(transpose(mean_centered)); %get the eigen values and eigen vec...
881c2c64ab389deefd7f94c709935c5c8eaac413dca5ac453116747a72bed021
MATLAB
828
25
function results = vl_test_colsubset(varargin) % VL_TEST_COLSUBSET vl_test_init ; function s = setup() s.x = [5 2 3 6 4 7 1 9 8 0] ; function test_beginning(s) vl_assert_equal(1:5, vl_colsubset(1:10, 5, 'beginning')) ; vl_assert_equal(1:5, vl_colsubset(1:10, .5, 'beginning')) ; function test_ending(s) vl_assert_equa...
904b6664da416ab000a389af58cb21f88cdc81cb989d930f177e38f5e2c4887f
MATLAB
828
24
function [ filteredTracks ] = FilterUniqueTracks(Tracks) %Takes a list of tracks and only keeps tracks that are unique % Detailed explanation goes here %fps = 14; filteredTracks = []; %find the frame after the first loss of track first_frame_lost = max([Tracks.Frames]); for track_index = 1:le...
ec1b6ccd774c9965b25a37c4b10d14bddd436866b5e32e61e5f350e78a0b523b
MATLAB
828
23
% COMPILE Script file to compile c-code sources and generate the DLLs % To compile the files, you will need copies of CED's machine.h and son.h. % These are proprietory and not included in the distribution. Contact CED. % mex -v SONGetADCData.c GetFilterMask.c mex -v SONGetRealData.c GetFilterMask.c mex -v SONG...
0d71d23aaa7e65069e802e465ffa79c3b5ccf65f16cc293b73acc960520ebc0c
MATLAB
829
26
function neighbours=st_get_default_neighbours(cfg) ft_checkconfig(cfg,'required',{'elec'}); cfg.minchanforneighbors = ft_getopt(cfg, 'minchanforneighbors', 3); numChan=size(cfg.elec.chanpos,1); minChansForNeighbors=cfg.minchanforneighbors; if numChan>128 min_neighb=3; elseif numChan>=minChansForNeighb...
6ca0cdca2629e94b8c05bde947d1a275f6d424cabcfc9ed910f5130084569edd
MATLAB
830
45
load fisheriris inds = ~strcmp(species,'setosa'); X = meas(inds,2:3); y = species(inds); SVMModel = fitcsvm(X,y) classOrder = SVMModel.ClassNames sv = SVMModel.SupportVectors; figure hold on gscatter(X(:,1),X(:,2),y) plot(sv(:,1),sv(:,2),'ko','MarkerSize',10) hold on hold on plot ([0 SVMModel.Beta(1)*2],[0 SVMMode...
1e0734fa044b312f7093a3267ce739998fd26c911c1636b90282c3817f93b5fb
MATLAB
831
24
function fix_SetFlySelected(handles,fly,v) % set the selected state for a fly % splintered from fixerrorsgui 6/23/12 JAB if fly <= 0, return; end if v, set(handles.hellipse(fly),'color',handles.colors(fly,:)*.5+.5,'linewidth',3); set(handles.hcenter(fly),'visible','off'); set(handles.hleft(fly),'visible','off'...
b9460e5479c78d2eeb8bb77d1b0033f8dcefd6b94b8fff968aa6cd365971c0d2
MATLAB
831
30
% mglFillRect - draw filled rectangle(s) on the screen % % $Id$ % usage: [ ] = mglFillRect(x,y, size, [rgb]) % by: denis schluppeck % date: 2006-05-12 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % inputs: x,y - vectors of x and y coordinates of center % ...
6e26c8d90b567096cdbb79c4dd7b56bfd6441825a21eb0bb19f98a75c98a8245
MATLAB
832
36
function [smat] = shuffle_isi_delta_mat(dmat,dim,scope) % shuffles the delta vec % zero regions pre-first/post-final spike left as is assert(ndims(dmat) <=2,'this fn is not ready for inputs of dim > 2') if dim == 1 wmat = dmat'; else wmat = dmat; end nT = size(wmat,1); switch scope case 'localFixed' % l...
8a640cfdc05914e866808a6883fb82fd9e7a0b2f611850b39dd33b85b0754c8d
MATLAB
832
30
function one_pixel_result=seg_eva_one_img(predict_mask, gt_mask, class_info) exclude_class_idxes=class_info.void_class_idxes; class_num=class_info.class_num; assert(all(size(gt_mask)==size(predict_mask))); gt_mask_vector=gt_mask(:); predict_mask_vector=predict_mask(:); if ~i...
2a812c71380407823bd870c73588b548b6608dff020fd1b786b88f96df044e05
MATLAB
833
25
% Get header of the system information % [ Yokogawa MEG Reader toolbox for MATLAB ] % % brief: % This function retrieves information of the system in the file specified file. % % usage: % system_info = getYkgwHdrSystem(filepath) % % arguments: % filepath : file path % % return values: % system_...
63f491a2b50a66a54c6ce246070d2984e10fd250942a1b64aba4ffb5ae50724b
MATLAB
833
29
function y=consolidateall(x) % CONSOLIDATEALL applies consolidate to all the cells of a nested cell arrays % % Syntax: function y=consolidateall(x) % % Description: % See description of CONSOLIDATE for details. By removing cell % encapsulation of all the cells in the cell array, CONSOLIDATEALL will % produce a dimensi...
702b6d5057625b504325a5f4b76112f76a40bd53537b963478f2e42431c82a3e
MATLAB
834
30
function [values,variance]=conditional(X,Y) % Returns the conditional values and variances of X given Y and Y given X. % The calculation is based on Pearson correlation values because % if the X & Y are jointly normal and r = 0, then X & Y are independent. % % FORMAT: [values,variance]=conditional(X,Y) % % INPUTS: ...
86c31a36b0ca32add56f779e10933598725302b280a8a5b5a997e3f661869820
MATLAB
834
12
% Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024 function [sessions] = get_sessions_and_cellnames_from_table(T) % Returns a unique table of animal name / session name pairs animalIndex = find(ismember(T.Properties.VariableNames, 'animalName')); sessionIndex = find(ismem...
fee35fdaeae24215a76ce6657970fd1e7aae3fd414add2289a6b5f44c27d9704
MATLAB
834
32
%% Params = readParams_dcm2niix_JSON(filename, Params) % % Input % -------------- % filenames : json file fullname, Params % % Output % -------------- % Params : parameters contains % % Description: % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 13 June 2018 % Date last mod...
8e07be095f358100e484d808d8ac5ca2efcf3c0da78e535490d15205f37f61a4
MATLAB
835
23
function [histogram histVals] = Vector2Hist(vector, numBins, min, max) % histogram = Vector2Hist(vector) makes a histogram of each row of the % vector. % numBins is the number of bins % min is the minimum value. This value is inclusive. % max is the maximum value. This value is exclusive(!). Thus, the largest % ...
1cd3887bae9c0cc55836dbca2fff77c8ba086a6b0e90b83efcc67243a8e791d1
MATLAB
837
30
function shadedErrorBar_95CI(data1,data2, removenan, filter) %inputs: % data1 % data2 % removenan true or false % filter medfilter 3 5 7 etc... if removenan == 1 %remove naN data1 = data1(~isnan(data1(:,1)),:); data2 = data2(~isnan(data2(:,1)),:); end if filter > 1...
5dfdf169a5efaf0ef962970009dc0c8a97aca84180b58c457c70adcb520ac8e5
MATLAB
837
36
function feedback = sampleFeedbackText(hitRate) if hitRate>0.8 answers = { ... 'Good job!', ... 'Well done!', ... 'You rock!', ... 'Excellent!', ... 'Amazing!', ... 'A++++!',... 'Outstanding!',... 'Superb!',... 'Brilliant!'}; elseif (hitRate>...
875a9c558ece5e37f068641e4ddda13015f4e2ee02fa1f99512ab758008d0b1f
MATLAB
837
26
%% LOAD [ds_events]= utils.load_ds_events('standard'); %% SPECIFIY PARAMETERS FOR CLASSIFICATION type='onsets'; param(1).type=type;param(1).stat='avg';param(1).extype='pure';param(1).exthresh=1; param(2).type=type;param(2).stat='avg';param(2).extype='pure';param(2).exthresh=1.5; param(3).type=type;param(3).stat='av...
8dcd6b2fd23ba96f72ba15384cdd01a6bc202812534f4bfd96c20d5add668a38
MATLAB
837
35
function v_Data = f_LoadF64File(pstr_FileName, ps_FirstIndex, ps_LastIndex) if nargin < 1 return; end s_FirstIndex = 1; s_LastIndex = -1; if nargin >= 2 && ~isempty(ps_FirstIndex) s_FirstIndex = ps_FirstIndex; end if nargin >= 3 && ~isempty(ps_LastIndex) s_L...
65988e4e369e2e3d420dc4fe729e2b3e8a2dd504786d24cd3259a65f87fe0578
MATLAB
838
38
function results = vl_test_cummax(varargin) % VL_TEST_CUMMAX vl_test_init ; function test_basic() vl_assert_almost_equal(... vl_cummax(1), 1) ; vl_assert_almost_equal(... vl_cummax([1 2 3 4], 2), [1 2 3 4]) ; function test_multidim() a = [1 2 3 4 3 2 1] ; b = [1 2 3 4 4 4 4] ; for k=1:6 dims = ones(1,6) ; dim...
fea43da29d611a705191ee8087a09cbe4a268b90d9682913e1a26e81f05e8388
MATLAB
838
25
%SAD %% Coming from wrapper i=1 path_to_tc %% Template options.params.cutoff=1; options.params.lags=0; options.params.autocorrelation=0; options.params.concurrent=1; options.params.pass_th=0; options.perc=[0.6 0.4]; % options.perc=[handles.connectotyping_settings.partition_model handles.connectotyping_settings.partitio...
0eb381896f36d237a8eabe7ad83f7723f56e81bc29cbc7f05dbf93595484b08e
MATLAB
839
19
% VL_AIBHIST Compute histogram over VL_AIB tree % H = VL_AIBHIST(PARENTS, DATA) computes the histogram of the data % points DATA on the VL_AIB tree defined by PARENTS. Each element of % DATA indexes one of the leaves of the VL_AIB tree. % % H = VL_AIBHIST(PARENTS, DATA, 'HIST') treats DATA as an histograms. % In ...
7a7c5d595d79b31e091bf4628ebd7fee53b2b8f0b65e3415447c1eff9602a246
MATLAB
839
19
function [impad] = padReflect(im,r) % function [impad] = padReflect(im,r) % % Pad an image with a border of size r, and reflect the image into % the border. % % David R. Martin <dmartin@eecs.berkeley.edu> % March 2003 impad = zeros(size(im)+2*r); impad(r+1:end-r,r+1:end-r) = im; % middle impad(1:r,r+1:end-r...
0c262e556d8d578ad8d1e93dc9fd8ac6c1e03a92d3ad6d07606ddb088f0defec
MATLAB
841
25
function [imuOffset_s] = ml_inscopix_gpio_extract_imu_timeoffset(fn) if ~isfile(fn) error('The file (%s) does not exist. Can not extract the IMU time offset from it.', fn); end T = readtable(fn, 'FileType', 'text'); % After I had figured this out, Qing from Inscopix said that he used %...
0e73855087e3a6fbe88d6006ec959db78f32372ed551da610bb3bc6d17dfd6aa
MATLAB
841
41
function writetoPAJ(CIJ, fname, arcs) %WRITETOPAJ Write to Pajek % % writetoPAJ(CIJ, fname, arcs); % % This function writes a Pajek .net file from a MATLAB matrix % % Inputs: CIJ, adjacency matrix % fname, filename minus .net extension % arcs, 1 for direct...
2c7964e8871157d0d219c460f5c4ebbc71566fd281a27fb08a5a8758cee5ef9f
MATLAB
841
27
function value = read_FD(FD_file,FD_threshold,key) if FD_threshold > 0.5 disp(['Input FD threshold (' num2str(FD_threshold) ') is greater than the maximum tested against (0.5)']) return end load(FD_file); FD_struct = FD_data{floor(100*FD_threshold)+1}; if strcmp(key,'format_string') value = FD_struct.for...
bc5ed7489a5c81862d667bf8f17504b730a55d71f4c43ed78b9821a264f98c90
MATLAB
841
25
function [segments, new_labels, label_num] = mexSLIC(cluster_colormap,desiredRegions,regularizer) % Gathering some information [height, width] = size(cluster_colormap(:, :, 1)); % Get the segments from the SLIC algorithm. % [pix_label, label_num] = my_slic(double(cluster_colormap),desiredRegions,regularizer,1);...
eab0e2a43b72f41ff8092c6abefef7fd13cbee40f5a54825858b6b3610c2a1ed
MATLAB
841
46
% % Predict Euclidean predictions. The result is the negative Euclidean % distance in the matrix M with MM' = U abs(D) V'. % % RESULT % prediction (e*1) Prediction values % % PARAMETERS % u (m*r) Left eigenvectors % d (r*r) Central matrix % v (n*r) Rigth eigenvectors; may be [] % at (e*2) Pairs of vertices to ...
4c8105010b4feb8eadb8c0a168d8f7091a263439bf72691d95476a80e9659e49
MATLAB
843
24
function [] = plotDiGraph(probe) %PLOTDIGRAPH Plots arrows between neighboring modules % Detailed explanation goes here % display the directional graph. If a node is not connected, only a dot % will be displayed over the module's centroid. h = plot(probe.G,... 'XData',probe.modules(:,1),... ...
4eb03a449ff04b15c176de103e9827ca699f4d65d7214f12a4154b928276ee0e
MATLAB
843
37
Adapts code from: https://github.com/trendscenter/gift %Define command line arguments. function [results] = elbow_k(X,klist,clusts,cents) %Collect WCS and CVI. SSE = zeros(1, length(klist)); R = zeros(1,length(klist)); %Evaluate clustering performance. for i=1:size(klist,2) %Set up values. idx = clusts...
86b84f8b54b192c77bbf9b8d5d9da278e7ea7ea4da8c35c401824cc66db95f40
MATLAB
843
19
% VL_BINSEARCH Maps data to bins % IDX = VL_BINSEARCH(B, X) maps the elements of X to the bins % defined by B. B is a non-decreasing vector of M real numbers % defining bins [-inf, B(1)), [B(1), B(2)), ... [B(M) +inf] (note % that the last bin contains +inf). The bins are numbered from 0 to % M. X is a real ...
4e2d9719f74d674ed6cddaa2a90f5da806f69acab768c8bb3ddac34c08fa495b
MATLAB
844
28
function oIm = Rgb2Ooo(rgb) % oppIm = Rgb2Opponent(rgb) % % Transforms an RGB image into an opponent color image. No normalization is % done and should be done afterwards. % % rgbIm: N x M x 3 Rgb image. Doubles in range 0:1. % % oppIm: N x M x 3 Opponent Image. Doubles again. % % Jaspe...
a9d5261b6c1dfb91824de80dac992dd7bc748d932ffeb070cf3fbdf1fed937e9
MATLAB
844
22
strcts = {'Th', 'CN', 'Pu', 'GP', 'Hpc', 'Amg', 'Acb'}; slctd_strc = [1,2,4]; %% multivariate regression Y = squeeze(modulationIdx(:,4,:)); % to get the HLM values of 4 conditions separetely X = LV(setxor(1:35,[23,28]),slctd_strc); %subjects 23 and 28 are excluded- the selected structures from the model are used in mvr...
c170a5b3c1121165641e6dd2398717eb0efeabaabcbe40612e4c0290ecb8c20b
MATLAB
845
21
% FH_NBDetect_vm_getParam.m % Get algorithm parameters from user input function [NBDetectParam, flag] = netBurstDetection_uigetParam() % initialize variables (in case they are not assigned) NBDetectParam = struct('th',[],'IBeIThDef',[],'sf',[]); % user inputs PopupPrompt = {'No. active electrodes threshold [%]','IBeI ...
dd07bef028f3ae085f73fc0cb4a7948f54c6903e56129ea93f6f78379dac08df
MATLAB
845
33
function [mdl,dt,p] = runExpFits(isi_pdf,isiLags,run_parfor) %runExpFits.m if ~exist('run_parfor','var') run_parfor = true; end n = numel(isiLags); mdl = cell(n-1,1); dt = cell(n-1,1); %outputs tables p = nan(n-1,1); disp('running ISI pdf fits') if run_parfor poolobj = gcp; % start if not started yet parfor...
36ba1e13c006c5ed08e93374cf7525e4f6f18e770fcc0ff28d3d1617ea560877
MATLAB
846
28
function status = LPCNN_savemat(freqMap_file_mat) [data_path, base_name, ~] = fileparts(freqMap_file_mat); freqMap_file = fullfile(data_path, base_name); mask_file = fullfile(data_path, [base_name, '_mask']); dipole_file = fullfile(data_path, [base_name, '_kernel.mat']); if ~exist(dipole_file, 'file') S =...
e061a1530efa72e2c79ddf62e9d3ed3d6f003be76a857a70d252a5edd1e9443b
MATLAB
846
33
function fwrite3(fid, val) % % fwrite3.m % % Original Author: Bruce Fischl % CVS Revision Info: % $Author: nicks $ % $Date: 2011/03/02 00:04:12 $ % $Revision: 8776 $ % % Copyright © 2011 The General Hospital Corporation (Boston, MA) "MGH" % % Terms and conditions for use, reproduction, distribution and contr...
11df0000640784659548489087fa5dc638733a68edd955370fb92067804d78b3
MATLAB
847
31
function M = Q2M(Q) % Generate a rotation matrix from a quaternion xi+yj+zk+w, % where Q = [x y z], and w = 1-x^2-y^2-z^2. % See: http://skal.planet-d.net/demo/matrixfaq.htm % _______________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging % % $Id: Q2...
dc564e38ce6676415a0cbd702af986051b6480374a75f7ad0f3cfc5d928535d8
MATLAB
847
39
function Y = staticExpComp(X, n, verbose) % Function to apply static nonlinearity (power-law) to pRF timeseries % % Y = staticExpComp(X, n, verbose) % % INPUTS % X : (vector) predicted time series (1 x time points) % n : (scalar) power law exponent (n<1 implies comppression) % verbose ...
46538ab55a65fb5be06d7d0dcf3a4e1136446beeef7bb471315481927622026a
MATLAB
848
37
function len = strlen(str) % len = strlen(str) % compute the # of characters in str (ignoring 0s at the end) % % strlen.m % % Original Author: Bruce Fischl % CVS Revision Info: % $Author: nicks $ % $Date: 2007/01/10 22:55:10 $ % $Revision: 8776 $ % % Copyright (C) 2002-2007, % The General Hospital Corporati...
8f6a4981b3934230b3125ac2ece09b1f220bee0d38817479869b92a03216d1f5
MATLAB
849
27
function output_removal_vector = outlier_censoring(wb_command, dtseries, input_removal_vector) outlier_removal_vector = zeros(size(input_removal_vector,1), size(input_removal_vector,2)); [status,cmdout] = system([wb_command ' -cifti-stats ' dtseries ' -reduce STDEV']); if status ~= 0 return end % parse standard...
b9db63d5da763d3b755371e1535c74ad03f148ffffd5f4f37746e0f5738db3b5
MATLAB
850
37
%Incomplete %ft_timelockanalysis (event-related field vs time) of ft_freqanalysis %(oscillatory activity power/coherence vs frequency) figure; cfg = []; cfg.channel=planars; % cfg.layout = 'neuromag306all.lay'; cfg.channel='MEG2032+2033'; cfg.baseline = [-2.3 -1.3]; cfg.xlim = [-1.3 -0.3]; cfg.ylim = [-3e-12 3...
dfe7b21ce1484462171be670366f6f15e6f28c1e1ca9301ff7dbf5970046827d
MATLAB
850
33
function d = vl_numder2(func, x, varargin) % VL_NUMDER2 Numerical second derivative % D = VL_NUMDER2(FUNC, X) computes the numerical second derivative of % the function FUNC at point X. % % D = VL_NUMDER2(FUNC, X, ARG1, ARG2, ...) allow to pass extra % parameters to the function FUNC. % % See also: VL_NUMDER...
f5d95f7f43ccd259eb24688553870ed1f6a8e89f1f0be00a7eed1e3fafe43252
MATLAB
850
33
function [stimuli,minFeedback,maxFeedback,lAlB,nT,nE]=f_loadStimuli(nH,alpha,beta) % load stimuli block=1; % block within horizon stimuli=load(['hor',num2str(nH),'_block',num2str(block),'.txt']); stimuli=stimuli(:,2:end); stim=nan(size(stimuli)); temp1=zeros(size(stimuli)./[1,2]); for i=1:size(temp1,2) ind=(1:2)+...
3b64bb5fa562ce93f6d770587b51ba75dcd835bb6a72c7c11cb73c12d87376ce
MATLAB
851
39
function Indexes = personFold(numSamples, labels, folds) %number of people % numPeople = numel(unique(labels)); %number of people per each fold % IndPerFold = ceil(numPeople / folds); %assign fold number for each person %compute fold per person for each possible person %(there might be missing individuals) allPeopl...
3e75a295ba66f436cb05009137c2fa640e4de43f3e6f06b865de396215cc4c7c
MATLAB
851
36
function [fconn_text, T] = encode_time_min_list_biceps(path_gui_env_list) %% bef{1}='FD_th_'; bef{2}='min_frames_'; bef{3}='TRseconds_'; aft{1}='_min_frames'; aft{2}='_skip_frames'; aft{3}='.txt'; n=numel(aft); bet=cell(n,1); bet_num=nan(n,1); old='_'; new='.'; T=nan(1,3); for i=1:n bet{i}=extractBetween(path_...
ac6ba161833309851a5d9c65212e2a1f833f730fd3daf5a62fb826ba79c1bfcd
MATLAB
851
34
function [P1,P2] = vl_clicksegment % VL_CLICKSEGMENT Select a segment by clicking % [P1,P2] = VL_CLICKSEGMENT() lets the user select a segment in the % current figure and returns the starting and ending point P1 and P2. % % The user can abort the operation by pressing any key. In this case % the function returns t...
9f66fb305664820eee150a5eb149456709238309ec8c5c1260157673f29ac97b
MATLAB
852
36
function [M] = ml_nlx_convert_header_to_struct(Header) H = Header; % Find the empty cells indEmpty = find(cellfun(@isempty, H, 'Uniformoutput', true)); H(indEmpty) = []; % meta info lines containing creation information indMeta = find(cellfun(@(x)(~strcmp(x(1), '-')),H)); H(indMeta...
2731e9ee631c4aee91ebf337d2d5f1ed72498cb9a56713870131bedc07ed5931
MATLAB
853
27
function exclude_uncertain_cells(info,clustering_info) excluded_cells = union(clustering_info.excluded,clustering_info.uncertain); cd(strcat(info.servernum,info.savepathstr,info.mouse,'\',info.date)); disp('Select the folder where dff/z_dff are saved...'); dff_directory = uigetdir; cd(dff_directory) load('dff.mat'); ...
2c2cf7c112e6a761f620d8ae860db07a6c045b05e5fe312a351480f5126ccbb0
MATLAB
853
39
function s = miniBatchSum(argMagic, zaso, fct, zasoIdx) % uses zaso.nMiniBatch to obtain a sequential segment of samples. % use the first sample to switch argMagic case 1 miniX = zaso.X(1); s = fct(miniX); case 2 miniY = zaso.Y(1); s = fct(miniY); case 3 miniX = zaso.X(1); miniY = zaso.Y(1); s = fc...
46f43810c57f8fc3b85f83ddafb98a2ccd78c4c1584699acdf21f1d82b8ab0bc
MATLAB
853
32
function cfgPath = getConfigFilePath(verbose) % Return file path to the config (token) file % % function cfgPath = webupload.getConfigFilePath(verbose) % % Inputs (optional) % verbose - false by default. If true, reports the path to the file if found % if nargin<1 verbose = fals...
a1758d15aa0dabd468fe705627bdf4d5fcbeaf06f7812a50f9700a80b0c660d5
MATLAB
853
35
function tf = isDICOM(filename) % Open the file -- You can do this in the native endian type. fid = fopen(filename, 'r'); fseek(fid, 128, 'bof'); if (isequal(fread(fid, 4, 'char=>char')', 'DICM')) % It has the form of a compliant DICOM file. tf = true; else % It may be a DICO...
3c722c32b190bc28f66f47875995cabfc59d822e9842cb7a5e01664d42651ab1
MATLAB
854
31
function [RandSphere] = randUniformSphere(N, p) % This function generate the random samples uniformly on a dim-dimensional % sphere. % % Usage: % [RandSphere] = randUniformSphere(N, p); % % Inputs: % N: The number of samples one wants to generate. % % p : The dimension of the generated samples. % p==2 => ...
1092ee55e09959f4b4f9f6813b23752050c17edddd205e2d065c2c394bffa039
MATLAB
855
41
function H = ml_mclust_readheader(fp) % H = ReadHeader(fp) % % Reads NSMA header, leaves file-read-location at end of header % % INPUT: % fid -- file-pointer (i.e. not filename) % OUTPUT: % H -- cell array. Each entry is one line from the NSMA header % % Now works for files with no header. % ADR 1997 ...
1a0baafcd99af795d0ec06c29b8d5f9582e0c26dbbecb2b0c2dd7ad4e52564bf
MATLAB
856
21
function result = struct_with_shape_and_fields(shape, field_names) if isempty(field_names) , empty = struct([]) ; result = reshape(empty, shape) ; else empty = cell(shape) ; %#ok<NASGU> argument_list_as_string = '' ; field_count = length(field_names) ; f...
3cfe57f3ab1c867383ea298b742b4b65275879bb35446db69f64b4a239d02d7f
MATLAB
856
35
% mglMinimize.m % % usage: mglMinimize() % by: justin gardner % date: 08/11/2023 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: minimize the mglMetal window % usage: mglMinimize % To restore: mglMinimze(1); % % mglOpen; % mglMinimize; % fun...
b0329dba23623ef5df54e6b52effe95ecfc5995f31dc181013b9866fca816f8a
MATLAB
856
43
function freqSpec(data, samplerate) % Plot the requency spectrum of all channels in a signal --> default 32 % channels plotSize = [8,4]; fs = figure(); %fs.Visible = 'off'; ka = tight_subplot(plotSize(1),plotSize(2),[0 0],[0 0],[0 0]); for i = 1:size(data,1) sig = data(i,:); % Calculate L = length(...
778e0ab646e51375556a1e80b0389b05b3c677ecfafe94479182853afe072e0e
MATLAB
857
26
function [] = C4_select_indiv_RFT_ROI() % Topoplot ROIs for individual subs and select the best roi roi_topoplot_path = 'Z:\Load\Results\FieldTripPlots\ROI\'; save_path = 'Z:\MATLAB\Perceptual_Load\FieldTrip\Results\group_level\RFT\ROI_RFT\'; chos_roi_L = nan(35,1); chos_roi_R = nan(35,1); %plot ranks of colors clm...
7ef7bf66bd896b579171709cab03ad14eae25bc26310ca2b90618c2baded025a
MATLAB
857
39
function rgIm = Rgb2Rgi(rgbIm) % rgIm = Rgb2Rg(rgbIm) % % Transforms RGB image into normalized RGB. Note that the B channel is % redundant as R+G+B = 1. % % rgbIm: N x M x 3 Rgb image. Doubles in range 0:1. % % rgIm: N x M x 3 Opponent Image. Doubles again. % if isa(rgbIm, 'uint8') ...
8d210f1372e4e0fc167cb39ab30563963ef6d75ba33572b95cef82211ae304d1
MATLAB
859
26
function setExternalStatus( obj, value ) % Change status of external data. % % Syntax: % SETEXTERNALSTATUS( obj, value ); % % Input parameters: % * obj - object containg data % * value - true or false % % Example: % SETEXTERNALSTATUS( obj, value ); % % Available at: https://github.com/NCN-Lab/DBScope % For r...
476f75d49749a3cc0173abc8c17844016ca768fec739680dcdb3709b3740775f
MATLAB
860
42
function rgIm = Rgb2Rg(rgbIm) % rgIm = Rgb2Rg(rgbIm) % % Transforms RGB image into normalized RGB. Note that the B channel is % redundant as R+G+B = 1. % % rgbIm: N x M x 3 Rgb image. Doubles in range 0:1. % % rgIm: N x M x 3 Opponent Image. Doubles again. % if isa(rgbIm, 'uint8') ...
a24a8dc32733891d853527d35f13246eea087fb36c230b1399cdb4a45cc969ba
MATLAB
860
38
% VL_DEMO_MSER_DELTA Demo: MSER: delta parameter randn('state',0) ; rand('state',0) ; I = zeros(100,500) + 255 ; for i=1:5 I((1:50) + 25 - 1, ... (1:50) + 25 - 1 + 100 * (i-1)) = ... 255 - 32 * i ; end I = uint8(I) ; figure(1) ; clf ; axes('position',[0.05 0.05 1-.1 2*1/5-.1]) ; plot(I(end/2,:),'linewidth...
47d8adf31a59e957b36aba7cfbd2fbb354f28f99aaa8033f5fa0a7f6f51eb621
MATLAB
861
23
function CoD = computeCoD(data,prediction) % Function to compute coefficient of determination (also known as variance % explained or R^2). % We define CoD as the RESIDUAL sum of squares / TOTAL sum of squares. % % Compared to computing the ordinary R^2 (which does not care about % predicting the mean correctly): % ...
4cddab6b24c7c0e2be1d0ae67eb3581e1a3836be589e5d9b33bf9dd0cc03f89b
MATLAB
861
34
% computeLinearPrediction.m % % Function that uses linear filter and input signal to produce an predicted % output by convolution. % Filter and input must be on same time basis. % Run after running computeWienerKernel() % NOTE: NaNs okay in input, just means that predicted output will also have % NaNs % % INPUTS: % ...
59b2c72548a19d8a189c4f65d7044357e7cd7783ab544fa5e78bdece3f1d8fcb
MATLAB
861
34
function d = idummy(x, method) %DUMMY Creates a matrix of dummy variables for a discrete variable % D=IDUMMY(X,METHOD) creates an array D of dummy variables for the % grouping variable I (integers 1,...,g), using the method specified: % % method = 1: 0/-1/1 coding, full rank % method = 2: 0/1 coding, full ...
924980d25c71cbd5ebb21866538a92fcfa02b5578d77ccd7fa0dd65c9a04b1d5
MATLAB
861
1
function Dif = CalcAngleDif(Data, StepSize) % StepSize MUST be > 0 % This function is identical to CalcDif, except for the fact that it accounts for % the periodic nature of Data about +/-180 deg. % For detailed documentation see CalcDif. Len = length(Data); HalfStepHi = ceil(StepSize/2); HalfStepLo = floor(StepSiz...