sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
0fc38edcc6bbd11ce3ff7009c07bae73847e7764878b086296944f11c54b2762
MATLAB
422
22
function [status, start_time] = newStartScan() % This code will trigger the 3T GE scanner at CNI using the E-prime trigger % cable. --Michael 09/30/2013 try s = serial('/dev/tty.usbmodem123451', 'BaudRate', 57600); fopen(s); fprintf(s, '[t]'); fclose(s); catch err = 1; end if exist('err','var') ==...
f8de2c1cf543a60b66d56e9433173699958bff4989cff27a4fd930973a77b86d
MATLAB
422
13
function SONSetChanComment(fh, chan, str) % SONSETCHANCOMMENT sets the channel comment % FH = SON file handle % CHAN = channel number (0 to Max-1) % str = string with new comment % % Author:Malcolm Lidierth % Matlab SON library: % Copyright © The Author & King's College London 2005-2006 global SON_CHANCOMSZ...
1c2b9bd01d8cfd5fbb0e45b962c18a34a400587eecf996d8dcb46740486009d1
MATLAB
423
27
function stim = deltaStimExtend(bt, nT, v) % Returns a sparse vector with events at binned timings if bt<0 bt=-bt; invert=1; else invert=0; end bidx = bt <= nT; bt = bt(bidx); % ignore the events after nT bins o = ones(numel(bt), 1); if nargin < 3 v = o; else v = v(bidx); end assert(numel(o) ==...
b376d687742d07192eb7bddd7b9376b984418cb85759a0c643fd04312b031b30
MATLAB
423
18
% mglText.m % % $Id$ % usage: mglText('string') % by: justin gardner % date: 05/10/06 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Returns image of string. % % e.g.: % %mglOpen %mglVisualAngleCoordinates(57,[16 12]); %mglTextSet('Helvetica',32...
07f9da15203c9e1e49dd0f8162e1a1b5b5af13e7770f67d0f6e4a20b5821cc73
MATLAB
424
9
function [notched] = ml_util_filter_powerline_noise(eeg, fs) %fs = 400; % Sampling frequency of the EEG % Notch filter for the 60 Hz line frequency d = designfilt('bandstopiir','FilterOrder',4, ... 'HalfPowerFrequency1',59,'HalfPowerFrequency2',61, ... 'DesignMethod','b...
a103f511b25e7ae693dffd7ed4dfa7954f75f1151d875769786fb86a605784a9
MATLAB
424
17
function [rotatedxys] = rotateCoordinates(xys, rotate_amount) %ROTATECOORDINATES Summary of this function goes here % Rotates a set of xy coordinates by an angle rotate_amount. % Rotate_amount is in degrees. theta = rotate_amount; % degrees % Create rotation matrix R = [cosd(theta) -sind(theta); sind(theta) cosd...
cf262e5a9c377f9fa7d58a63f20085469fc2c1afadd6c2b78acfb25a5ddabb03
MATLAB
424
8
% Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024 function [sessions] = get_sessions_from_table(T) % Returns a unique table of animal name / session name pairs animalIndex = find(ismember(T.Properties.VariableNames, 'animalName')); sessionIndex = find(ismember(T.Properti...
168f0125fbe0d3b8b1c540f59084fd07cd83221636abea5ae6c9e30b6865f28d
MATLAB
425
16
function PlotERP(data,label,lower,higher,sampleRate,butterOrder,smoothPara) channel = [1:17, 19:30]; MIEEGData = data; trigger = find(MIEEGData(:,33)==2); EEG = zeros(2500,29,40); for i = 1:length(trigger) EEG(:,:,i) = MIEEGData(trigger(i)-500:trigger(i)-500+2499,channel); end h = figure; set(h,'posi...
61b3aa409c66a95d3759917e4dc619e6eb69b944a3471d78680d003b66f97fc5
MATLAB
425
18
function spikeTimes = ml_nlx_mclust_load_spikes_32bit(filename) % Load t-files as 32 bits % returns spike times in seconds fid = fopen(filename, 'rb','b'); if (fid == -1) error('Could not open t-file %s.', filename); end ml_mclust_readheader(fid); spikeTimes = fread(fid,inf,'u...
26aeb5384b94a66c5b2e9c77d4b2446d94c6d9af166abed37b8cdb0b7ad9d90f
MATLAB
426
12
function ml_egomaps_draw_arena(ARENA_WIDTH_CM, ARENA_HEIGHT_CM) a = [0, ARENA_HEIGHT_CM]; b = [0, 0]; c = [ARENA_WIDTH_CM, 0]; d = [ARENA_WIDTH_CM, ARENA_HEIGHT_CM]; refCanPts = [a(1), b(1), c(1), d(1); a(2), b(2), c(2), d(2)]; poly = refCanPts'; plot(poly(:,1), poly(:,2), 'b-o', 'linewidth...
26b73046a862d417f41db338e4e4f9d7ba701baa54b5c5e3537957f1df46559a
MATLAB
426
25
function [FD, cat_FD, FD_TR, frame_removal]=read_motion_data(filename,ticks); if nargin<2 ticks=51; end load(filename); try mot=FD_data; end try mot=motion_data; end cat_FD=mot; FD_TR=mot{1}.epi_TR; [r c v]=size(mot); if v==1 FD=zeros(1,ticks); frame_removal=zeros(c,length(mot{1}.frame_removal)); en...
91feb512f1b40d0739cf8c5b2d1fb7ed064938fba439c60b2a23adfe577f3285
MATLAB
426
9
function mltp_plot_bfo_90_placey_sessions(obj) mltp_plot_bfo_general_placey_sessions(obj, 90, 'same'); mltp_plot_bfo_general_placey_sessions(obj, 90, 'different'); mltp_plot_bfo_general_placey_sessions(obj, 90, 'all'); numContexts = obj.Experiment.getNumContexts(); for iContext = 1:numContexts ...
a6d7aaaa3a79896f86b2216da5c4f43ade32397096765bd594a97e0b5ccaf2d6
MATLAB
426
19
% mglGetSecs: Get current or elapsed time % % $Id$ % Syntax: mglGetSecs([t]) % By: Jonas Larsson % Date: 04/10/06 % Purpose: Timing events % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % Usage: Get current time in s % t=mglGetSecs % % ...
efcc49dd7193fdc4420ef0c2bf4b76823ad66a3ff7a34fec2ee1a6924afc5564
MATLAB
426
14
function phaseL=create_rand_phases(SC,num_masks,windw_pix) N=SC.N; n=SC.n; hn = n+1; phaseL=zeros(N,N,num_masks); windw_pix_n = (floor(windw_pix/2)*2+1)/2-0.5; wind_small = zeros(N,N); wind_small(hn-windw_pix_n:hn+windw_pix_n,hn-windw_pix_n:hn+windw_pix_n)=1; for i_phase=1:num_masks I=rand(N).*exp(1i*2*pi*rand(N))...
4bbc10baafd59c8cf5aef4114bba142689142e3702735c5ff1be354b2da4d71d
MATLAB
428
7
function [numTrials] = ml_nlx_nvt_get_num_trials(nvtFullFilename, CONFIG_NVT_FILE_TRIAL_SEPARATION_THRESHOLD_S) % Load the nvt file and split it into trials %nvtFullFilename = fullfile(pwd, 'VT1.nvt'); %CONFIG_NVT_FILE_TRIAL_SEPARATION_THRESHOLD_S = 100; nvtTrials = ml_nlx_nvt_split_into_slices( nvtFull...
18a3f30394745eead862a4ad893c9368d1817b5afdec374475e81e66bea20af5
MATLAB
430
18
% % Harmonic Gaussian Field (HGF) model for label propagation % % INPUT % L: (combinatorial) graph Laplacian (n times n) % Y: Label indicator matrix (n times num. of classes) % OUTPUT % F: Estimator matrix for Y % function F = HGF(L, Y) n = size(Y,1); lb_idx = find(sum(Y,2)); ul_idx = setdiff(1:n,lb_idx); ...
36b327677eb9e14d97cc95fdc53658e08e281d5b332af0fc1edd742dcf6a5856
MATLAB
431
15
function do_bp_current_net=check_do_bp_current_net(work_info_batch, net_run_config, net_info) % check whether need to do bp: do_bp_current_net=net_run_config.do_bp; if ~isempty(net_info) do_bp_current_net=do_bp_current_net && net_info.ref.do_bp; if do_bp_current_net && net_info.r...
381d12ae5ace1742306f8c8c005e0451130e82a06a7b3f857a145543e877f6db
MATLAB
431
17
function [keycode,keyname]=mglShowKey; % [keycode,keyname]=mglShowKey; % % Displays the keycode of a single pressed key. Useful for returning the keycodes of % special keys, e.g. ESC, CTRL, function keys etc. pause(0.5) keycode=[]; while(1 & isempty(keycode)) a=mglGetKeys; if (~isempty(a)) keycode=find...
7f19c8ea653070286162bec61771561b7a93bcc08e5b9b4e414549814a0f5929
MATLAB
431
16
function y = vec(x) % y = vec(x) % % This function just returnes the vectorized version of the input x into % the vector y. If x is a order-N tensor with M_j elements in the j^th % dimension, then y is of size [ \prod_{j=1}^N M_j ]x 1. % % 2017 - Adam Charles y = x(:); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
e5eb8059c3c873bb2641d2517e1e720fecd5af038fb96480d08eca27e1bdc2c1
MATLAB
431
27
% % Extract the tags from the metadata of a network. % % RETURN VALUE % ret A struct contain a field for every tag % % ARGUMENTS % meta The metadata, as returned by read_meta() % function ret = get_tags(meta) ret = struct(); if ~ isfield(meta, 'tags') return; end tags = meta.tags; match = regexp(tags, '...
d1a4a207b8394ddf99a955b484e42f42bbefe6ab786aeec4df131aad7caf0d25
MATLAB
434
15
function flag=SONLatestTime(fh, chan, sTime) % SONLATESTTIME is used to flush data to disk % % FLAG=SONLATESTTIME(FH, CHAN, STIME) % where FH is the SON file handle, Chan is the channel, and STIME is the % latest valid time in clock ticks % % See CED documentaion % % Author:Malcolm Lidierth % Matlab SON library: % Co...
fb7199208c25fe01cbc06a99e47065c167dcf386ae6132a4ccea461275cdba48
MATLAB
434
19
function results = vl_test_grad(varargin) % VL_TEST_GRAD vl_test_init ; function s = setup() s.I = rand(150,253) ; s.I_small = rand(2,2) ; function test_equiv(s) vl_assert_equal(gradient(s.I), vl_grad(s.I)) ; function test_equiv_small(s) vl_assert_equal(gradient(s.I_small), vl_grad(s.I_small)) ; function test_equiv...
492017100e1c4c122c00dd42e10d58c8ed480ebf66a34aa79ec97466a412139b
MATLAB
435
26
function [] = fsfigure(indf,fullscreenoption) %default: 50 70 100 170 bordo1 = 50; bordo2 = 70; bordo3 = 100; bordo4 = 170; if (nargin == 2), if (strcmp(fullscreenoption,'fullscreen') == 1), bordo1 = 0; bordo2 = 0; bordo3 = 0; bordo4 = 0; end, end, screen_size = get(0, 'ScreenSize'); if (nargin == 0), f1 = figure(...
5f7b360ac90e551b0fd35440ee1567c40accea24233ed23c4b0937dc0a35ad35
MATLAB
435
18
function TR=IcosahedronMesh % Generate a triangular surface mesh of an icosahedron. % % AUTHOR: Anton Semechko (a.semechko@gmail.com) % % Get the vertex coordinates t=(1+sqrt(5))/2; % golden ratio x=[0 1 t]; s=[1 1 1; 1 1 -1; 1 -1 -1; 1 -1 1]; x=repmat(x,[4 1]).*s; x=[x;circshift(x,[0 -1]);circshift(x,[0 -2])]; x_L2=...
8dd918b9c2290228807b69c3cc1a6cf5670df7283123e566df3aaf9399ec70cc
MATLAB
435
11
function dspec = initDesignSpec(expt) % Initialize the designSpec structure % % DesignSpec tells us how to compile the experiment data into a % specfic design matrix. Each analysis you do could have different % design -- different covariates to include, different parameterization, % or some nonlinear transformation/fea...
db372c2b22c6aa10cdc605c29b5d3d6801fd6c4e908def98f16952b1cedaae17
MATLAB
435
12
function mltp_compute_bfo_90_placey_average(obj) mltp_compute_bfo_general_placey_average(obj, 90, 'same'); mltp_compute_bfo_general_placey_average(obj, 90, 'different'); mltp_compute_bfo_general_placey_average(obj, 90, 'all'); numContexts = obj.Experiment.getNumContexts(); for iContext = 1:numContex...
e5103f2173f58c4d1fac45b1d14ab63f72da5b3f1747b920f0425fbdcf409db5
MATLAB
435
16
function width = widthestimate3D(matrix,fraction) %calculates fwhm if fraction is 0.5, fw 1/e for 1/e, etc., uses linear %interpolation if nargin<2 fraction = 0.5; end vec1 = squeeze(sum(sum(matrix,3),2)); vec2 = squeeze(sum(sum(matrix,3),1)); vec3 = squeeze(sum(sum(matrix,2),1)); width1 = widthestimate(vec1,fract...
5e797196aec378f93c94d26e441f78df56b039c7bc8302b3973c896bec02442e
MATLAB
436
13
function tf = isfield(this,field) % Isfield method for GIfTI objects % FORMAT tf = isfield(this,field) % this - GIfTI object % field - string of cell array % tf - logical array %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre for Neuroimagi...
87dc89fcc96c96ef99b24c06613f890c17482d2ee7bb9eccc3692873d74c8a0a
MATLAB
436
14
function [json] = ml_util_json_read(filename) % Make sure that the file exists if ~isfile( filename ) error('The json file (%s) does not exist.', filename); end % Try to read the file to get its information try json = jsondecode( fileread(filename) ); catch ME error...
dfb345a6471e13fa99a8b15104b44e2a043132f8f0d6eb66699bf829d0830217
MATLAB
436
14
function [r,c,max_val] = max_rc(I,pix_smooth) %returns location r and c of maximum in image, % max_val returns mean of small area around r c determined by pix_smooth if(~exist('pix_smooth','var')) pix_smooth = 0; end [~,maxind] = max(I(:)); [r,c,~] = ind2sub(size(I),maxind); try max_val = mean(I(r-pix_smooth:r...
d3ed7fee464eaff1038d9780353cecf7474a7e9f8dc3b8f782942405bc771e52
MATLAB
437
11
function [cum_distances] = find_cumulative_distance(points) % given a set of points in order, return the cumlative distance from the % first point until all subsequent points if size(points,1) <= 1 cum_distances = 0; else distances = sum(abs(diff(points)),2); %get the manhattan distance ...
d7e8d697edf4514868c0adc1b09506a0ee4e2a85d3134a025475048639e5d263
MATLAB
437
13
function pchan=SONPhyChan(fh, chan) % SONPHYCHAN returns the physical channel (hardware port) for a channel % in a file % % PCHAN=SONPHYCHAN(FH, CHAN) % where FH is the SON file handle and CHAN is the file channel number. % PCHAN is negative for channels with no hardware port % % Author:Malcolm Lidierth % Matlab SON...
ec4b552c3fa0b60e9290cc898a65adc7cd47de0c2ec148a40b69f21076267749
MATLAB
437
19
function roig = roi_gauss(roi) % gauss filt for the post process % Jinghao Lu 05/20/2017 [d1, d2, d3] = size(roi); d = d1 * d2; roig = zeros(d, d3); swin = 1; cthres = 0.2; % if ndims(roi) ~= 3 % d3 = size(roi, ndims(roi)); % roi = reshape(roi, d1, d2, d3); % end for i ...
3550f91157074b9aa13a5412d59597f46dda5d0fdec3d2852da1778c1b377367
MATLAB
438
9
function eventFT = table2FT(eventT, fsample) % converts event in table format with timestamps to events in Fieldtrip % format (structure format) with samples based on the given sample % frequency eventT.Properties.VariableNames={'timestamp', 'duration', 'type', 'value'}; eventT.duration=round(eventT.duratio...
5babc7678332110a42c5d304812842294ca5f396502ee6353143107e056adfd9
MATLAB
438
12
function handle=SONOpenNewFile(str, extrabytes) % SONOPENNEWFILE (obsolete) creates a new SON file and returns the handle % % HANDLE=SONOPENNEWFILE(STR, EXTRABYTES) % where STR is the file name (with path). EXTRABYTES sets the size of the % optional user data area % % Author:Malcolm Lidierth % Matlab SON library: % Co...
71779413739d71099918889e7a57ad786ab582397ba14daf589f88cf937ff101
MATLAB
438
22
function cm_data=My_hsv(m) cm=[213 62 50; 252 141 89; 254 224 139; 203 225 145; 153 213 180; 50 136 189; 94 79 162; 158 1 66]./255; if nargin < 1 cm_data = cm; else hsv1=rgb2hsv(cm); %hsv(153:end,1)=hsv(153:end,1)+1; % hardcoded cm_data=interp1(linspace(0,1,size(cm,1)),hsv1,...
a28e463ac834efd493705d904abfc4bd16072df4af122eba3de1df597f36354f
MATLAB
439
24
function start_pool(poolsize_set) % poolsize_set = 2; %If no pool, do not create new one poolobj = gcp('nocreate'); if isempty(poolobj) parpool(poolsize_set); else %if isempty(poolobj) %current poolsize poolsize = poolobj.NumWorkers; if poolsize ~= poolsize_set d...
4f2c8b5532debf5f70c7048c6c7c0592d73a6d91672cfeb977d881801ac09d50
MATLAB
440
10
% mglUnbindFrameBufferObject.m % % $Id: mglUnbindFrameBufferObject.m cgb $ % usage: mglUnbindFrameBufferObject % by: Christopher Broussard % date: 09/07/10 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Unbinds a frame buffer object from the current Op...
9eb5b9e4f092e291bc5cfa627952fe061b4d6f840cc9dafe73719bf77cec8d49
MATLAB
442
15
% computeVelocity.m % % Simple function to lowpass filter position and compute velocity function vel = computeVelocity(pos, sampleRate) [b,a] = butter(2 , 0.5, 'low'); % filter data using butterworth function filtPos = filtfilt(b, a, pos); filtPos = filtfilt(b, a, filtPos); % transform from radian...
1beb23d29c6072e7e0e8138f07e0a692ac8596e8910dd9ee8721faa86ce319cf
MATLAB
443
11
% VL_IKMEANSPUSH Project data on integer K-means paritions % I = VL_IKMEANSPUSH(X,C) projects the data X to the integer K-meanns % clusters of centers C returning the cluster indeces I. % % See also: VL_IKMEANS(), VL_HELP(). % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. % All rights reserved. % % ...
286a5e1d17c0162a42049c763bfa77cf077aeb2ab19cbdffce2248e2e4230882
MATLAB
443
16
function [position, lookDirectionDeg] = ml_core_behavtrackvid_h5_read( filename ) if ~isfile(filename) error("Cannot read from (%s) as it does not exist.", filename); end pi = h5read( filename, '/pos_vid_pixel_i'); pj = h5read( filename, '/pos_vid_pixel_j'); lookDirectionDeg = h5read( filename, '/look_vid_deg' )...
3455f12fbb0028d86d96691695ddc7b00e34f6277b58d8e7157a01107629ca76
MATLAB
443
14
function Fline = external_energy(I, sigma) %Make derivative kernels [x,y]=ndgrid(floor(-3*sigma):ceil(3*sigma),floor(-3*sigma):ceil(3*sigma)); DGausx =-(x./(2*pi*sigma^4)).*exp(-(x.^2+y.^2)/(2*sigma^2)); DGausy = -(y./(2*pi*sigma^4)).*exp(-(x.^2+y.^2)/(2*sigma^2)); % Calculate the forces from the image Fline(:,:,1...
49b8feba207cc0df20b948094c963111fe0dd6cf5b53d4e42e156a6af314b3e4
MATLAB
443
14
function om = vl_ihat( H ) % VL_IHAT Inverse vl_hat operator % OM = VL_IHAT(H) returns a vector OM such that VL_HAT(OM) = H. % H hast to be 3x3 skew-symmetric. % % See also: VL_HAT(), VL_HELP(). % Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson. % All rights reserved. % % This file is part of the VLFeat...
77f8fa059ed26459b703592b456f24b4db552eb04e9b12a1cb0f198c8525561a
MATLAB
443
13
function state=SONIsSaving(fh, chan) % SONISSAVING returns the save state for a specified channel % % STATE=SONISSAVING(FH, CHAN) % where FH is the SON file handle and CHAN is the channel number % (0 - SONMaxChan()-1) % Returns 0 if not saving, 1 if saving or a negative error code % % Author:Malcolm Lidierth % Matlab...
b109808af52d2e2b4f29cf32ad9b8f6bb13f7840601917173fd13cf424f9d339
MATLAB
443
9
function [angleMap] = ml_egomaps_binsystem_anglemap(binSystem) % Make a map of angles. We need to rotate it for our coordinate system to % be consistent. angleMap = atan2(binSystem.YY, binSystem.XX); angleMap = rot90(angleMap,1); angleMap(angleMap < 0) = angleMap(angleMap < 0) + 2*pi; % Change angle...
45069932d67a2ee594999de01b6aaca00e79ea5702bdd877adad9e9bd8c7976d
MATLAB
444
13
function numSamplePerInd = getNumSamplePerInd(filesProc) %loop on files to compute num of samples for each ind numSamplePerInd = zeros(numel(filesProc), 1); %larger init to be sure for i = 1 : numel(filesProc) filename = filesProc(i).name; ind = str2double(getIndName(filename)); numSamplePerInd(ind) = num...
48d7fa7a3be78e344a0cd65cd27e426e409acd4ce776a8e7e53d1ccc71664cc2
MATLAB
444
10
function [meanFiringRateMap] = ml_placefield_meanfiringratemap(spikeCountMap, dwellTimeMap) % Compute the mean firing rate map, lambda(x,y) %meanFiringRateMap = imgaussfilt(spikeCountMap,4)./ imgaussfilt(dwellTimeMap,8); meanFiringRateMap = spikeCountMap ./ dwellTimeMap; % There should be NANs for bins...
5b03d41c4459c2a6aa753d3c679bfeeb3bbc89c4c2f3b9722267e46c830c0c96
MATLAB
444
20
function out = BoxResize(in, f) % out = BoxResize(in, f) % % Resize the boxes by a factor f [nR nC] = BoxSize(in); newR = f .* nR; newC = f .* nC; addR = round((newR - nR) ./ 2); addC = round((newC - nC) ./ 2); % For too small factor, only happens when even number addR(addR * -2 == nR) = addR(addR * -...
70b010032c3c75dec37e5b6013dbda868c6305ccc320123cfaaaefe2b9d0891d
MATLAB
444
12
function similarity = BlobSimBoW(a, b, image, simParams) % Calculate textureHistogram intersection for similarity measure % We abuused texture for Bag of Words histogram bowSim = sum(min(a.textureHist, b.textureHist)); % We also want a size similarity imSize = size(image,1) * size(image,2); sizeSim = (imSize ...
d01e31780d9718ed079db01cc88bce6e98c9e8df1607fa57639c1bb0fba10593
MATLAB
444
6
addpath(genpath('/home-new/fym313/MATLAB/MuLaNA_External/CellReg-master/.')); addpath(genpath('/home-new/fym313/MATLAB/MuLaNA_External/CNMF_E-master/.')); addpath(genpath('/home-new/fym313/MATLAB/MuLaNA_External/MiniscopeAnalysis_CNMF_E/.')); addpath(genpath('/home-new/fym313/MATLAB/MuLaNA_External/NoRMCorre/.')); addp...
f14e34f1a3ed158bd9ca16caa66307247cc4782a6c6162b667a9ae28c7667396
MATLAB
444
15
function mulana_project_list() % This code lists all of the available projects for a user [projectsAvailable, ~] = mulana_project_helper_get_list(); if isempty(projectsAvailable) fprintf('Apparently there are no projects, but there were when I made this!\n'); else fprintf('The following projects are available...
b7ba4d1c46ee6f84d7a24bd026c2830c037bf33978377ea664de9c4373d8c35a
MATLAB
446
19
function class_info=gen_class_info_pascalcontext() class_info=[]; class_names=load('./pascalcontext_class_names.mat'); class_names=class_names.class_names; class_info.class_names = class_names; class_info.class_label_values=uint8([0: (length(class_names)-1)]); class_info.background_label_value=uint8(0); class_info...
456e1f04854230fa8a50992fcbf665cdcf025edcbec46e18e3fe82e27fb19c77
MATLAB
447
24
function [file_names, file_infos]=my_list_file(ds_dir) file_infos=dir(ds_dir); file_names=cell(0, 1); valid_sel=false(length(file_infos), 1); for file_idx=1:length(file_infos) if file_infos(file_idx).isdir continue; end one_file_name=file_infos(file_idx).name; file_names{file_i...
fb40ca3c2cc671822895084d608b7cda2391e0edc10259c3c5ce74928485e55a
MATLAB
447
15
% mglGetWindowPos.m % % usage: windowPos = mglGetWindowPos % by: Justin Gardner % date: 07/29/17 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Returns the position of a windowed context opened with mglOpen(0) % returned position will be in pixels...
279118f5c270b593d3c6332fed204502e708793aeea71273f3da33dbf92dbc0c
MATLAB
449
13
function pchan=SONPhyChan(fh, chan) % SONPHYCHAN returns the physical channel (hardware port) for a channel % in a file % % PCHAN=SONPHYCHAN(FH, CHAN) % where FH is the SON file handle and CHAN is the file channel number. % PCHAN is negative for channels with no hardware port % % Author:Malcolm Lidierth % M...
3db6f50a88b6c41b96a4bb38a8baab6226a46bfff8acc9406f7c39d2fdbaa1e6
MATLAB
449
12
function handle=SONOpenNewFile(str, extrabytes) % SONOPENNEWFILE (obsolete) creates a new SON file and returns the handle % % HANDLE=SONOPENNEWFILE(STR, EXTRABYTES) % where STR is the file name (with path). EXTRABYTES sets the size of the % optional user data area % % Author:Malcolm Lidierth % Matlab SON libra...
716c4c60d05dc4f3367948c60acfdd8765f2e7ad0e8406c68c6189380b4f531e
MATLAB
449
17
function [validinds, means, sems] = binnedsemcurve(data, filledbins, centers, binmin,varargin) binmin = 5; % process varargin and overwrite default values if (~isempty(varargin)) assign(varargin{:}); end for b = 1:length(centers) binavg1(1,b) = mean(data(filledbins(:,b),b)); binsem1(1,b) = std(da...
86cf9818cb8176529b0efa705e8efb7f694dfcfb2864854f7b8354c8f5e7d3e5
MATLAB
449
15
function flag=SONLatestTime(fh, chan, sTime) % SONLATESTTIME is used to flush data to disk % % FLAG=SONLATESTTIME(FH, CHAN, STIME) % where FH is the SON file handle, Chan is the channel, and STIME is the % latest valid time in clock ticks % % See CED documentaion % % Author:Malcolm Lidierth % Matlab SON lib...
bfb98d9d77355672bf1bdb859322bbefdc06618dbc85d860185e91f85fbc120e
MATLAB
449
14
function [folderPath, overwriteFlag] = createResultFolderNoOverwrite(parentDir, numDir, string) overwriteFlag = 0; folderPath = []; existFolder = searchFolder(parentDir, string); expNum = find_expnum(numDir, '_'); folderName = strcat(expNum,'_',string); [success,message] = mkdir(parentDir,folderName); if ~success ...
0a28f76a38ac46bb1242e3fbac9b3cb2ca08f36ba15bb5e1d7f5ad4dfad2a8b2
MATLAB
450
23
function lab= convertLab(lab,nlab) lab=char(lab) %keyboard for i=1:nlab ilab=lab(i,:); ind= strfind(ilab,'VOL'); ilab(ind:ind+2)=[]; ind= strfind(ilab,'resA'); ilab(ind:ind+3)=[]; ilab = char(ilab) ind= strfind(ilab,'_norm'); if length(ind) > 0 ilab(ind:ind+4)=[]; ilab=...
6b89f5e2a0cc2b87a738fdee2906b6e6dda477c9811cdd4653675c4127719841
MATLAB
451
20
function fmri_analysis(DATA,ROI,AddInfo) % % This Aedes plugin does a basic fMRI analysis. % if AddInfo.isDataMixed || ndims(DATA{1}.FTDATA)<4 error('Input data has to have at least 4 dimensions.') end % Get brain mask if available if ~isempty(ROI) && any(strcmpi({ROI(:).label},'mask')) roi_ind = find(strcmpi({ROI(...
72d9c35d3c4e2908e6ab6b97fa923e6adb70962065ca40e9b5121ecf836fdbbe
MATLAB
451
19
function class_info=gen_class_info_sal() class_info=[]; class_info.class_names = { 'background', 'salient', 'void'}'; void_class_value=255; class_info.class_label_values=uint8([0, 1, void_class_value]); class_info.background_label_value=uint8(0); class_info.void_label_values=uint8(void_class_value); % ad...
853f581833b18925c6eb4274a5045839b6173972dedd7c47e7127943b4087a3c
MATLAB
451
15
%% plot omega~eta % omega = sqrt(Delta_E.^2 + (Delta_I - b).^2); % get eta (diff) rootFolder = "figure_linReg/"; data = readFilename(rootFolder+"agree/*_*_*_*_*_*.png",'%f_%f_%f_%f_%f_%f'); data( all(~data,2), : ) = []; diff = 2; idx = data(:,4) < diff & data(:,4) > 1/diff; roi = data(idx,:); omega = sqrt(roi(:,1).^2 +...
9fe2bfa9173d9e8420dc57a09eda2d0e4d1858dd6f1c17b200f8e330e287d603
MATLAB
451
14
function minmax=SONYRange(fh, chan) % SONYRANGE returns the expected minimum and maximum values for a channel % % MINMAX=SONYRANGE(FH, CHAN) % % MINMAX is a 2-element vector containing the minimum and maximum values % % Author:Malcolm Lidierth % Matlab SON library: % Copyright © The Author & King's College London 20...
ca57b86ce1a7f983b3c386357cc2febfe0430af06543fefe5d8bcd1a5c9bdc34
MATLAB
451
24
%% setup clear;clc;close all A = fopen('Z:\1_Maxwell_Gagnon\ProjectData_Sriram\Firing_spike_count\RecordA0.txt'); C = fscanf(A, '%f'); start = 1; dispLen = length(C) / 300; addition = 200; i = 1; %% Get Frames while start+dispLen+addition < length(C) plot(C(start:start+dispLen+addition)) frames(i) = get...
c9958a94f9dbbdb69b12e3e9522acbcaa1e02a339bec8aa1ff27b895b6080d90
MATLAB
452
19
function [spk_delta] = spk_t2delta_vector(spk_t,data_len) %spk_t2delta_vector.m %5/22/22 spk_delta = zeros(data_len,1); % column to save memory % this is spk_t2delta convention tmp_spk = 1+round(1000*spk_t); % will cut of anything trailing if exceeds bounds after rounding spk_delta(tmp_spk(tmp_spk <= data_len)) = 1;...
e50f03c5ab9af882825f7b4eb7ee288ff5ad68fe8c0e17286dd53b2b224a1c8a
MATLAB
452
17
function imout = demons_prep(img, mag, denom) % create feature maps good for demons % Jinghao Lu, 05/11/2017 if nargin < 2 mag = 20; end if nargin < 3 denom = 3; end ithres = (max(img(:)) + min(img(:))) / denom; tmp = sigmf(img, [mag, ithres]); % tmp = sigmf(img, [mag, prc...
aa75d6c0e1353c17fd782836a7689faa15127064fe99f9bc1571d52e1e2507e6
MATLAB
453
14
function ml_nlx_mclust_convert_clusters_to_muzzis(mclustClustersFilename, outputMuzzisFilename) data = load(mclustClustersFilename, '-mat'); Muzzio_Colours = data.MClust_Colors; numClusters = length(data.MClust_Clusters); Muzzio_Clusters = {}; for iCluster = 1:numClusters Muzzio_Clusters{...
a46e0f6bb27ab6ae61259b396a424e675c0d96abb73d3eec876e028c0f0f7f52
MATLAB
454
17
function executable = vgrid % VGRID is a helper m-file to locate the binary executable f = mfilename('fullpath'); [p, f, x] = fileparts(f); % construct the full path to the binary executable executable = fullfile(p, 'bin', lower(computer), 'vgrid'); if ispc executable = [executable '.exe']; end if ~exist(executa...
c18d09d5f744c067aa2e2c31d90f08ac0716b04d008cb347371548d3b348d641
MATLAB
454
12
function [handles, seqs_removed] = RemoveFlyEvent(handles,fly,f0,f1) % remove all suspicious sequences involving fly in frames f0 to f1 % splintered from fixerrorsgui 6/23/12 JAB seqs_removed = []; for i = 1:length(handles.seqs) if ismember(fly,handles.seqs(i).flies) && f0 <= min(handles.seqs(i).frames) && ... ...
c30ef8c015f040a5f11f20c9debb400445c93b58e562647243d5d67d1d93d6a4
MATLAB
454
14
function ensure_file_does_not_exist(raw_file_path) if isempty(raw_file_path) , error('File path cannot be empty') ; end file_path = absolute_filename(raw_file_path) ; if isempty(file_path) , error('File path cannot be empty') ; elseif exist(file_path, 'file') , %system_from_l...
01329488a166cc8a0b34e2e8eeedf0619c0609496adfffce8b6bdca6895e171c
MATLAB
455
22
function out = onlineripfilter(raw) window = 19; %samples gi_dec = .2; gi_inc = 1.2; %initialize with average of first 19 samples filt = nan(length(raw),1); filt(window) = mean(raw(1:window)); for i = 20:length(raw) if raw(i) > filt(i-1) % envelope increasing filt(i) = filt(i-1) + gi_inc*(abs(raw(i))-fi...
0314eb52bba6bcfae6c88d1a9ea8a4f2265ca3d2b33dc943ccf3fd64efc49b63
MATLAB
455
17
function usPerTime=SONGetusPerTime(fh) % SONGETUSPERTIME returns the tick interval in units of SONTimeBase() % USPERTIME=SONGETUSPERTIME(FH) % FH SON file handle % % See also SONGETTIMEPERADC, SONCHANDIVIDE % Author:Malcolm Lidierth % Matlab SON library: % Copyright © The Author & King's Co...
8718db69f4976bae04665872cd2d42f3cb908c20cd02328bd5fd4d6450ccd31e
MATLAB
455
29
function ynn_v = ValNLSprlNLD(Imat_v,dsr_init,nn_stat,nn_dyn,Xi,Ai,tv,no) u_v = Imat_v; y_s_v = sim(nn_stat,u_v); y_d_init = dsr_init - y_s_v(:,1); X = tonndata(u_v,true,false); yv = nn_dyn(X,Xi,Ai); yn = zeros(no,tv-1); for i = 1:tv-1 yn(1:no,i) = yv{i}; end ynn_v = zeros(tv,no); ynn_v(1,1...
65ae0c859fd51282c93d3047fbc6325dc2cf7f8c756966abe26f8a5fb53aee56
MATLAB
456
22
function [ISI] = getISI(delta_mat,varargin) %getISI.m % 5/7/22 n_trials = size(delta_mat,1); switch iscell(delta_mat) case false isiFn = @(x) diff(find(delta_mat(x,:))); case true isiFn = @(x) diff(find(delta_mat{x,:})); end if nargin == 1 || ~varargin{1} ISI = cell2mat(arrayfun(@(x) isi...
9153320f7ecbac310658ea20dc34a6a5c7815ced7bfecfe2e1efe7a0487a8fe8
MATLAB
456
13
function state=SONIsSaving(fh, chan) % SONISSAVING returns the save state for a specified channel % % STATE=SONISSAVING(FH, CHAN) % where FH is the SON file handle and CHAN is the channel number % (0 - SONMaxChan()-1) % Returns 0 if not saving, 1 if saving or a negative error code % % Author:Malcolm Lidierth ...
9a39f4b3d41f2322ecf974246f65541065649db942ebb4539626c3d4470a0e1f
MATLAB
456
20
function [frame] = plotSFPs(obj) % Plot the combined spatial footsprints of this trials neurons [frameWidth, frameHeight] = obj.getScopeVideoDimensions(); numNeurons = obj.getNumNeurons(); % the frame we will make frame = zeros(frameHeight, frameWidth); for iNeuron = 1:numNeurons neuron = obj.getNeuronById(iNeur...
6c3968b0ecac2eb904900b269bdaefc5b22a2fb49633b91266ca09c7b8eb010c
MATLAB
457
20
function[final_ids]=make_final_ids(final_red_vect,final_ident) % function to make sure that mcherry==1 and tdtomato==2 final_ids=nan(length(final_red_vect),1); count=1; for i =1:length(final_ids) if final_red_vect(i)==0 final_ids(i)=0; elseif final_red_vect(i)==1 if final_ident(count)==1 ...
e6bdb3df304c4e70297be0723e951459d98dde1186eb0e4eb02d3ae3d9a287ac
MATLAB
457
13
function no_weight_edges = get_edge_pairs(number_of_behaviors, with_self) %this generates all possible transition pairs (with and without out self %edges) if nargin < 2 with_self = false; end no_weight_edges = fliplr(combvec(1:number_of_behaviors, 1:number_of_behaviors)'); if ~with_self ...
f4e442b5eeb8a4424eef57f65384d71d8257f72ae1b1233504589f0b65ec2f9a
MATLAB
457
10
% Example of mixed integer problem % This example corresponds to MEIGO toolbox example: ex3.m % http://gingproc.iim.csic.es/meigo.html function [F g]=matlabMINLP(x) F = x(2)^2 + x(3)^2 + 2.0*x(1)^2 + x(4)^2 - 5.0*x(2) - 5.0*x(3) - 21.0*x(1) + 7.0*x(4); g(1) = x(2)^2 + x(3)^2 + x(1)^2 + x(4)^2 + x(2) - x(3) + x(1) - x(...
22c12c5d2e103e4c2cee66e68b21011a8e4e86c24684268a0bafad0ea5c2428f
MATLAB
458
15
function [newVectors, meanValue] = remmean(vectors); %REMMEAN - remove the mean from vectors % % [newVectors, meanValue] = remmean(vectors); % % Removes the mean of row vectors. % Returns the new vectors and the mean. % % This function is needed by FASTICA and FASTICAG % @(#)$Id: remmean.m 8776 2013-11-14 09:04:48Z ro...
566b4ae91fc4472280ef18adb9bec192397f63a4b01ee12b3a2baed7f6ebc970
MATLAB
458
14
function interleave=SONChanInterleave(fh, chan) % SONCHANINTERLEAVE Returns the channel interleave factor for ADCMark channels % in SON V6 or above % INTERLEAVE=SONCHANINTERLEAVE(FH, CHAN) % FH SON File Handle % Chan Channel number % % Author:Malcolm Lidierth % Matlab SON...
6dca9c00c8603fef0952e57f1d753fb956c8d71036e9dd5b95527dbd86565f4b
MATLAB
458
15
% loadBD.m function [BDTrns, burstEl] = loadBD(folder, fName) % startFolder = pwd; % cd(folder) filename = fullfile(folder, fName); load(filename); burstEl = find(~cellfun('isempty', burst_detection_cell)); BDTrns = []; for k = 1:length(burstEl) BDcurElec = burst_detection_cell{burstEl(k)}; NumBcurElec = size(B...
3a636cf568adbe439bfdcec60b51e7b003d487048b80a4f5dc58010625a42982
MATLAB
459
29
% % The norm used for normalizing central matrices. % % PARAMETERS % data_decomposition % x Central matrix % % RESULT % pivot The pivot value % function [pivot] = pivotize(data_decomposition, x) pivot = 1; if ~data_decomposition.n if data_decomposition.l a = diag(x); a_nonzero = a(a ~= 0); ...
4f904825e72121d9517092cdaafa722e184b8e5d04652ea2bb70d127ce254899
MATLAB
459
18
function Data= TDMS_read(filename) %TDMS_READ Summary of this function goes here % Detailed explanation goes here if ~exist(filename,'file') error('The file specified for tdms reading doesn''t exist, FILENAME: %s',filename); end rawdata=TDMS_readTDMSFile(filename); ChannelName=rawdata.chanNames; Data=rawdata.dat...
84565df8e0532d2f3824f6b39fcf03ae40570ebdb325df5902b92c6e3b4842a4
MATLAB
459
10
% mglBindFrameBufferObject.m % % $Id: mglBindFrameBufferObject.m cgb $ % usage: mglBindFrameBufferObject(fboObject) % by: Christopher Broussard % date: 09/07/10 % copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING) % purpose: Binds a frame buffer object to the current O...
968e938cc4569b9755a0430f50feec72330e04546ba0161903e313f1c5838b62
MATLAB
459
15
function normedResponse = normMax(response) % Function to set max height of response to 1 % % normedResponse = normMax(response). See also normSum.m % % INPUT: % response : (vector or matrix) pRF time series (time points by pRFs) % % OUTPUT: % normedResponse : (vector or matrix) normalized pRF time se...
ae71cc4ce4fe0d68e5d502c1c8adfb929de0e68d441ed2abf8def45dbee6c4b0
MATLAB
459
22
function [] = plotROI(probe) %PLOTROI Plots the perimeter of the ROI % plots the perimeter of the ROI. hold on % Add the first xy coordinate to the matrix first_xycoor = probe.roi(1,:); perimeter_coors = [probe.roi; first_xycoor]; % Plot the perimeter. plot(perimeter_coors(:,1), perimeter_coors(:,2), 'k--','Lin...
f7310da748e4b2338f91d9cc60e4cfe8004c021d428dd46316f8d191cd50dc81
MATLAB
459
16
%% cleanTracks = masterData.cleanTracks TimeZ2 = sum(vertcat(cleanTracks.TimeInZ2)) TimeZ1 = sum(vertcat(cleanTracks.TimeInZ1)) TimePI = (TimeZ2 - TimeZ1)./(TimeZ1 + TimeZ2) %% DistZ2 = sum(vertcat(cleanTracks.DistInZ2)) DistZ1 = sum(vertcat(cleanTracks.DistInZ1)) DistPI = (DistZ2 - DistZ1)./(DistZ2 + DistZ1) %% L...
647af1ee74c3bb94a3ee276c710f7f2724d3d65a602e4db2ce03312c1c23fea9
MATLAB
461
11
function [jointEntropy] = ml_alg_joint_entropy_images(Ia, Ib) % Ia and Ib must be discrete valued indrow = double(Ia(:)) + 1; indcol = double(Ib(:)) + 1; %// Should be the same size as indrow jointHistogram = accumarray([indrow indcol], 1); jointProb = jointHistogram / numel(indrow); indNoZero ...
a892a4aa82ff27dbd99dc20cd38ffb52918813b0e203177fbb67961c38ef7b63
MATLAB
461
16
function MaxTime=SONChanMaxTime(fh, chan) % SONCHANMAXTIME returns the sample time for the last data item on a channel % % MAXTIME=SONCHANMAXTIME(FH, CHAN) % where FH is the SON file handle % CHAN the channel (0-SONMaxChannels()-1) % % MAXTIME is returned in clock ticks % % % Author:Malcolm Lidierth %...
f32670086bda8b37622636bead6aa3a701c7ef7eb8834d49054292d2735adadc
MATLAB
461
19
% Example of mixed integer problem % This example corresponds to MEIGO toolbox example: ex2.m % http://gingproc.iim.csic.es/meigo.html global k1=0.09755988; global k3=0.0391908; global k2=0.99*k1; global k4=0.9*k3; function [F g]=matlabNLP(X) F=-x(4); %Equality constraints g(1)=x(4)-x(3)+x(2)-x(1)+k4*x(4).*x(6); g(2)...
da2d9319b9b00cdfb685d680ecedee01a234d49dd8ed1c7fcd9719ff0c953ecd
MATLAB
462
27
function up_idx = eventedgefinder_HERE(data,threshold,up,Num) if size(data,2)==1;data=data';end switch up case 1 A=find(data>threshold); case -1 A=find(data<threshold); end if ~isempty(A) idx= find(diff(A)~=1); start_idx = [1 idx+1]; end_idx= [idx numel(A)]...
ec3c6dfa598fdce96eb0f7b7ebf93258619986f9ded182a6baac1e7e6235f421
MATLAB
462
19
% % Compute local prediction. % % PARAMETERS % method Prediction method % a Adjacency/biadjacency matrix % at (e*2) Each row is a vertex pair (i,j) for which to compute a prediction % format % weights % % RESULT % predictions{submethod} (e*1) Prediction scores % function [predictions] = prediction_local_compute...
44b24adfe542d483da458269d420c2de001337ecd94ce4b1111196e906d08943
MATLAB
463
17
function results = vl_test_hikmeans(varargin) % VL_TEST_IKMEANS vl_test_init ; function s = setup() rand('state',0) ; s.data = uint8(rand(2,1000) * 255) ; function test_basic(s) [tree, assign] = vl_hikmeans(s.data,3,100) ; assign_ = vl_hikmeanspush(tree, s.data) ; vl_assert_equal(assign,assign_) ; function test_elka...
1d10614c0e627f2e068dacab757aede178f8a315b7f2702f94d70d818efe8a98
MATLAB
464
18
function view(tree) % XMLTREE/VIEW View Method % FORMAT view(tree) % % tree - XMLTree object %__________________________________________________________________________ % % Display an XML tree in a graphical interface %__________________________________________________________________________ % Copyright (C) 2002-20...
63b70eb532987d7a0b72ea21350ba80632678e123fe48098ea8223bf93d0a092
MATLAB
464
19
function mask = createCirclesMask(varargin) narginchk(3,3) if numel(varargin{1}) == 2 % SIZE specified xDim = varargin{1}(1); yDim = varargin{1}(2); else % IMAGE specified [xDim,yDim] = size(varargin{1}); end centers = varargin{2}; radii = varargin{3}; xc = centers(:,1); yc = centers(:,2); [xx,yy] = ...
ce58f272ab28cd7d034510a5292e594b762ec49edaa2c207479ed4386dbe34fb
MATLAB
464
24
% % Save the full dataset (not split) in a MAT file. If timestamps are % present, the data is sorted. % % PARAMETERS % $input Input filename (out.*) % $output Output filename (*.mat) % % INPUT FILES % $input % % OUTPUT FILES % $output Matlab file % T The data in triple/quadruple format as found in the out.* f...
4c2579657e5e61bfa1bb3fc1b494283cc0c8e2f4895680f3e159324dd06d24bb
MATLAB
465
15
function [flipCombinations] = flip_combinations(numTrials) % Returns a matrix of unique combinations of 0s and 1s. Each row % is one combination. flipCombinations = zeros(1,numTrials); for i = 1:numTrials %6 s = zeros(numTrials,1); s(1:i) = 1; p = unique(perms(s), 'rows'); ...
5cb61727b6a8a92cf2c8d62c9919eafe7b2891f228612978a495bd4a50953fc9
MATLAB
466
10
% Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024 function [mmap2] = get_map_registered_cell_names_to_registered_cell_id(CellRegTable) if isempty(CellRegTable) error('There is no cellreg table to retrieve names from.\n'); end uniqueRegisteredCellNames = uni...