sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
5229f64d10619f4efe5f147b85d510e1645dac153e931b0a034dcc89525d3b11
MATLAB
1,437
40
function[rand_resp,pv_resp,som_resp,som_onsets,pv_onsets,ex_onsets,ex_resp,ex_type] = extract_onsets(cur_onsets,ds_events,d,ex_thresh) pv_count=0; som_count=0; ex_count=0; for o = 1:length(cur_onsets) data=cur_onsets(o).data; %dff=cur_onsets(o).dff; rand_resp(:,:,o)=cur_onsets(o).randdata; ...
659bc565ed4babaed9a274fc27dcc4f4aea867543d6727b35e4bab42c7369c1e
MATLAB
1,437
46
%Sample code %Davor Curic, 2023, Complexity Science Group, University of Calgary % %This calculates the hilbert transform/phasespace representation of the %data tic() load("mask.mat") corticalPixels = find(mask == 1); %these are the pixels corresponding to the cortical surface %load the recording load('Sam...
87950b98be1071ce811bf49494681d35352cdd28c01f0f9eedfd47a563edb2c7
MATLAB
1,437
39
function[]=SONUpgradeToVersion6(fid) % Obsolete function % Upgrades SON file ADC and ADCMark data to SON version 6. % File header date and time fields are not upgraded % The file header creator field is set to 'MAT-TO-6' but only if it is '00000000' to begin with. % IT IS RECOMMENDED THAT YOU BACKUP FILES BEFORE ...
b3d6c9ef7b04714c3e178fe1ff6428a83ec57067a07a4758c7ccdc0b56920058
MATLAB
1,437
31
% SONGETEVENTDATA returns the timings for an Event or marker channel % % Implemented through SONGetEventData.dll % % [npoints, times, levlow]= % SONGETEVENTDATA(fh, chan, maxpoints, stime, etime{, filtermask}) % % INPUTS: FH = file handle % CHAN = channel number ...
fffc7a0dc6fcb728435a8ddee7e9dc1a6fd10416f035c0ce87f9a136427f0ee9
MATLAB
1,438
58
function [latencies,touch_idx,FR_prev_tmp]=Latencies(touches,touches_whisker,psth,do_plot,subplot_idx) %this code assumes that the input is dk1 and dk2 counter=1; upto=50; latencies=[]; touch_idx=[]; FR_prev_tmp=[]; Ntrials=size(touches,1); for trial=1:Ntrials idx=find(touches(trial,:)); for t=1:size(idx,2)...
1b7ed1a4bd05a251b443cc40ccb79dee356fda7a6325bd407b140c20b64402d1
MATLAB
1,439
57
% quick and dirty plot of single leg trials for given fly % load file first % some params % numTrials = 5; whichTrials = 16:20; numParams = 2; numDurs = length(durs); % numDurs = 1; legInd = 1:6; whichND = 1.3; whichNDInd = find(whichND == NDs); % number of rows and columns of subplots numRows = numTrials; numCols ...
963a6ec83528f4707c0268a80a60b690b4283c50d3ffe73c80f14cc35ab830c9
MATLAB
1,440
68
function [sigma,p] = returnCorrectSigma_sparse(ds,perplexity,tol,maxNeighbors) %returnCorrectSigma_sparse is used by findTDistributedProjections_fmin.m to %find the correct transition probabilities given a set of distances if nargin < 2 || isempty(perplexity) perplexity = 32; end if nargin < 3 ||...
b40721bebf3a16876243322eb0903ef56aee24c575f598edb3a3e54654c58cfc
MATLAB
1,440
34
function [ Behaviors ] = circshift_triggers(Behaviors, BTA_seconds_before_and_after, fps, randomize, remove_edge) % Shifts the triggers for each track randomly and removes any behavior % transistions that are too close to the edge if the options call for its if nargin<4 randomize = false; end if nar...
92ec43cbd64fb3ea8f290dfbc99eb03413dc3298badfb9bf5661cc6b1b1d5906
MATLAB
1,443
38
function ret=SONSetRealChan(fh, chan, sPhyCh, dvd, bufsize,... comment, chantitle, scale, offset, units) % SONSETREALCHAN creates real wave channel % % RET=SONSETREALCHAN(FH, CHAN, SPHYCH, DVD, BUFSIZE,... % COMMENT, CHANTITLE, SCALE, OFFSET, UNITS) ...
e496306d659ac978aea1f256abbfa04448339477ff280a8283fa5f8709e8df54
MATLAB
1,443
40
% getCatStepVals.m % % Helper function for saveLegStepParamByCond_fly() % Returns step values, as well as leg calls for selected amp and % dur, given keys. Operates on single vectors % % INPUTS: % stepValAll - vector of all step param vals, length n % whichAmp - amplitude value to select for % whichDur - duratio...
06f65d8523f5cacb96fb7f59e5554194e484471f02f203fc819d94f721a104ef
MATLAB
1,444
53
% % Plot one Lorenz curve. % % PARAMETERS % p (e*1) Node indexes % q (e*1) Multiplicities; [] to denote all ones % b 1 for bare, else 0 % type One letter [auv]; determines the plot color % function lorenz_one(p, q, b, type) font_size = 18; colors = konect_colors_letter(); color_line = colors.(type); color_fill...
f3320c5a050270b95aac8edceeeaa96227a3aa25fcb3ce860cd5a56586482e8c
MATLAB
1,444
41
classdef CleanupGuard < handle % Runs a task when it goes out of scope, unless it was disarmed first % % guard = webupload.CleanupGuard(@() delete(file)); % ... work that may fail or be interrupted with Ctrl-C ... % guard.disarm(); % the work succeeded, the task is no longer wanted % % Pur...
3434701fb45b9918504ce8fd992a5bca557bf276135ec861960d96dd7d22b932
MATLAB
1,445
50
function M=find_motif34(m,n) %FIND_MOTIF34 Motif legend % % Motif_matrices = find_motif34(Motif_id,Motif_class); % Motif_id = find_motif34(Motif_matrix); % % This function returns all motif isomorphs for a given motif id and % class (3 or 4). The function also returns the motif id for a given % motif m...
6b6553546acbc394536a0e52144b9e134b0e94411f52b077f32078cd8cf2dad1
MATLAB
1,445
37
clear %load F1s.mat filenames = {'PFC4_15Hz_part11','PFC4_15Hz_part12',... 'PFC4_15Hz_part21','PFC4_15Hz_part22'}; radii = [3:7]; SNRs = [7:4:31]; [list_Recall, list_Precision, list_F1] = deal(zeros(length(filenames),length(radii),length(SNRs))); parfor n = 1:(length(filenames)*length(radii)*length(SNRs)) [p,q,r] ...
81246fb9b6ea5447aa58a46a22ef7343fd5cce4bbfe79a5b530c69bdb78e30f9
MATLAB
1,445
67
function ds_info=gen_dataset_info(ds_config) if ds_config.use_custom_data ds_info=gen_ds_info_custom_data(ds_config, ds_config.class_info); else cache_dir=ds_config.ds_info_cache_dir; cache_file=fullfile(cache_dir, 'my_dataset_info.mat'); if ~my_check_file(cache_file) ds_info=...
d765ddc3b75365e32bc467ef212b210f2088e63d4d44561235c4fc064a79544b
MATLAB
1,445
46
%% Main Motion Censoring Function function logical_removal_vector = power_2014_motion_censoring(FD_vector,DVAR_vector,FD_threshold,DVAR_threshold,skip,expected_contiguous_frame_count) % Caluclate and combine the FD and DVAR removal vectors FD_removal_vector = censor(FD_vector,FD_threshold); DVAR_removal_vector = cens...
94b8c114dc8a753a3062665f7e27d0ce94e6b49e78d1f840397d4be7c4ab8966
MATLAB
1,446
40
%{ Copyright (C) Cambridge Electronic Design Limited 2014 Author: James Thompson Web: www.ced.co.uk email: james@ced.co.uk, softhelp@ced.co.uk This file is part of CEDS64ML, a MATLAB interface to the SON64 library. CEDS64ML is free software: you can redistribute it and/or modify it under the t...
c22c419ab236a55075dc5de50a73bc0cbf7b6dd307304c732e39c094dc281b38
MATLAB
1,446
54
function vl_help(topic, varargin) % VL_HELP VLFeat toolbox builtin help % VL_HELP('doc') displays the HTML documentation in MATLAB % web-browser. VL_HELP('vl_function') displays the HTML % documentation relative to the specified funtion. VL_HELP('topic') % displays the HTML documentation relative to a particu...
273651137dabbe7ae1fb2fffdf10e3dabeaa056056fee9372586c6b8724ee88f
MATLAB
1,447
51
function [sortRes, sizeRes] = sortFilterResponse(gaborBank, powerMapF) %put powermap info in one-d vector %get number of pixels in powermap sizeTmp = 0; for g = 1 : numel(gaborBank) s = size(powerMapF(g).value); sizeTmp = sizeTmp + (s(1) * s(2)); end %for g = 1 : numel(gaborBank) tmp = zeros(sizeTmp, 6); %init...
fa730265b46c268389077c08208d31dc77d85649b268b455d21264d235b58d3f
MATLAB
1,447
49
function results = vl_test_printsize(varargin) % VL_TEST_PRINTSIZE vl_test_init ; function s = setup() s.fig = figure(1) ; s.usletter = [8.5, 11] ; % inches s.a4 = [8.26772, 11.6929] ; clf(s.fig) ; plot(1:10) ; function teardown(s) close(s.fig) ; function test_basic(s) for sigma = [1 0.5 0.2] vl_printsize(s.fig, s...
e82fe43a291c73fe5f529815eb139278031f8324437f987c061a121204281030
MATLAB
1,448
37
clear %load F1s.mat filenames = {'bma22_epm_part11','bma22_epm_part12',... 'bma22_epm_part21','bma22_epm_part22'}; radii = [6:1:10]; SNRs = [7:4:27]; [list_Recall, list_Precision, list_F1] = deal(zeros(length(filenames),length(radii),length(SNRs))); parfor n = 1:(length(filenames)*length(radii)*length(SNRs)) [p,q,...
1991d92f5a98068bf2a17a61d82d719afbbfe79ab9e062f99de6bae2f093c28d
MATLAB
1,449
37
clear %load F1s.mat filenames = {'sim_0','sim_1','sim_2','sim_3','sim_4',... 'sim_5','sim_6','sim_7','sim_8','sim_9'}; radii = [4:8]; SNRs = [3:4:23]; [list_Recall, list_Precision, list_F1] = deal(zeros(length(filenames),length(radii),length(SNRs))); parfor n = 1:(length(filenames)*length(radii)*length(SNRs)) [p,q...
2fb5e9d2d6dc9ada9ccf419966aeb211821cc6f1194a6fdc0ce08afb35b90735
MATLAB
1,450
40
%{ Copyright (C) Cambridge Electronic Design Limited 2014 Author: James Thompson Web: www.ced.co.uk email: james@ced.co.uk, softhelp@ced.co.uk This file is part of CEDS64ML, a MATLAB interface to the SON64 library. CEDS64ML is free software: you can redistribute it and/or modify it under the t...
459bb5db443efaf39861c74bf52784b458af4ae2bd9118ec6848722e9c051ead
MATLAB
1,450
41
function [shape] = read_ctf_shape(filename); % READ_CTF_SHAPE reads headshape points and header information % from a CTF *.shape teh accompanying *.shape_info file. % % Use as % [shape] = read_ctf_shape(filename) % where filename should have the .shape extension % Copyright (C) 2003, Robert Oostenveld % % This fil...
da3ab04dbe5aacfe11aa1fb781cc8a0bcbd348091b33d1ec85e8ac5534c21c89
MATLAB
1,450
37
function [argout] = mxDeserialize(argin) % MXDESERIALIZE reconstructs a MATLAB object from a uint8 array suitable % for passing down a comms channel to be reconstructed at the other end. % % See also MXSERIALIZE % Copyright (C) 2005, Brad Phelan http://xtargets.com % Copyright (C) 2007, Robert Oostenveld ht...
880841b589c1bd3153e14490821a750e1a240fa36a5b099ff5aeb2b133ff4202
MATLAB
1,451
51
function [params, result] = ortho_sparse(params, W, w) % Sparse DSS orthogonalization function % Assumes that the projection vector has only few non zero items % W = orthof(W) for symmetric dss % w = orthof(W, w) for deflation dss % W Matrix with projection vectors as rows. For deflation % algorithm ...
762f0bd00870225bd4541512e47384f7be22bc2ff3ba1857d3b5d848d1234384
MATLAB
1,452
51
function width = fwhm(x,y) % % Full-Width at Half-Maximum (FWHM) of the waveform y(x) % and its polarity. % The FWHM result in 'width' will be in units of 'x' % % % Rev 1.2, April 2006 (Patrick Egan) % Rev 1.3 Mei 2019 (Muhammad Mahdi Ramadhan, Universitas Indonesia) y = y / max(y); N = length(y); lev50 ...
8fc52b1618a1ccd8f3151b83ae66b071cc2c9c0202aeedc3df7fcc41a8f81fae
MATLAB
1,452
59
function [averageMap, rotSeqRec, rotSeqVal] = ml_compute_best_map_rot_sequence_and_average(pmSet) nMaps = size(pmSet,3); if nMaps == 0 averageMap = []; rotSeqRec = []; rotSeqVal = nan; return end R = nan(nMaps, nMaps); rho = nan(nMaps, nMaps); for iMap1 = 1:...
0f8988dca36439195c8f54d105dfb49e89b05280c0dabe2c9b29219ff7f77653
MATLAB
1,453
46
function [quality] = ml_cai_quality_all_one_led(t, x1, varargin) p = inputParser; p.CaseSensitive = false; check_t = @(x) isnumeric(x); addRequired(p, 't', check_t); check_x1 = @(x) size(x,2) == 2 && isnumeric(x); addRequired(p,'x1', check_x1); N = length(x1); addParameter(p,...
a3953235cd6375b00dfec286d004f34d9e4022665a47c864bca8ffeb60ffada6
MATLAB
1,453
49
% getExptName.m % % Helper function called by computePData_trial.m that turns full trial path % into an experiment name struct, with fields for the date folder, fly, % fov, and trial, as well as for the full name of the experiment. % % INPUT: % trialPath - full trial path, as string % % OUTPUT: % name - struct co...
af802c2ee5b294183e8de2ff552b8a3fc5491ca26305d80ce9b94c7603fca0d1
MATLAB
1,453
44
% mglEatKeys.m % % $Id$ % usage: mglEatKeys(keyCodes) % by: justin gardner % date: 1/29/09 % copyright: (c) 2009 Justin Gardner (GPL see mgl/COPYING) % purpose: starts eating keypresses (i.e. the sent in keycodes % will no longer be sent to the terminal window. This can be % ...
45ae5801a4faeafca0d22a583600e4bff8075ddd4dae29b789ad9f97a469f316
MATLAB
1,454
65
f_outcomes= nan(1,length(fixed_outcomes)); for i = 1:length(fixed_outcomes) f_outcomes(i)=fixed_outcomes(i).overall; end sorted_outcomes=cell(1,6); sorted_idx=cell(1,6); divided_outcomes=cell(1,6); leg=cell(1,6); br= 32752; for i = 1:6 init= ((i-1)*br)+1; divided_outcomes{i}=f_outcomes(init:br...
2591726248bf453084f901d2d611489f74c155b69bbd3caa0e3f50e5a17d233a
MATLAB
1,455
61
function stimchans = networktestOneMS(pairs, ntrials) cerestim = BStimulator(); connx = connect(cerestim); if connx < 0 error('Can''t connect to cerestim') end c = onCleanup(@()cleanupfunction(cerestim)); pause on res = configureStimulusPattern(cerestim, 1, 'AF', 1, ... 7000, 7000, 500, 500, 100, 53); res...
9129db62fc81da124f6a732d337d3c0cbe6865ca213bdf8f3caebdec76c80ee9
MATLAB
1,455
48
function [x1,x2]=vl_witps(xp1,xp2,Y,Yp) % VL_WITPS Inverse thin-plate spline warping % [X1,X2]=VL_WITPS(XP1,XP2,Y,Yp) computes the inverse thin-plate spline % (TPS) warp of the points XP1,XP2. % % Remark:: % The inverse of a thin-plate spline in general is NOT a % thin-plate spline and some splines do no...
419e84a673675fe33187964cd923c1c53bcdc01ce9a70fbd09d714ed4edd00d2
MATLAB
1,456
46
function [s] = getsubfield(s, f) % GETSUBFIELD returns a field from a structure just like the standard % GETFIELD function, except that you can also specify nested fields % using a '.' in the fieldname. The nesting can be arbitrary deep. % % Use as % f = getsubfield(s, 'fieldname') % or as % f = getsubfield(s, 'fi...
4f20b347d4fffbdbdb7574c45241c08cbf14d508799f7240d11e52c7b0cdc655
MATLAB
1,456
57
% sankey demo8 % ----------------------- % @author : slandarer % 公众号 : slandarer随笔 % 知乎 : slandarer figure('Name','sankey demo8','Units','normalized','Position',[.05,.2,.5,.56]) % 随机生成数据(Randomly generated data) clc;clear; SourceValue=randi([1,30],[1,9]); LayerNum=[9,6,4,7,10]; links{1,3}=''; for k=1:4 Target...
992f5f85712896938cc83466ce5eec399024ac0419108ab5c8fbe5c4697701e1
MATLAB
1,456
40
function [ Kappa ] = draw_lcurve_median( Lambda, regularization, consistency, fig ) % Draw the L-curve in log domain. % Curvature is calculated in the log domain. Then, it is filtered by a moving median. % Both curvature estimations are plotted (raw = blue, filtered = red) as function of Lambda. % This function outputs...
e12c5c3ce0c0f82f103023e6f1d0c529c07c0a2eaca0bb1b65f51de18c196d45
MATLAB
1,456
66
% % Compute a spectral statistic. A spectral statistic is one that % depends on the rank-r spectrum (and not just on the first or second % eigenvalues). % % RESULT % values Column vector of values % % PARAMETERS % D (r*r) Eigenvalues or equivalent % statistic % n Number of nodes % function values = statistic_sp...
0d9dd93a93bd11cd0b4ae3c5b3b77494999f8e79ed04e1ddaf76348dec61b739
MATLAB
1,457
42
function [v, vind] = ml_core_max_pixel_rotated_pixel_cross_correlation_180deg(T1, T2, varargin) p = inputParser; p.CaseSensitive = false; checkmatrix = @(x) isnumeric(x); addRequired(p, 'T1', checkmatrix); addRequired(p, 'T2', checkmatrix); % By default use all of the matrix entries ch...
6e45f7c38b8557839f966617fc7217811f3be6af59b341f9b8a0cbf333c04382
MATLAB
1,457
37
clear %load F1s.mat filenames = {'Mouse_1K','Mouse_2K','Mouse_3K','Mouse_4K',... 'Mouse_1M','Mouse_2M','Mouse_3M','Mouse_4M'}; radii = [4:9]; SNRs = [7:4:23]; [list_Recall, list_Precision, list_F1] = deal(zeros(length(filenames),length(radii),length(SNRs))); parfor n = 1:(length(filenames)*length(radii)*length(SNRs...
088b8cd4b53905586b424d6da03a358c54a8dc2d041909a78a95dca9fb779175
MATLAB
1,458
32
function [sorted_value,sorted_idx] = sort_heatmap_data(data_to_be_plotted,begin_index,end_index,parameter,sort_order,comparision_method) % [sorted_value,sorted_idx] = sort_heatmap_data(data_to_be_plotted,begin_index,end_index,parameter,sort_order,comparision_method) % This function will sort the imagesc data. dat...
1f1c16f2b78bebb77b4cf10193a5990f831b4d7283ea0a772a51e7d660fa3263
MATLAB
1,458
59
function []=inspect_intensity(outliers,cell_ids,intensities,centroids,flatindentities,info,identities) % use this function to look at cells of interest or the spectra of outliers % in general titleaddon=[info.mouse,' ',info.date,': ','Outliers Below Threshold'] leg=cell(length(outliers)+2,1); for i = 1:length(ou...
4ba046a476c4f256ffdf9301a439e853288ff4642dfa9822b1d6f71f8d056595
MATLAB
1,458
48
function plot_and_save_cellreg_placemaps(obj, session) placemapDatabaseFilename = fullfile(session.getAnalysisDirectory(), sprintf('%s_placemaps.mat', session.getName())); % All of the cell ids stored in the placemap database are local to the trial placemapData = load(placemapDatabaseFilename); uniqueCellIds = uniqu...
ec72d544cca89153ad7e044539cef0eee00638059524876714a4013982084e6f
MATLAB
1,458
47
% get pathway current and pc = getPC(v,g); interestPC = pc(5,:,:,:); [head,tail] = period(r(5,150001:200000,:),false); axlabels = {'1L2/3e','1L2/3i','1L4e','1L4i','1L5e','1L5i','1L6e','1L6i', ... '2L2/3e','2L2/3i','2L4e','2L4i','2L5e','2L5i','2L6e','2L6i'}; cond = 4; strt_prd = head(cond)+150000; end_prd = tail(c...
c1d33967480b5db86a73fb2a6863cc4f6d88da57caa1cb3e6a459e06c4f035c8
MATLAB
1,459
41
%{ Copyright (C) Cambridge Electronic Design Limited 2014 Author: James Thompson Web: www.ced.co.uk email: james@ced.co.uk, softhelp@ced.co.uk This file is part of CEDS64ML, a MATLAB interface to the SON64 library. CEDS64ML is free software: you can redistribute it and/or modify it under the t...
c64cb0c24b528ace6c317c6d63c97c389d02452e4bc78f426cc02d996a4850fe
MATLAB
1,459
59
function lab= convertLab(lab,nlab) lab=char(lab) for i=1:nlab ilab=lab(i,:); %ilab(ilab=='_')=[]; ind= strfind(ilab,'FC_'); ilab(ind:ind+2)=[]; ind= strfind(ilab,'norm'); ilab(ind:ind+3)=[]; ind= strfind(ilab,'_DMN'); ilab(ind:ind+4)=[]; ind= strfind(ilab,'DMN_'); ilab(ind:...
ddf26f097648a4695d25530e1f887fbc24ed39bdbef15f1b94e947ebb9c76e35
MATLAB
1,459
50
% File Array Object % % file_array - create a file_array % horzcat - horizontal concatenation % vertcat - vertical concatenation % size - size of array % length - length of longest dimension % subsref - subscripted reference % end - last index in an indexing express...
253adea30befa3a17930fd872ff3314e7d2e730dc7d4158f2f6e5476246e7d0e
MATLAB
1,460
51
function ShowImageCell(imageCell, n, m, figurename, imageNames) % ShowImageCell(imageCell, n, m, figurename, imageNames) % % Generate a figure with thumbnails of the images in the imageCell. % % imageCell: Cell array with images which can be displayed % with imshow. % n: ...
d7db5c64bab2c24da8646ae80e81f43e25188e4cceea2425d58dea701eb24897
MATLAB
1,460
41
function varargout = spm_bwlabel(varargin) % Connected component labelling in 2D or 3D - a compiled routine % % FORMAT: [L,NUM] = spm_bwlabel(bw,conn) % % The calling interface has been modelled on the % image processing toolbox routine bwlabel. See % the help for that routine for further information. % % Input: % b...
961e359ac3b64678466c7e22d56ed06ecf9de3c6bb4034eefa3d7669b2053207
MATLAB
1,461
50
function sn = GetSn(Y, range_ff, method) %% Estimate noise standard deviation %% inputs: % Y: N X T matrix, fluorescence trace % range_ff : 1 x 2 vector, nonnegative, max value <= 0.5, range of frequency (x Nyquist rate) over which the spectrum is averaged % method: string, method of averaging: Mean, media...
3ccc0b2ba6f52ef0adbeb0d9e68816fb379dd478677c5e31e9579c108c412e3b
MATLAB
1,462
46
function [conjugate_profile] = conjugate_vrot_transform(profile ) % Function transform the rotational profile to the profile with cojugate % rotational axis % % Input: profile = Rotational velocity with N*3, where N is the length % of the profile, 3 is the three anatomical directions(X,Y,Z). % %...
c20068eab40b6062977a680a7f6694aeb86d95ad5e9f32587487ff17a96693ad
MATLAB
1,462
47
function dspec = addCovariateTiming(dspec, covLabel, stimLabel, desc, varargin) % Add a timing covariate based on the stimLabel. % dspec = addCovariateTiming(dspec, covLabel, stimLabel, desc, basisStruct, offset, cond, plotOpts); % % Input % offset: [1] optional/default: 0 - number of **time bins** to shift the % reg...
299f1027d14cf13c7489d67c8438e5e37c9315b7edd701a9f5dc8f62bf86c630
MATLAB
1,465
51
% sankey demo3 % ----------------------- % @author : slandarer % 公众号 : slandarer随笔 % 知乎 : slandarer figure('Name','sankey demo3_1','Units','normalized','Position',[.05,.2,.5,.56]) links={'a1','A',1.2;'a2','A',1;'a1','B',.6;'a3','A',1; 'a3','C',0.5; 'b1','B',.4; 'b2','B',1;'b3','B',1; 'c1','C',1; 'c2...
7094501d8a5c1a0757abacc82fa7f4eb91708892aa3c3aefdc6fcc58da314b05
MATLAB
1,465
38
function ret=SONSetWaveChan(fh, chan, sPhyCh, dvd, bufsize,... comment, chantitle, scale, offset, units) % SONSETWAVECHAN creates an ADC channel % % RET=SONSETWAVECHAN(FH, CHAN, SPHYCH, DVD, BUFSIZE,... % COMMENT, CHANTITLE, SCALE, OFFSET, UNITS) % ...
b23de7751b97a5000c30f0330d0b35199f09aed04708c8b0476699aeddb509fd
MATLAB
1,465
56
%{ Produce sample dFC(t) and LE(t) to visualize for the methods description. Output: dFC.csv Contains the sample dFC(t). LE.csv Contains the sample LE(t). %} %Define command line arguments. function [] = methods(subject) %Set up I/O. infile = append('../outputs/r_meants/',subject,... '/demean_rfMRI_RE...
e6abc17f35571289602e6a7e4a3d1183f96d19b57a4a91527ee2495518f6f32b
MATLAB
1,465
65
function [] = ExtDataFig10_Connectivity_ToMN() % Code for making the color plot of synaptic output to motor neurons in Extended Data Fig. 10g. %% parameters pIP10 = [13417,13038]; % pIP10 (L, R) pMP2 = [11977,11987]; dPR1 = [10267,10300]; % dPR1 TN1A = [15521,16465,15148,12883,16207,... 16113,14581,14810,15387,176...
3d13ac41052baceb55e77b8323f4e96d18d67561fa13b3ae338727dd255dacbd
MATLAB
1,467
52
function R=randmio_dir(R, ITER) %RANDMIO_DIR Random graph with preserved in/out degree distribution % % R = randmio_dir(A,ITER); % % This function randomizes a directed network, while preserving the in- % and out-degree distributions. In weighted networks, the function % preserves the out-strength but not th...
66d4fd85f85643681cbbd37479dd1279a876e823e1feebe455de581f8f0d480b
MATLAB
1,467
59
function my_clear_net_trn(net_config) cnn_update_net_group(net_config, @do_clear, []); end function one_group_info=do_clear(one_group_info, opts) net_info=one_group_info.net_info; if isempty(net_info) return; end for i=1:numel(net_info.ref.layers) if strcmp(net_info.ref.layers{i}.type,'conv') ...
0bb96c920655b51f5770e06e0ecb9beb0e0ebed78e38756558ed4d6f427adf38
MATLAB
1,468
47
function [dp, dpAvg] = ml_alg_popvectors_compute_correlations(maps1, maps2) % Marc Normandin. % maps1 and maps2 are (map_height, map_width, num_cells) 3D arrays. % This was based on the code using normalized vectors, and switched to % vectors whose mean is subtracted. if ~all(size(maps1) == size(ma...
5d232b5d0d6e4f05f60332909bba669fcbf9e6c2a7ba5aa0e3c67ad895c71f37
MATLAB
1,468
31
% SONGETEVENTDATA returns the timings for an Event or marker channel % % Implemented through SONGetEventData.dll % % [npoints, times, levlow]= % SONGETEVENTDATA(fh, chan, maxpoints, stime, etime{, filtermask}) % % INPUTS: FH = file handle % CHAN = channel...
7c6388d4d566dfb20ddbcb92dd6fe6a3609ba5261f0364702a1af11156429b13
MATLAB
1,468
38
function dip = ft_datatype_dip(dip, varargin) % FT_DATATYPE_DIP descripts the FieldTrip MATLAB structure for dip data % % The dip structure represnts a dipole model that has been fitted to % ERP or ERF data using a non-linear optimization approach. It is % typically obtained from the FT_DIPOLEFITTING function. % % FI...
1b8f83bc81735905d97a25076df1db6b316d272399fe97d32315e37db940330e
MATLAB
1,469
53
% % Compute a spectral network statistic over time on either the full or the split dataset. % % PARAMETERS % $NETWORK The network; must have timestamps % $STATISTIC The statistic % $DECOMPOSITION % $TYPE The data to use, "full" or "split" % % INPUT % dat/info.$NETWORK % dat/stepsi.$NETWORK (only full) % dat/steps.$...
91e851adbe1eab45be76155f36379e3ff544f4d196f51932cb76a333594e93b7
MATLAB
1,469
46
% Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024 function [hFig] = plot_per_group_animal_averaged_rate_difference_matrix_table(T, RATE_MATRIX_CLIM) %T = compute_per_day_animal_averaged_rate_difference_matrix(DaysToSessions, RateMatrices, perCellNormalizationMethod, perAnimalNo...
b8082c219ca2d0db96707dc1a0d6bfb8deb72fe0d7e386d2acacbe0b4c659c33
MATLAB
1,469
38
addpath(genpath('.')) addpath(genpath(fullfile('..','ANE'))) %% % folder of the GT Masks dir_parent=fullfile('..','data','data_TENASPIS','added_refined_masks'); % name of the videos list_Exp_ID={'Mouse_1K', 'Mouse_2K', 'Mouse_3K', 'Mouse_4K', ... 'Mouse_1M', 'Mouse_2M', 'Mouse_3M', 'Mouse_4M'}; vid=1; Exp...
c37a3d376358da427e82864a83e456e67a765a80a31a862c74f63b271cfa6ab5
MATLAB
1,469
48
% This script loads mesh data into the MATLAB workspace. The data include % surface meshes and the potential integrals. It also computes useful % sparse matrices for GMRES speed up % % Copyright SNM/WAW 2017-2020 %% Add path (Windows/Linux commands are different) s = pwd; if(~isunix) slash = '\...
2b7c086e74117b098085c50e3c866b5078714542091cd77ca18a2f6d9635e523
MATLAB
1,470
47
% This script loads mesh data into the MATLAB workspace. The data include % surface meshes and the potential integrals. It also computes useful % sparse matrices for GMRES speed up % % Copyright SNM/WAW 2017-2020 %% Add path (Windows/Linux commands are different) s = pwd; if(~isunix) slash = '\...
059e962d2185acdbc6d659e46f44f6c04b7048b2b21ea200fb9dcf9cfd30a4cf
MATLAB
1,471
45
% getSpikeRateSteps.m % % Function that returns spike rate during each leg step. Can specify delay % between spikes and behavior (spike rate x sec before or after step). % Spike rate computed as number of spikes during step divided by duration % of step in seconds. % % INPUTS: % spikeTimes - times (in sec) when all...
379381372d36b2770679aab17339c37414977e9c4a3bee45ea7f9f82506d26ec
MATLAB
1,471
60
% VL_DEMO_KMEANS_INIT if 0 I = vl_imtest('box') ; [f, d] = vl_dsift(single(I) / 255, 'step', 1, 'size', 3) ; X = double(d) ; numCenters = 300 ; else X = [] ; numCenters = 40 ; for i=1:numCenters X_ = randn(10,100) ; X_(i) = X_(i) + 100 ; X = [X X_] ; end numCenters = numCenters * 2 ; end ...
fc2e1e02b1e65a7b849d0f461b289b4ea64fa2919ecff139830df914b2198f7b
MATLAB
1,471
50
% produce MePD output calculation on beta1 x Kp space clearvars; clc; addpath("C:/Users/kn356/OneDrive - University of Exeter/Desktop/StandardMATLAB") load("colour.mat") addpath("C:/Users/kn356/OneDrive - University of Exeter/Desktop/StandardMATLAB/MePD") load("par.mat") par.d=0.05; p1 = [0 , 7]; p2 = [0, 1]...
834ce64267ee07e3b8c802f9ef745a883f3f3beab86ec1961855d2336fb70ca8
MATLAB
1,473
39
function features = CSPFilter(eeg,cspw,csp_para) % % extract features from an EEG data set using the Common Spatial Patterns (CSP) algorithm % % Input: % eeg: the EEGSignals from which extracting the CSP features. These signals % are a structure such that: % eeg: the EEG signals as a [Ns * Nc * Nt] Matr...
ed0e5b3a86e36573e2d8d8be3c25b5a06e6119674606ff5fd65649ad15421102
MATLAB
1,473
37
function [argout] = mxSerialize(argin) % MXSERIALIZE converts any MATLAB object into a uint8 array suitable % for passing down a comms channel to be reconstructed at the other end. % % See also MXDESERIALIZE % Copyright (C) 2005, Brad Phelan http://xtargets.com % Copyright (C) 2007, Robert Oostenveld http:/...
ed8b5135d5959439203ae3e529862f5ecb01a1df87cb6d2702044043b701786b
MATLAB
1,473
60
function fig_pos=aedes_dialoglocation(figure_size) % AEDES_DIALOGLOCATION - Returns a good location for a dialog window % % % Synopsis: % fig_pos=aedes_dialoglocation([figure_width,figure_height]); % % Description: % % % Examples: % % See also: % AEDES % This function is a part of Aedes - A g...
3ce2a6a9a97956c982c42a56922665832c1ac6e7f0c208db09984b4bc98ade48
MATLAB
1,475
47
function devices=getDevices % devices=getDevices - gets device numbers for KbCheck; % % Usefull for getting a summary of device numbers. % These device numbers are needed for an input argument for % KbCheck if you have more than one connected (otherwise % it will pick the first one). % % Also tries to determine whet...
7aa87d9284e940a0795dd534ff465afb4d99dc91954d89f97da22a6da07dfb89
MATLAB
1,475
44
function [selectedVoxels, ve] = selectVoxelsFromPRFVarExpl(paramsROI, roiOrder, combROIs, thresh) if isempty(thresh) || ~exist('thresh','var') thresh = 0.1; end % Get nr subjects and rois [nrSubjects, nrROIs] = size(paramsROI); % Preallocate space selectedVoxels = cell(nrSubjects,nrROIs); ve = selectedVoxels; ...
c92dd8f3fbf62e871b2c1000423feb782d407aab5b3c139642c6989cc44b4050
MATLAB
1,475
43
%{ Copyright (C) Cambridge Electronic Design Limited 2014 Author: James Thompson Web: www.ced.co.uk email: james@ced.co.uk, softhelp@ced.co.uk This file is part of CEDS64ML, a MATLAB interface to the SON64 library. CEDS64ML is free software: you can redistribute it and/or modify it under the t...
8775d0e60a39023614a5a848dcb684d2d30f411c06fc1d3bae8c691d938c434d
MATLAB
1,476
40
function demean(subj,r) % This function is demeaning. Type in the subject and run number and it % will demean all of the cue files for the parametric regressors. % Afterwards, you have to get it back to Istart analysis, into the EVfiles. maindir = pwd; path = ("pmod/" + "sub-" + subj + "/"); data = (path + "sub-" ...
f5e9616c165bd521c82b7329dbd4ee7810ce8609406eace5a76445a91393f73d
MATLAB
1,476
48
function [] = Fig02_QtoP_dPR1TN1A() % Code for plotting the mean change in ΔF/F after quiet-to-pulse transitions relative to ΔF/F before the transitions in Fig. 2e,h. %% Song-type preference index (dPR1, TN1SG) load(['../Data/Summary_dPR1/QtoPIndex']) Idx_QtoP_dPR1 = Idx_QtoP; load(['../Data/Summary_TN1SG/QtoPIndex']...
46cc13235af36debfc95ade0a8d4c6b8e38d4fa2ec8ab5e42e7534b50c2ea664
MATLAB
1,477
40
%% checkBehavior.m % % structure with organization: stim(1:2).pos(1:15).perf % c = struct('perf',[],'overallPerf',[]); % [c(1:25).perf] = deal([]); % stim = struct('cond',{'Inverted' 'Upright' 'Blank'},'pos',c); % % % if ~isempty([perf.hitTr]) % if performance is 0, we assume that this run is just a scanner error, and...
586c8f80e5d7a7cb27e02d582b0d268d0b6a8270f0fe616080f745325febe3c0
MATLAB
1,477
37
clear %load F1s.mat filenames = {'blood_vessel_10Hz_part11','blood_vessel_10Hz_part12',... 'blood_vessel_10Hz_part21','blood_vessel_10Hz_part22'}; radii = [3:7]; SNRs = [7:4:23]; [list_Recall, list_Precision, list_F1] = deal(zeros(length(filenames),length(radii),length(SNRs))); parfor n = 1:(length(filenames)*lengt...
ebbd893dc921c002b567252e0644d157a6db9914fb9d447d2f1e68490f96026e
MATLAB
1,478
34
function E = bemf4_surface_field_electric(c, Center, Area, eps0, SN, iintegralx, iintegraly, iintegralz) % Computes true continuous electric field on a surface facet due to % charges on ALL OTHER facets including accurate neighbor integrals. % Self-terms causing discontinuity may not be included % % Copyri...
3c4108104d04a6d464e33829984c0d01af0aeff11bd26e64792702298b0aedce
MATLAB
1,479
42
function loadWearables( obj, path, filenames ) % LOADWEARABLES Load wearables signal from external sensor % % Syntax: % LOADWEARABLES( obj ) % % Input parameters: % obj % % Example: % LOADWEARABLES( ); % % Available at: https://github.com/NCN-Lab/DBScope % For referencing, please use: Andreia M....
caf8df0ddba9805c7651fd0a253dfe2f15e76d5a77da733ded8c127247acbea6
MATLAB
1,479
35
function keycode=mglCharToKeycode(keyname,returnAllMatches) % keycode=mglCharToKeycode(keyname,<returnAllMatches>) % % Returns the keycodes of a (list of) keynames % % INPUT % keyname : cell array where each entry is a key name string % e.g. keyname = {'h','g' '1'} % Special keys: % On L...
84b1de690e37f075a96d4f725a7081b13a560ff14030f034ae86a0440444e2d4
MATLAB
1,480
27
function [] = C3_indiv_ROI_RFT(ROI_num) % find the best ROI for each subject saveFolder = 'Z:\MATLAB\Perceptual_Load\FieldTrip\Results\group_level\'; load([saveFolder 'RFT' filesep 'TFR_all_subs_nl_pow_RFT.mat']) load([saveFolder 'RFT' filesep 'normalized_cue_dist_diff_RFT.mat']) load([saveFolder 'RFT' filesep 'comb_...
8d24309d428c970abaa971d9272fc676ed214669c39e6b4c0d008a859d43c22b
MATLAB
1,480
42
function [probe] = reorientModules(probe) %REORIENTMODULES Finds a path between digraph and orients modules to it % Finds a path between all modules using the digraph. It then reorients % all modules to align with the path. Orientation does not take into % account the current module's orientation. Rather, it find...
14e1874efdfd68c2767130c303b9fee5c131f854a681b5909d6ba082bd5562d4
MATLAB
1,482
52
function [R2_same_dir,SIstd,SIall]=R_same(score,idx_dir,idx_duration,ndim,normalised_t) %% R2_same calculates the coefficient of determination between trajectories %% of same directions % % INPUTS % % score: Projection of the neural activity into the subspace. Rows are % samples, columns are neurons % % idx_d...
baa2fc85f250c1a628b123b5118be65b37e836cf33c739561ce445aedbe9c25e
MATLAB
1,482
43
function make_model_based_env(handles) %% Internal variables fs=filesep; env_folder=[handles.env.path_gagui fs ..., 'connectotyping' fs,... handles.func_data_name fs,... handles.env.group]; mkdir(env_folder); change_permissions(handles,env_folder) n_parcel=length(handles.mc.surv_parcels); n_ar=handles.conn...
a328c12fec8bfd223f7c681be7e6b1a693981ff989697ce321d69746125a4efe
MATLAB
1,483
40
classdef RECORDINGMODE_COMMONMETHODS < handle % Object with properties and auxiliar methods to analyse PerceptPC json data at NCN lab % % Available at: https://github.com/NCN-Lab/DBScope % For referencing, please use: Andreia M. Oliveira, Eduardo Carvalho, Beatriz Barros, Carolina Soares, Manuel Ferreir...
468951648aaba0eedbb3cff4bc690b78bfc7326122a78034cb4412d7c204d56b
MATLAB
1,484
56
% normAutoCorrWNan.m % % Function to compute normalized autocorrelation (Pearson's linear % correlation coefficient) while ignoring NaNs (using 'Rows', 'pairwise' % option of corr() - rho(i,j) is only computed when (i,j) lacks NaN). % Output is 1-sided under assumption that input data is real and therefore % autocor...
4e7de0f07dec6481f6475bf72722e87c13783317ce10de79dab160dfa8417718
MATLAB
1,484
52
%% SPATIAL RECONSTRUCTION for 36 maps clearvars -except results pcadata close all % Define directories and load mask results = '/results'; pcadata = '/ICA'; load('boundarymask.mat') % Load individual PCA load(fullfile(pcadata, 'boundarymask_Mus_indPCA')); CoeffM = Coeff; clear Coeff load(fullfile(pcadata, 'boundarym...
c6b2244406904d8418a60599f383abeb716c3d51027907bf59e5ff63ddfa921b
MATLAB
1,485
41
function rmin = matrix2distance(aij, esoz_map) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % If you use this code, then please cite: % 1.- Ana P. Millan, et al. "Individualized epidemic spreading models % predict epilepsy surgery outcomes: a pseudo-prospective study." % medRxiv (2023): 2023-03...
008fd93c3b7901be7fbe0cde1228119f21bf083aaeb010e6e70ac2a1ea233a13
MATLAB
1,486
66
clear; close all; clc; initime = clock; addpath('funcs'); Delta_e = 0.015; % 0.3 Delta_i = 0.048; % 0.04 Iattn = 0.02; time = 10000; maxFreq = 60; [r,v,~] = once(Delta_e, Delta_i, Iattn, time); %% fft sigC = squeeze(r(5,300000:end,:)); sig0 = squeeze(r(5,50000:100000,1)); % sig = sig'; Fs = 100000; % ...
733ef4d255ccab4588515c7cd1d5f9f92a4c5da823ac7d8f40d1ea62ee5d10d7
MATLAB
1,486
49
function [r] = ml_util_minimum_bounding_box(tx, ty) k = convhull(tx, ty); % Find the minimum rectangle % For every pair of points, compute the min and max in each dimension % after projecting numK = length(k); numP = length(tx); kx = tx(k); ky = ty(k); A = cell(numK-1,9); for k ...
f948beb1e276722adf155447bb6a3c36340fb177830062f8f4df5d61b27e1ffb
MATLAB
1,486
42
% This function opens a file and reads the data from a waveform channel as 32-bit floats. Then downsamples the data and saves it to a new file. It does not alter the orignal data. % clear workspace clear; % add path to CED code if isempty(getenv('CEDS64ML')) setenv('CEDS64ML', 'C:\path\to\your\folder\CEDS64ML'); en...
89877f9c9e13628e9166b1acd2fb2fc4d7bbc3d3821dba30116a3f6f05de9a95
MATLAB
1,487
35
function core_tracker_compute_features(output_feature_file_name, output_features_csv_folder_name, output_jaaba_folder_name, ... input_video_file_name, input_tracking_file_name, calibration, ... options) %...
b217e6b8196607a01227c4d93ceae07db05f53ab6d7005aead103a719ecda408
MATLAB
1,488
59
%% calculate the heritability of morphological similarity path = pwd; Output_path_data = [path '\VBM\handle']; Output_path_h2 = [path '\VBM\result']; mkdir(Output_path_data) mkdir(Output_path_h2) mkdir([path '\VBN\temporary']) %% data reorganization load twin_edge_data_VBM.mat Netpara =twin_data; tmp = zeros(3,size(Ne...
cbd7b3bb13c7355677b2950681c12fa4d10642df5c533707939410f995179897
MATLAB
1,488
79
% script for quick plots of average leg steps, FicTrac, iInj data datPath = '/Users/hyang/Dropbox (HMS)/EphysAnalysis-Helen/AnalyzedData/220913_iInj'; % datNames = {'220912_fly01'}; legInd = [1 2 3 4 5 6; 1 2 3 4 5 6]; durInd = 1; % 0.5 s ampVal = 100; % amp = 1.3 phaseInd = 1; % stance varName = 'stepLengths'; yS...
84449b919c5e35e2923106b71e38aa3738da204b68a8c6b9cb06ff6536db0065
MATLAB
1,489
44
function [VIn MIn] = partition_distance(Cx,Cy) %PARTITION_DISTANCE Distance between community partitions % % This function quantifies the distance between pairs of community % partitions with information theoretic measures. % % VIn = partition_distance(Cx,Cy) % [VIn MIn] = partition_distance(Cx,Cy) % ...
7340f46f57028a5271158e1dbd00fc41f2d6639e662fc9af65ae729b1729593d
MATLAB
1,490
32
function [ text ] = getDeviceInformation( obj ) % Display information about device. % % Syntax: % GETDEVICEINFORMATION( obj ); % % Input parameters: % * data - data from json file(s) % % Example: % GETDEVICEINFORMATION( ); % % Available at: https://github.com/NCN-Lab/DBScope % For referencing, please use: Andreia...
7bed887d811551a51d35403319480f459802e3664c4eda86c238c215586a727c
MATLAB
1,490
46
% sankey demo4 % ----------------------- % @author : slandarer % 公众号 : slandarer随笔 % 知乎 : slandarer figure('Name','sankey demo4_1','Units','normalized','Position',[.05,.2,.5,.56]) % 流入及流出数据不相等(Unequal inflow and outflow data) links={'a1','A',1.2;'a2','A',1;'a1','B',.6;'a3','A',1; 'a3','C',0.5; 'b1','B',.4;...
f17b5a5af4d39dc71ea7066aa5c4b2ea3ebeb711a5831a688270b431e5e3f2f5
MATLAB
1,490
38
function OutputSignal = WB_Butter_Filter(CurrSignal,Fs,Feq_Cutoff,Butter_Char) %% To get the filtered signal. % Input: % CurrSignal:Input signal % Fs: sample frequency of given signal % Feq_Cutoff: % when Butter_Char = 'low' % For low-pass fileter: cutoff frequency...