sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
489f0ffec3c63056bf69759cd710a6653a6521cf2cda5671bdfce15e1450e0fd | MATLAB | 131 | 6 | % TWOPHOTON PROCESSING PACKAGE
%
% This directory contains code for processing data collected from
% Leica LAS AF software
%
%
|
db7b8e08896ff10e78eca2ea88e45eccae6adb8a93313278707e5485042882b1 | MATLAB | 131 | 8 |
function blankScreen(window,duration)
Screen('FillRect', window ,[255 255 255] );%white
Screen('Flip', window);
end |
c5b6f287d8bfa4b8c52b31a61a1f396463d7396cbf1f75a33347bfbabef9c43b | MATLAB | 132 | 8 | function cc = remove_lower_half(cc)
for y=1:size(cc,1)
for x=1:y
cc(y,x) = nan;
end
end
end
|
8bdb06df4cfbee3db742c5f997adcf25fb75be0757455685301acf395a2ce536 | MATLAB | 136 | 5 | function [pavg,w] = proportional_avg(M)
s = sum(M,3) ;
w = M ./ s ;
pavg = sum(M .* w, 3,'omitnan') ;
pavg(isnan(pavg)) = 0 ; |
a6b0ab052f13b3a906acdd3c40fd43531c13256e2a04e7c72ae578fde93f95b7 | MATLAB | 137 | 6 | % TWOPHOTON PROCESSING PACKAGE
%
% This directory contains code for processing data collected from
% Zeiss Zen software software
%
%
|
aa816978732e9aa4c49e37ac29351bde47c668f7f7f8af895291077e394e0397 | MATLAB | 141 | 5 | function self = TrainClassifier(self)
self = self.TrainNetwork();
self = self.GenerateClipPredictions();
self = self.EvaluateNetwork();
end
|
346601e944c22a8e31530fc78290d0b9ff6d3ea3991c60abd9905cedf6ee2983 | MATLAB | 142 | 13 |
clc
disp('prev line')
fprintf(' Current video: ')
for i = 1:1000
ProgressBar(i, 1000)
pause(1.5)
end
fprintf(' Next video:')
|
4c841a53a3b3ab8702420e74c3af3f821b3e9cc18247c3d8d7dd52ed43fb04ef | MATLAB | 142 | 10 | function TRIALS = TrialFcn_ABR(TRIALS)
% TRIALS = TrialFcn_ABR(TRIALS)
if TRIALS.tidx == 1 % setup
ABR_GUI(TRIALS);
end
TRIALS |
a42cd0cedf017835fa6635dde03425ba23cc0553f00e1de7c4505813c46ea406 | MATLAB | 142 | 6 | function [ v ] = soft_thresh(w, t)
%v = max( 0, x - t*opts.rho ) - max( 0, -x - t*opts.rho );
v = sign(w) .* max(abs(w) - t,0);
end
|
2b90d3013dc92691ca1a3ed47ea3c320a238fa6fa5d64acc8cedc6024a9c7e40 | MATLAB | 144 | 6 | % TWOPHOTON PROCESSING PACKAGE
%
% This directory contains code for processing data collected from
% a Prairie Technologies two-photon.
%
%
|
cc705a6e6424e3c3e81db4b8a4ffe9d66379d94dfd18565c0a47fc1297ee6073 | MATLAB | 144 | 5 | function subfolders = list_subfolders(folder)
subfolders = {dir(folder).name};
subfolders = subfolders(~ismember(subfolders ,{'.','..'}));
end
|
e9c8492e9436920ed0954af550b798e326ed47d7e59867123d64ec9d5e917fc7 | MATLAB | 145 | 4 | function nFib = get_pop_size(fiberPop, fascId, popId)
% TODO (maybe): check whether exists
nFib = size(fiberPop(fascId).center{popId}, 1);
end |
8ff4a136c5e20e1619eb242a0c5078f451055095e423ed391880d6812fc55ede | MATLAB | 146 | 8 | function outputStr = getDateTimeStr()
%%% 26-01-23 first commit
formatOut = 'dd-mmm-yy_HH-MM-ss';
outputStr = datestr(clock,formatOut);
end
|
0134509fb6141819d07a6bf349093d28a17350a419802989e8d326befdc4da04 | MATLAB | 147 | 7 | function dirnames = tpdirnames( dirname )
%TPDIRNAMES returns cell list of twophoton subdirectories
%
% 2016, SD Van Hooser
%
dirnames={dirname};
|
597327c6c6302a4b369bc35ff9de82c0c7fed0cc0003288330bc637191dc2c3a | MATLAB | 147 | 5 | function shape2 = reshapeAreaCoords(shape)
shape2 = zeros(1, 2*length(shape));
shape2(1:2:end) = shape(:,1)';
shape2(2:2:end) = shape(:,2)';
end |
614714881a9b52a32bef3b2055fb9869b41f013d948d5425be438db6ebff0541 | MATLAB | 148 | 7 | function [ y ] = f_sig( x )
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
y = 2*(1./(1+exp(-x)))-1;
end
|
0a722a46f0d817e456c936d0a6dfdc4e3340e2eb0731ee8b42bdbdcab55e6e57 | MATLAB | 149 | 9 | function [] = set_font(ax, size)
%FONT set font size and type
arguments
ax
size = 8;
end
set(ax, 'FontSize', size, 'fontname', 'Arial')
end
|
7bfa6d5334f25887a2762e46755654591a964c3f97bde2c57d5084b6d8f3f4a2 | MATLAB | 150 | 7 | function dirnames = tpdirnames( dirname )
%TPDIRNAMES returns cell list of twophoton subdirectories
%
% 2008, Alexander Heimel
%
dirnames={dirname};
|
d6454a36ca3a52b03614bf6be384b75904e5a89e0bd97fc6af650729df501a91 | MATLAB | 150 | 7 | function [sc,labels] = mrtrix3_to_cmtk_order(in_sc,in_labels);
FULL_IDX = get_index;
[sc, labels] = reorder(in_sc,in_labels,FULL_IDX);
|
3579a0d0d104a081831fe36f7728d38ee6cdade2132aa970e61906275b13e141 | MATLAB | 152 | 7 | function fname = strip_data_dir(fname)
dataDir = get_data_dir();
if startsWith(fname, dataDir)
fname = fname(numel(dataDir)+1:end);
end
end
|
602523b74cff8d109d2043f39b1620195baf9a76cf7ec77e9d39e84467ac6249 | MATLAB | 156 | 5 | function fiberId = filter_fiberid_by_diam(fibers, minDiam, maxDiam)
radiuses = fibers.r;
fiberId = radiuses >= minDiam/2 & radiuses <= maxDiam/2;
end
|
e29972fb2943e7af88806febd6a33fbc78902083fff2946bf7ebe7ce6884d11b | MATLAB | 156 | 7 | function [log_m] = logSumExp_pair(log_x, log_y)
cs = max(log_x, log_y);
log_x = log_x - cs;
log_y = log_y - cs;
log_m = cs + log(exp(log_x) + exp(log_y)); |
2bdd52f6595b4ddcd2d49cc776993b88dadd499139af6670dd723e66f3475504 | MATLAB | 158 | 8 | function x = copy_upper_to_lower(x)
N = length(x);
for row=2:N
for col=1:(row-1)
x(row,col) = x(col,row);
end
end
end
|
9347955716178015d8c21c6433d00bc83dc3a79f3036bc0c54747a7262e66a0d | MATLAB | 158 | 4 | function[i] = myisopen
% myisopen True if MySQL instance active [mym utilities]
% Example if mycheck, disp('MySQL running!'), end
i = ~mym('status');
|
7c8fe64214db96f4aa72580504b1c45609e33ed83d27496d96408cda74e80aa1 | MATLAB | 160 | 5 | function UpdateBehaviorSet(self, behaviorSet)
self = self.Load();
self.AnnotationTable.Label = addcats(self.AnnotationTable.Label, behaviorSet);
self.Save()
end |
79fce2f6783e579abe53119f47bb9dca9366167b85158475ab36bdb2676f0998 | MATLAB | 161 | 9 | function disconnect_FEM()
import com.comsol.model.util.*;
try
% Throw if already disconnected
clear_FEM();
ModelUtil.disconnect();
end
end
|
68490247b6211bb59f07475457e081014279b5d6da1ca41836e0ab467656f285 | MATLAB | 162 | 7 | function dirnames = tpdirnames( dirname )
%TPDIRNAMES returns cell list of twophoton subdirectories
%
% Steve VanHooser, Alexander Heimel
%
dirnames = {dirname}; |
ce6fda534d5eebfb3e202997655fa09aa56f19555e73fa4c58a89900915db700 | MATLAB | 162 | 10 | function [f,g,nh_2] = sqErrLL(x, y, dt)
d = x - y;
f = -d.^2;
if(nargout > 1)
g = -2*d;
if(nargout > 2)
nh_2 = ones(size(x))*sqrt(2);
end
end |
5ac67259a07e5f4b0219a8cd1f61006302a545f4889fe5e95050deaa7d353daf | MATLAB | 163 | 7 | function [dir_T] = get_file_table(path)
%GET_FILE_TABLE
dir_info = dir(fullfile(path,'*.nii*'));
dir_info = struct2table(dir_info);
dir_T = table(dir_info);
end
|
5e8c7fc38add5e96d90034fe49a0ab637d9fb87916591b3808cd9ad2c81875a6 | MATLAB | 164 | 7 | function [ frameField ] = GetFrameLabel(t, nDigits)
if nargin < 2
nDigits = 4;
end
frameField = ['Frame' sprintf(['%0', num2str(nDigits), 'd'], t)];
end
|
b24ca6d6f0986bfaf7d677ab3c64079148c01dac7d31a9d95043a7e4823a4576 | MATLAB | 164 | 7 | function HistPlot(data)
bar(data);
XTickLabel = [0:1024:32768];
XTick = [0:32:1024];
set(gca,'XTick', XTick);
set(gca,'XTickLabel', XTickLabel);
end |
ddeea77a722382b1c4dea691058b284591ab0fcc2a3cf692aa4205162169d385 | MATLAB | 164 | 6 | function [ y ] = b_0_fun( x, FP, h, s, c )
%UNTITLED6 Summary of this function goes here
% Detailed explanation goes here
y = h*f_sig(s*(x-(-c*FP)));
end
|
9f0e5567743720e055a5e88989e39ccc199d64b55e416e4fff80e5ad56bf6cae | MATLAB | 166 | 7 |
projectFolder = '/Users/harriscaw/Documents/Behavior classification/Projects/JuangDemo';
project = DeepActionProject(projectFolder);
%%
project.BackupAnnotations() |
ca4938483eb07272f795946737cdaa2345f4c200434bb898d22f68351606cbdf | MATLAB | 166 | 6 | function [regions_T] = filter_region(T, region_names)
%FILTER_REGION Select a specific region
idx = ismember(T.region_name,region_names);
regions_T = T(idx, :);
end
|
eecc07dbd1d4d79e8101fa12807857e90b1010d876169f795d925cac1bfdc645 | MATLAB | 166 | 9 | function prepare_plot_recruitment(ax)
xlabel(ax, 'Injected Charge [nC]');
ylabel(ax, 'Relative recruitment [%]');
ylim(ax, [0 100]);
title(ax, 'Recruitment');
end
|
f36544a333de0ad3339da7e978f74df2b771f0680479cf078ef0fb8c68571c1e | MATLAB | 166 | 10 | function Genes = findGenes_sub(IND_xyp,index)
q = (IND_xyp==index);
if sum(q)~=0
[r,gn]=sort(q,'descend');
Genes = gn(1:sum(r));
else
Genes = [];
end
end |
44ec7d6923123c7bcf2d3b6cc49f82d903b0c3d2fa1c98653294614d4262445c | MATLAB | 167 | 9 | % hill function
function H = hill(X,X0,lambda,n)
% H+
H1 = (X^n)/(X0^n+X^n);
% H-
H2 = (X0^n)/(X0^n+X^n);
% Hill function = H- plus (lambda)* H+
H= H2 + lambda*H1; |
9d6f96978b148e3c54610c67a6041b81ecccf038483eeb600fc14925196b56f3 | MATLAB | 167 | 6 | function [ scale ] = AxisScale( scale, units )
%AXISSCALE Return a struct describing the scale along an axis
scale = struct('Value', scale, 'Units', units);
end
|
9370fc09651e7ac041d6950bca96bf210b19de735f66e47be5e8469728f4c810 | MATLAB | 170 | 5 | %% First get number of animals
beta = util.load.beta_table();
unique_animal_indices = unique(beta.only_animal_idx);
unique_session_indices = unique(beta.session_index);
|
0bdd24eec8a7c01ddf52510798a3e0813707a4e7394765d38cb71213ea07cb31 | MATLAB | 172 | 7 | function [A] = make_symmetric(A)
% MAKE_SYMMETRIC make the connectivity matric symmetric
A = A - diag(diag(A));
A = tril(A, -1) + tril(A, -1)';
assert(issymmetric(A))
end
|
7f6df38f8f0d7e2078cf74003941e2306671989773edb11c96ba0914c57899bc | MATLAB | 172 | 9 | % CLEAR_SET_FORMAT Clears windows, workspace and command line and sets
% float numbers format to longeng.
%% Cleaning
clear all
close all
%% Format
format longeng |
f7de3839623ce80c9256e1f1454b0589fefbe88af47ff3e8e3612c9810479e0b | MATLAB | 172 | 12 | classdef LocationObj
%LOCATIONOBJ Summary of this class goes here
% Detailed explanation goes here
properties
end
methods
end
end
|
2e53a1135daa42161a64de6f37a81a30a91bf7525e236f318eb51267985f1c20 | MATLAB | 174 | 9 | function SEM=sem(X,dim)
if nargin<2
dim=1;
end
if isvector(X)
SEM=nanstd(X)/sqrt(sum(~isnan(X))-1);
else
SEM=nanstd(X,[],dim)/sqrt(min(sum(~isnan(X),dim))-1);
end |
8b5855dd2bc2655d84c0e9b186470c753a2027208009be60fe35512abd152893 | MATLAB | 176 | 7 | function [regions, tolerance] = regionGenerator(numRegions)
tolerance = 90/((numRegions-1)/4);
for i = 1:numRegions
regions(i) = -90 + (i-1)*(90/((numRegions-1)/2));
end
|
99ca5b859b35c93f1349e077656a7cdd62710509740e34112769af34ccad2e1f | MATLAB | 176 | 7 | function [volume] = volume_ROI()
%volume_ROI Load volume ROIs
m = load(fullfile(util.get_paths().data_versioned, ...
'region_info', 'volume.mat'));
volume = m.volume;
end
|
e79cea846ec86bd818ff27d080a64f44d6c863f740cd46dbc7c2fb361d9950e6 | MATLAB | 176 | 6 | function [min_max_vals] = min_max(this_array)
%MIN_MAX get the minimum and maximum of an array
lin_array = this_array(:);
min_max_vals = [min(lin_array), max(lin_array)];
end
|
17aa256240aaed8452315fc16a2b846605a934dff6a273ce6de9dc4c3ffe25b3 | MATLAB | 177 | 11 | function [L,Ln,Lrw] = f_lap(adj)
% https://github.com/aiavenak/matlab_code/blob/master/f_lap.m
D = diag(sum(adj));
L = D - adj;
Ln = D^(-1/2)*L*D^(-1/2);
Lrw = D^(-1)*L;
end |
2f120fcd2ac0170fa6845905f0b1c72c76fe20f2ae4f9881a47dd0d50027fc1b | MATLAB | 178 | 9 | function dataDir = get_data_dir()
conf = get_conf();
dataDir = conf.dataDir;
assert(isfolder(dataDir), 'Data directory not found. Run set_conf to specify it.');
end
|
e7b3055e2ec473a7e3d6e95fbb48635e67344fb63fba04ee9317fd8fb109458f | MATLAB | 178 | 10 | function [log_m] = logMeanExp(log_x,dim)
if(nargin < 2)
dim = 2;
end
NE = sum(~isnan(log_x), dim);
NE(NE == 0) = nan;
log_m = -log(NE) + kgmlm.utils.logSumExp(log_x,dim);
|
36833573e592367568626b53197f7f8e6beeea34c9a4f6aec2ace9f08dfaabc3 | MATLAB | 179 | 13 |
r = input('What type of experiment? Ferret direction, tree shrew, bird? (f/t/b)','s');
switch r,
case 'f',
dirtpexp_assocs;
case 't',
case 'b',
end;
twophotonbulkload;
|
a5d73dec57f21a10aa0258d5db1752595fe724df624c69943fcb54580d3b5df9 | MATLAB | 179 | 13 | function out = uniRand(a,b,n,m)
%%% 14-07-21 option for matrix output
range = b - a;
if nargin>2
out = rand(n,m)*range + a;
else
out = rand(1,1)*range + a;
end
end
|
331ee14eb16945652e1062bc6ff1d6fef64f1b77b8203c51243c3ed5c016af9d | MATLAB | 180 | 8 | function is_endpoint = IsEndpoint( server )
%ISENDPOINT Summary of this function goes here
% Detailed explanation goes here
is_endpoint = strncmpi(server, 'http', 4);
end
|
ddf44ec1e7dc418d3f2bca4b039c8f2190fc2bff2dc1f198144bfc491d880e03 | MATLAB | 180 | 5 | function [CC, MAG, RMSE] = calculate_params(V1, V2)
CC = corrcoef(V1,V2);
MAG = sqrt(sum(V1(:).^2))/sqrt(sum(V2(:).^2));
RMSE = sqrt(mean((V1(:)-V2(:)).^2));
end |
cd56cd13da3a613b72ef7000351c53e4545072c27b42b2ad12dcedbeeea3897c | MATLAB | 181 | 5 | function self = GetAnnotatorData(self)
% Set up data for manual annotation
self = self.CreateClipTable('IncludeFeatures', false);
self = self.LoadData('IncludeFeatures', false);
end |
959e55912aa73228329b63ab5428210e70e1996fd3f49530c6b15b3dbbadc777 | MATLAB | 185 | 10 | function Genes_compressed = findGenes_compressed(IND_xyp,index)
q = (IND_xyp==index);
if sum(q)~=0
[r,gn]=max(q);
Genes_compressed = gn;
else
Genes_compressed = [];
end
end |
32d6e6ef582ff66c999aa6f20afc2e48f5be0fd1576728aec669cd2b7285fa47 | MATLAB | 186 | 7 | function thelist = TPPreviewImageFunctionListGet
% TPPREVIEWIMAGEFUNCTIONLISTGET - Return the PI function list
TPPreviewImageFunctionListGlobals
thelist = TPPreviewImageFunctionList;
|
3f68b5518566be6b0ff0e9276671f79b778661d72d57acfc91db118712bd27aa | MATLAB | 186 | 5 | function fibers = filter_fibers_by_diam(fibers, minDiam, maxDiam)
filteredFibersIdxs = filter_fiberid_by_diam(fibers, minDiam, maxDiam)
fibers = fibers(filteredFibersIdxs, :);
end
|
351ed8a05d26aace9f5b0a95b99b3d5dfa513b77156db4a07c3057ab1ba68914 | MATLAB | 187 | 8 | %% high-level script for calling components of preprocessing pipeline
run wsws_preprocEEG_train
run wsws_preprocEEG_test
run wsws_ICA
run wsws_ICA_reject_train
run wsws_ICA_reject_test
|
9a946bf7c24e82f760825feb2f0af7ccb56d0a24ac0599590a9faa6dc11eaf7e | MATLAB | 188 | 6 | function [coords_contra] = flip_hemisphere_coord(coords)
%FLIP_HEMISPHERE_COORD flip the X dimension (lateral flip)
coords_contra = coords;
coords_contra(:, 1) = -coords_contra(:,1);
end
|
1d8bbfd95b0cc3d5edd06e19d07e0b393d58edb41ac89ee94c2ea475e16d910a | MATLAB | 189 | 9 | function self = GenerateParams(self)
if self.WriteToFile == false
return
end
configFileParams = ParseConfigFile(self);
self.Params = configFileParams;
end
|
9ccc1c52e7674bc0023bbbcce38ea887c793a07ca5b4a84ddaaaf4d44e2a5c27 | MATLAB | 189 | 7 | function nFibersPerSqMm = uniform(nFibersPerSqMm)
%UNIFORM Summary of this function goes here
% Detailed explanation goes here
outputArg1 = inputArg1;
outputArg2 = inputArg2;
end
|
b57a926533d530828fabe6e2249ecd499ef9ea5c130526d8422196b7b0d0e285 | MATLAB | 189 | 10 | function [y] = sigmoid(x)
% Sigmoid function.
%
% This file is part of SGDLibrary, GDLibrary and SparseGDLibrary.
%
% Created H.Kasai on Oct. 17, 2016
y = 1.0 ./ (1.0 + exp(-x));
end
|
e75a5400c31f0b0c003a21e340831b5b37e4c8da19bb42470fc84df60d6c5d81 | MATLAB | 189 | 7 | % part of https://github.com/LudgerS/MRSartifactRemoval
%
% assumes you enter the absolute frequency!
function ppm = freq2ppm(freq, freqRef)
ppm = (freq - freqRef)/freqRef*10^6;
|
48aa5eced0e56bf0527386950bafa21625e37bdcd8e2d50f81a74009d3aff469 | MATLAB | 191 | 13 | function s = startFastrak(port)
if nargin == 0, port = 'COM3'; end
s = instrfind('Type','serial','Port',port,'Tag','');
s = serial(port,'BaudRate',115200);
fopen(s);
fprintf(s,'F');
end |
6bce19009abcc6cdcfe0e5523aea9ca9b870edcf1dabd1600efaca88f850383f | MATLAB | 191 | 9 | function C = filterData(B, masks)
if isempty(B)
C = []; return
end
% Filter by noise type
isOk = B.SpatialMask == masks(1) | B.SpatialMask == masks(2);
C = B(isOk,:); % Apply filter |
1a331d5605d6029a5830355967f3562c72cb3249f9927c492535fd223b354c1f | MATLAB | 194 | 7 | function [f, power10] = get_first_signif_digit(x)
% Return the first significant digit of the input number x.
power10 = floor(log10(abs(x))) ;
f = fix(abs(x) .* 10 .^ (-power10)) ;
end |
2fbf81cbf7f72ee2097671c5eacb319f0c5923a673e97bae098dc67e437a9002 | MATLAB | 194 | 8 | function [idx_kms, a] = clusk(Z, varargin)
for n = 1:varargin{1}
kms(:,n) = kmeans(Z, n);
kms_sil(:,n) = mean(silhouette(Z, kms(:,n)));
end
[~, a] = max(kms_sil);
idx_kms = kms(:,a);
end |
fafdc7e1cd19448c0a4756eb4ab1c2a6ef81f6d11ae2f05aad6047a53896407b | MATLAB | 194 | 12 | function Vq = nearest(X,Xq)
% Vq = nearest(X,Xq)
%
% Convenient version of:
% Vq = interp1(X,1:length(X),Xq,'nearest','extrap');
%
% DJS
Vq = interp1(X,1:length(X),Xq,'nearest','extrap');
|
5896936f3e0b04c556ce3bf59b4ee6b5bbc14c893c16292a057dbf332e82e661 | MATLAB | 195 | 6 | function [data_dir] = get_data_dir()
%GET_DATA_DIR get the directory path string
data_dir = ...
'/Users/karimia/code/Brain_Network/brainnet_data/Figures_Tables/before_revision/Fig_1/';
end
|
96d5170040ffc0fce47d66806766ce4c0015c2af304667d7eda985a5c28aa8ec | MATLAB | 197 | 8 | function [sc,labels] = cmtk_to_mrtrix3_order(in_sc,in_labels)
FULL_IDX = get_index;
for i=1:length(FULL_IDX)
REV_IDX(FULL_IDX(i)) = i;
end
[sc, labels] = reorder(in_sc,in_labels, REV_IDX); |
9af210e7197f30ed7222718ac30e46aa4c3a9d4af8e399634a1a03d9501f2718 | MATLAB | 197 | 6 | function SaveAllAnnotations(self, allAnnotT)
for i = 1:size(allAnnotT)
currAnnot = Annotation(self, allAnnotT.VideoName{i});
currAnnot.OverwriteAnnotation(allAnnotT.Annotations{i})
end
end
|
bab52079388d13d6ae2fd21b9caa312e6e5fc75afdc956ff275b3de8ff14fbb7 | MATLAB | 199 | 8 | function clear_model_file(name)
model = mphload(name);
clear_model(model);
mphsave(model, name, 'optimize', 'size');
import com.comsol.model.util.ModelUtil;
ModelUtil.remove(model.tag);
end
|
4245c48c9ef95585b510b9cc33e100f5c9cf208871d525b0f06a8d745169f0d0 | MATLAB | 200 | 11 | function x = mirror_mat(x)
N = length(x);
for i=1:N
x(i,i) = 0;
for j=1:N
if isnan(x(i,j))
x(i,j) = x(j,i);
end
end
end
end
|
6942cda5d62756772941c72defb76fb1fabfb6617f15a6245ff428f8ebed6d73 | MATLAB | 200 | 5 | function fnameprefix=tpfnameprefix(dirname,channel)
fname = dir([dirname filesep '*Cycle001_Ch' int2str(channel) '_000001.tif']);
fname = fname.name;
fnameprefix = fname(1:strfind(fname,'Cycle')-1); |
33bfce11f804bb41d27b9e0ea20ab5ddccda719a81ad22029b1fd1d8445d33c2 | MATLAB | 201 | 6 | function fn = analyzetpstack_getoldsavedfilename(ds,stackname,dirname)
% returns the old saved filename
scratchname = fixpath(getscratchdirectory(ds,1));
fn = [scratchname stackname '_' dirname ];
|
0641ec7d969e1fc7d8b55dcc1c41b6aecc4cb663a76f4422166e01ded6ae9900 | MATLAB | 202 | 8 | function [fh] = set_fig_size(fh, dimensions)
%SET_FIG_SIZE set the units to centimeters and then adjust the dimensions
%of the figure
fh.Units = 'centimeters';
fh.Position = [10, 10, dimensions];
end
|
1085caba4fc9f1f1d0ab7e3e2a9f854bec8d635154bd4c5fa8f5ef42dbb69ce6 | MATLAB | 202 | 5 | function self = GenerateConfidenceScores(self)
self = self.TrainConfidenceScorer();
self.ClipTable = self.ConfidenceScorer.GenerateClipScores(self.ClipTable);
self = self.EvaluateConfidenceScorer();
end |
4c13caba49e564b9eb34355ee8639a909bfc841b542abce884d6981e019eb8fb | MATLAB | 203 | 13 | clear;clc;
DataPath='Example/InputData';
Output='Example/INSCAPE_Results';
SubID='0025428';
DistMethod='cityblock'
BrainStateMap=1;
INSCAPE_Analysis(DataPath,Output,SubID,DistMethod,BrainStateMap)
|
ded4ab4231148e8958c1958b4da871f33f099cc86b8ca9e48a22a8c50e4adbe5 | MATLAB | 204 | 6 | function fn = analyzetpstack_getoldrawfilename(ds,stackname,dirname)
% returns old raw file name
scratchname = fixpath(getscratchdirectory(ds,1));
fn = [scratchname stackname '_' dirname '_raw.mat'];
|
afef633764279a516500b711452a92e5f4eddec5f1a87b35e2be512a36458e57 | MATLAB | 205 | 12 | function out = IntenScale(in)
% in are pixel intensities 0<=in<=1
% out 0<out<255
T = 252;
v = 6;
out = exp(-1*(in-T).^2/v);
out(in<T) = in(in<T)/T;
%return;
% DC = 30;
% out(in<30) = 0.1; |
e2bbdb0740e21431b512789bad0941b83a997e354692663b8da1e1bfd38c515f | MATLAB | 205 | 13 | function conf = get_conf()
confFile = fullfile(userpath, 'hen_conf.mat');
if exist(confFile, 'file')
load(confFile, 'conf');
end
if ~exist('conf','var')
conf = set_conf();
end
end
|
28c5bdcb5c6b0912389a9496f4ee89c0f627a812509a2eb4572dae2cd0aaf485 | MATLAB | 207 | 10 | function y = soft(x,T)
% y = soft(x,T)
% soft-thresholding function
% proximity operator for l1 norm
if sum(abs(T(:)))==0
y = x;
else
y = max(abs(x) - T, 0);
y = y./(y+T) .* x;
end
|
f59a0ac0229540a1699d11f0ae96adeb4456a699ac283f781bd2f3885a80e370 | MATLAB | 207 | 6 | function [concat_corr] = concat_correlations(correlations, indices)
%CONCATENATE_CORRELATIONS concatenate correlations
correlations = correlations.Variables;
concat_corr = cat(1,correlations{indices});
end
|
4819e955aaa6b26f8251fbae15f78b4830bc805a3def3cb0956c478f45f3c0c3 | MATLAB | 208 | 6 | %% high-level script for calling components of stim reconstruction pipeline
run wsws_stimrec_filtEnv
run wsws_stimrec_prepStim_mTRF
run wsws_stimrec_Training_EnvTimeLags
run wsws_stimrec_Testing_EnvTimeLags
|
f0b5c5fdaf718cc95dd381aee15690a2f19c64cb5f44766b443d0e5b591346ab | MATLAB | 211 | 6 | function str = remove_special_char(str)
% Remove characters forbidden for path names
forbidden = ["/", "<", ">", ":", """", "|", "?", "*", arrayfun(@string, char(0:31))];
str = erase(str, forbidden);
end
|
bf1932cd0e0506e49119d1a0597b747ce11da4c6f6ce7bcdc341b4c07422286b | MATLAB | 212 | 8 | function self = RefreshClipTable(self)
clipTPath = fullfile(self.ProjectPath, 'annotations', 'ClipTable.mat');
if isfile(clipTPath)
s = load(clipTPath, 'ClipTable');
self.ClipTable = s.ClipTable;
end
end |
1425e28f24cad1eaceb773cd86722bcdd2eb6d2dd2a819d562521bc64dfeb2e9 | MATLAB | 214 | 8 | function makeCoderEm(TDatend,tcut)
fhz1 = 19.965*4; % main timstep
T1=0:1/fhz1:TDatend+tcut;
Liley_params;
y0=zeros(1,10);
params1=[paramsvec, y0];
codegen em_Liley.m -args {T1, params1} -test forCoder
end
|
3dd202fdcef17cea7a4609263d4500de879dc5009b5c6738f34ad41c4514ebd9 | MATLAB | 214 | 9 | function [normalize_arr] = normalize_0_1(arr, DIM)
%NORMALIZE_0_1 normalize to 0_1 range
arguments
arr
DIM = 1
end
normalize_arr = (arr - min(arr, [], DIM)) ./ (max(arr, [], DIM) - min(arr, [], DIM));
end
|
18abe84878bb108cbbd37d0cc27da446274928c5a880952b74e9f71729993713 | MATLAB | 216 | 8 | function isn = checkStrIsNum(Str)
% isn = checkStrIsNum(Str)
%
% True if all values in strtrim(Str) are numeric characters.
%
% Daniel.Stolzberg@gmail.com 2016
isn = all(ismember(strtrim(Str),'0123456789+-.eEdD')); |
6bba2c858f4c013eb9f3515685b1741ccd798c66abc9e53248b046f3839a3faf | MATLAB | 217 | 14 | function [names,n] = getFilesInDir(dirName)
%%% 26-01-23 first commit
fList=dir(dirName);
fList([fList.isdir])=[];
names={fList.name};
assert(~isempty(names),['no files in dir ' dirName])
n=length(names);
end |
dc9b26010d99c117137729da440406249c0d7867d5c5a15045eb1059c8891325 | MATLAB | 217 | 12 | function Tinnitus2AFC_Launch
global RUNTIME
f = findobj('type','figure','-and','name','Tinnitus2AFC_Monitor');
close(f);
for i = 1:RUNTIME.NSubjects
Tinnitus2AFC_Monitor(RUNTIME.TRIALS(i).Subject.BoxID);
end
|
06272c00c6b001e1ca284aa9f178eda6f9542911e2b32b967d2263c07c4c6017 | MATLAB | 218 | 9 | function[z]=fisherz(r)
%FISHERZ Fisher's Z-transform.
% Z = FISHERZ(R) returns the Fisher's Z-transform of the correlation
% coefficient R.
%20080103, Thomas Zoeller (tzo@gmx.de)
%r=r(:);
z=.5.*log((1+r)./(1-r)); |
600b0c8bc7d2adc8b9d9670aecd6cfdba9b33b108e6a44ef9b68f0aa77e91aa6 | MATLAB | 218 | 11 | function assert_warn(cond, msg, varargin)
% Like 'assert' but throwing a warning
if ~cond
if nargin > 1
warning(msg, varargin{:});
else
warning('Assertion failed.');
end
end
end
|
809cd330dbabaa4a582c3eb8d7350590d88660023531eeaf90889acafba9b8cc | MATLAB | 220 | 5 | % Large svgs are not correctly saved with the -opengl renderer
set(0, 'DefaultFigureRenderer', 'painters');
addpath(genpath('/Users/karimia/code/Brain_Network/matlab'))
addpath('/Users/karimia/code/Brain_Network/gifti') |
b5edbe317efd9c88baa20bf91fff4b3828fdc6f3efd0345d4f1ab549e8a939f9 | MATLAB | 220 | 10 | function [ y ] = modelfun_HC( beta, x )
%UNTITLED7 Summary of this function goes here
% Detailed explanation goes here
beta_aux = beta([1 2 3 4 4 5 5]);
beta_aux(5) = 0;
y = modelfun_HEC(beta_aux, x);
end
|
616dc57df626986aca85e88fb8e7e3f7a4b0b622b9546c55e87ba3701adc1dc0 | MATLAB | 221 | 10 | function [ y ] = modelfun_HEC( beta, x )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
beta_aux = beta([1 2 3 4 5 6 7 7]);
beta_aux(8) = 1;
y = modelfun_dHEC(beta_aux, x);
end |
0857132d2ca66692fe6b1a2b6c7c91f1c21e510c0edc880d5e038051d4ad04fa | MATLAB | 222 | 12 | function [coef] = myassort_und(mat,corrtype)
if nargin<2
corrtype = 'pearson' ;
end
tmpdist = sum(mat,2,'omitnan');
[i,j] = find(triu(mat,1)>0);
ii = tmpdist(i);
jj = tmpdist(j);
coef = corr(ii,jj,'type',corrtype) ;
|
e70bf4ee8a0d5b60431d8b4567c0cbb6da263b02bb2662f76eeba9f492df5ccf | MATLAB | 222 | 13 | function [whitened_signals, C, W] = whiten_signals(signals)
C = cov(signals');
[V,D] = eig(C);
W = V * (sqrt(D)\V');
whitened_signals = W * signals;
whitened_signals = real(whitened_signals);
end
|
34c829e3baa3362e0853c559e2f19c3eb697907aa7078c45d49713f72e82c172 | MATLAB | 223 | 15 | function[output]=filter_b_f(EEG, cutoff, sample_rate,high_or_low,order )
% apply filter
ny=sample_rate/2;
cutoff=cutoff/ny;
[b,a] = butter(order, cutoff, high_or_low);
EEG_f = filtfilt(b,a,EEG);
output = EEG_f;
end
|
72f6df814fc6596d1956483b6928dace0c2b525c418051026887f1a89508e7eb | MATLAB | 223 | 12 | function str_TP = get_str_TP(p_vec)
% Str describing the TP in inputs.
%
% Input
% p_vec length-2 vector of TPs
%
str_TP = ['_TP', num2str(round(100*p_vec(1))), '_', num2str(round(100*p_vec(2)))] ;
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.