sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
a97764a2473a8012182ce0f6b06656a4c86073c457cb4b043c59e72deed5fd11 | MATLAB | 243 | 9 | function filename_abs = absolute_filename(filename)
% Convert a filename to an absolute path.
if is_filename_absolute(filename)
filename_abs = filename ;
else
filename_abs = fullfile(pwd(), filename) ;
end
end
|
7b594d0cb272f0760b5506852465d436cb04b6ca7c682a3c2abf553dc1dcec90 | MATLAB | 244 | 12 | function Q = qInv( Q1 )
% qInv: quaternion reciprocal (inverse)
% Q = qInv( Q1 )
% IN:
% Q1 - input quaternion
%
% OUT:
% Q - reciprocal of Q1, i.e. Q1*Q = 1
%
% VERSION: 03.03.2012
Q = qConj( Q1 ) ./ qLength( Q1 )^2; |
9ebf9e7b95d86cdf19fe2631e5fdbc5d0486f4d4a2bae03f5effa771d1b79e60 | MATLAB | 244 | 15 | %
% Compute Kendall tau precision measure.
%
% RESULT
% value Correlation value
%
% PARAMETERS
% p (e*1) Predictions
% T (e*3) To be predicted
%
function [value] = measure_compute_kendall(p, T)
value = corr(p, T(:,3), 'type', 'Kendall');
|
bb1a32205d2f7938fd589762c572842ec6c586b80a674a959b54f42ae1371ff9 | MATLAB | 244 | 11 | function R=conc(wm, vent, FR)
%% function R=conc(wm, vent, FR)
%
% This function concatenate and detrend regressors. It adds derivatives to
% wm, vent
%%
sR=[wm vent]; %simple regressors
dR=diff(sR);
dR=[0 0;dR];
R=[sR dR FR];
% R=detrend(R);
|
bce72bd4e3a2db3db64d15f6bff3871adedbdfdcedcfbcf3e539152bbb9995f9 | MATLAB | 244 | 8 | function ret=SONSetBuffSpace(fh)
% SONSETBUFFSPACE allocates buufer space for file writes
%
% Author:Malcolm Lidierth
% Matlab SON library:
% Copyright © The Author & King's College London 2005-2006
ret=calllib('son32','SONSetBuffSpace',fh);
|
246a6830e66deba00e6a251afd171be82bde686cbd6a026497fc009e5103b702 | MATLAB | 245 | 7 | function [ reconstructed_worm ] = PCA_Reconstruction(ProjectedEigenvalues, EigenVectors, Modes )
% Reconstructs the worm using the top n modes of the PCs
reconstructed_worm = EigenVectors(:,1:Modes) * ProjectedEigenvalues(1:Modes,:);
end
|
a44ba6f9b6c90934c1a9119cc7875dd613e3e806a3ef58844b0b7b0b4bdfa14f | MATLAB | 245 | 6 | % Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024
function [coloursYellowPurple] = colour_matrix_yellow_purple()
coloursYellowPurple = [
0.929, 0.694, 0.125; ...
0.494, 0.184, 0.556];
end
|
611921185356be728b7ed5f9f7979d6f1d8ea910253117d8c7c957ba96236d7a | MATLAB | 246 | 18 | function gids = ml_util_group_points(x, maxsep)
dx = diff(x);
gids = zeros(1,length(x));
k = 1;
gids(1) = 1;
for i = 1:length(dx)
if dx(i) <= maxsep
gids(i+1) = k;
else
k = k + 1;
gids(i+1) = k;
end
end
end |
2b92c084f85d970034677b4ecb3ef32f016b73564d752ff3da771c21446d062b | MATLAB | 247 | 10 | function [header] = ml_nlx_mclust_load_spikes_header(filename)
fid = fopen(filename, 'rb','b');
if (fid == -1)
error('Could not open t-file %s.', filename);
end
header = ml_mclust_readheader(fid);
fclose(fid);
end |
4b509e5e25185700510651a352dd8e0e4d37654a0ce1924212751bae132a36d4 | MATLAB | 247 | 9 | function [J] = ml_alg_entropy_prep_image(I, NUM_BINS)
% J will be discrete valued
minI = min(I, [], 'all', 'omitnan');
maxI = max(I, [], 'all', 'omitnan');
J = (I - minI) ./ (maxI - minI) * NUM_BINS;
J = floor(J);
end |
02744c3ab1ebf7f82547762f74f92106bdb8373b905751747b8fd68b22a4ef99 | MATLAB | 248 | 8 | function result = absolute_filename_passing_empty(filename)
% Like absolute_filename(), but empty input leads to '' as output.
if isempty(filename) ,
result = '' ;
else
result = absolute_filename(filename) ;
end
end
|
3d7339c550b6d5c52e481d7361628d8a6d5b278e19b2300aaaa8e9b1cdde7eca | MATLAB | 248 | 7 | function out = calculateKLCost(x,ydata,ps)
%calculateKLCost is used by findTDistributedProjections_fmin.m to calculate
%an optimal embedding point
d = findListDistances(x,ydata);
d = d.^2;
out = log(sum((1+d).^-1)) + sum(ps.*log(1+d)); |
2dc2128d17adecedbad90fda84c3da1b4023f7be26cd0a1a4fca277b6aa2c0bb | MATLAB | 250 | 8 | function gauss = createGauss(size, sigma)
[Xm, Ym] = meshgrid(linspace(-.5, .5, size));
s = sigma / size; % gaussian width as fraction of imageSize
gauss = exp( -(((Xm.^2)+(Ym.^2)) ./ (2* s^2)) ); % formula for 2D gaussian
end
|
5a715d668aae79bd3a7066180395e8609d16f3dde6dc1c3ab3f2765ec61e95a5 | MATLAB | 250 | 10 | function IM = NS_RecordLoad(Experiment, IDs)
Group = Experiment.Groups(IDs.Group).Group;
Record = Group.Records(IDs.Record).Record;
FileName = fullfile(Record.Path, Record.Name);
IM = imread(FileName);
if size(IM,3) == 3
IM = rgb2gray(IM);
end
|
61f0da24a74ff55d8ef803b16f3ecaeb30fa8acb355211df2454a025d92004f9 | MATLAB | 250 | 13 | function err = getNumberMisclassifiedSamples(C)
%init
err = 0;
%loop on confusion matrix
for f1 = 1 : size(C, 1)
for f2 = 1 : size(C, 2)
if f1 ~= f2
err = err + C(f1, f2);
end %if f1 ~= f2
end %for f1
end %for f2 |
241d2caadb8a0fd62f066cecba792839a553fa1a7ee941e96b543a19cce38518 | MATLAB | 252 | 8 | function ret=SONSetBuffSpace(fh)
% SONSETBUFFSPACE allocates buufer space for file writes
%
% Author:Malcolm Lidierth
% Matlab SON library:
% Copyright © The Author & King's College London 2005-2006
ret=calllib('son32','SONSetBuffSpace',fh);
|
7506c8de2645ce8e48ac7ea1079a37877f5039bf24fe81d0712e4adb79ba22af | MATLAB | 252 | 10 | function [texture] = createTexture(fl, w)
[img, ~, alpha] = imread(fl);
[~, ~, t3, ~] = size(img);
if t3 == 1 % this means its a monochrome image
img(:, :, 2) = alpha;
else
img(:, :, 4) = alpha;
end
texture = Screen('MakeTexture', w, img);
end
|
0747a943c8f70c126aa3281f2520bdd9c934745a76ae6266422c0c0c38e0864f | MATLAB | 253 | 6 | % program: mglEyelinkGoOffline
% by: eric dewitt and eli merriam
% date: 02/08/09
% copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING)
% purpose: Places EyeLink tracker in off-line (idle) mode.
% usage: mglEyelinkGoOffline |
464cb6e5d197bb2053b931345dd30f784ec2c710e900c61b3e67e677a6a4f110 | MATLAB | 253 | 10 | function fprintf_pers(fidCell, string, paramString)
for c = 1 : numel(fidCell)
fid = fidCell{c};
if nargin == 3
fprintf(fid, string, paramString);
else %if nargin == 3
fprintf(fid, string);
end %if nargin == 3
end %for c |
49bf0ac7cd2247e84eabfae24d1532ebd834c01a86a33b484a162a2bf8a3e86d | MATLAB | 254 | 8 | function [similarity indSim] = SSSimColourFlowSize(a, b, blobStruct)
% Colour + Flow + Size
indSim(:,1) = SSSimColour(a, b, blobStruct);
indSim(:,2) = SSSimFlow(a, b, blobStruct);
indSim(:,3) = SSSimSize(a, b, blobStruct);
similarity = mean(indSim, 2); |
bc607024915e4fc0eacf85669c49dc125e8651cbcd5d627e92694254e02b485f | MATLAB | 254 | 12 | function [H,lags] = spikeHazard_vector(delta_vec)
%spikeHazard_vector.m 5/22/22
ISI = getISI_vector(delta_vec);
edges = [1:max(ISI)+1]';
cts = histcounts(ISI,edges)';
PDF = cts./sum(cts);
[S,lags] = spikeSurvivor_vector(delta_vec);
H = PDF./S;
end %fn |
e7a7ac324a07961e3c6d10a72bce992f2b137be36b895d64c8850eb52cba8f21 | MATLAB | 254 | 11 | function norm_A = my_Normalize(A, min_r, max_r)
B = double(A);
max_A = max(B(:));
min_A = min(B(:));
if max_A - min_A < eps,
norm_A = B;
else
norm_A = (B - min_A) / (max_A - min_A);
norm_A = norm_A * (max_r - min_r) + min_r;
end
end |
099cabadc8cf4bcf0644e90ccba78863351029d150b409376b9a8b6fd6fc3585 | MATLAB | 255 | 6 | % Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024
function [R] = load_tetrode_sessions_to_groups_table()
R = load_tetrode_animal_day_table();
R.groupId = R.dayNum;
R.groupLabel = R.dayLabel;
end % function
|
665b139f3458735087e783bee4f85573bd8be9c802ea7aeccc002b66262ac1e0 | MATLAB | 255 | 6 | % getElectrodesNumber.m
% Takes as input a single trial folder (peak trains folder) and extracts the number of
% files contained into it --> number of recording electrodes
function [n] = getElectrodesNumber(folder)
files = dirr(folder);
n = length(files); |
ebf9e98923e09b6b135353bea2bd0738d0470ebdbbeb66edb8f580d44aad09e5 | MATLAB | 255 | 13 | function jvline(location,linewidth,color)
h = gca;
y_points = h.YLim:h.YLim(2)*1.1;
x_points = ones(size(y_points))*location;
hold on
plot(x_points,y_points,'LineWidth',linewidth,'Color',color,'LineStyle',':');
ylim([min(y_points) max(y_points)])
end |
046fd62ba0b7bdc76653ad8c9e5d21d2464e5b45ae82dce5c793c9f7afabb318 | MATLAB | 256 | 8 | function buffsize=SONPhySz(fh, chan)
% SONPHYSZ returns the buffer size for the specified chanel
%
% Author:Malcolm Lidierth
% Matlab SON library:
% Copyright © The Author & King's College London 2005-2006
buffsize=calllib('son32','SONPhySz', fh, chan);
|
e8f9087a92a32a764233a6caae0b602829b59c55ff6f1953c0d485a620b055f7 | MATLAB | 256 | 8 | function [y] = ml_alg_movmean(x, windowSize)
% https://www.mathworks.com/help/matlab/ref/filter.html?s_tid=doc_ta#bt_vs4t-2_1
a = 1;
b = (1/windowSize)*ones(1,windowSize);
x = reshape(x, 1, length(x));
y = filter(b,a,x);
end % function |
35fb8d50f01c45ae258973e8b183d991f8e0146e25883061efa356e5a895155a | MATLAB | 257 | 9 | function my_dpca_plot(Xfull, W, V)
% produces a plot of the dPCA results. X is the data matrix, W and V
% are decoder and encoder matrices
X = Xfull(:,:)';
Xcen = bsxfun(@minus, X, mean(X));
Z = Xcen * W;
b = V(:,1:numCompToShow)'*V(:,1:numCompToShow);
end |
be9b82a0cab320cbee410fb236702e570b2e6ccd5983efb95c6269376408bf4e | MATLAB | 257 | 8 | function Masksb = threshold_Masks(Masks, thb)
N = size(Masks,3);
Masksb = logical(Masks);
for k = 1:N
mask = Masks(:,:,k);
thred_inten = thb*max(mask,[],'all');
Masksb(:,:,k) = threshold_frame(mask, thred_inten);
end
|
431e256f6977fe5bb6b6b11e1eca34ab3c54e2d3d8f3dd8876ab44c1d3cab53f | MATLAB | 258 | 10 | function ap = xVOCap(rec,prec)
% From the PASCAL VOC 2011 devkit
mrec=[0 ; rec ; 1];
mpre=[0 ; prec ; 0];
for i=numel(mpre)-1:-1:1
mpre(i)=max(mpre(i),mpre(i+1));
end
i=find(mrec(2:end)~=mrec(1:end-1))+1;
ap=sum((mrec(i)-mrec(i-1)).*mpre(i));
|
d4584a9d344d442362f62d875581811913a2a4a2853081de457908fd6113e70c | MATLAB | 258 | 15 | %
% Compute Spearman correlation link prediction measure.
%
% RESULT
% value Correlation value
%
% PARAMETERS
% p (e*1) Predictions
% T (e*3) To be predicted
%
function [value] = measure_compute_spear(p, T)
value = corr(p, T(:,3), 'type', 'Spearman');
|
fc34e4a49d716f337cdefc3345df754abce68f4457b46cf84014c77cde275716 | MATLAB | 258 | 9 | function [drift] = baseline_drift(eeg, Fs, baseline_length)
%BASELINE_DRIFT Summary of this function goes here
% Detailed explanation goes here
baseline = eeg(1:baseline_length*Fs);
[p, f] = powerspectraldensity(baseline, Fs);
drift = mean(p(f<0.5));
end |
1323edf3c2453fe2c409b7aa2966b9e685ebceedcb642322c32ee5e0f2fb0a1c | MATLAB | 259 | 4 | function [distanceMap] = ml_egomaps_binsystem_distancemap(binSystem)
% Make a map of distances for each grid point
distanceMap = sqrt(binSystem.XX.^2 + binSystem.YY.^2); % This is fine because the origin is at 0,0 in center of the grid
end % function
|
4c0b6423f966455c25eea317a6a2b94a5fea058ae91703dcc546ee5d84ceb460 | MATLAB | 259 | 8 | function set_figure(fontsize)
set(gca,'FontName','Arial');
set(gca,'FontSize',fontsize);
set(gcf,'Color','w')
set(gca,'FontName','Arial')
%set(gca,'Color','k'b)
set(groot,{'DefaultAxesXColor','DefaultAxesYColor','DefaultAxesZColor'},{'k','k','k'})
axis square |
52cfc368a70eb310a5ac7f5ffdb512d7e1479a0534d466c301e6ddfa2fdb931f | MATLAB | 259 | 11 | function ip=subsasgn(ip,S,B)
% INPLACE/SUBSASGN Support Matlab subscript assignment
%
% This function supports subscript assignment just like Matlab matrices.
%
% Example:
% ipa = inplace(cumsum(ones(5,1)));
% ipa([2 4]) = 1;
% ipa
ip.subsasgn(S,B); |
5a4213236ac48b64d6c3374ba0302a5b0a4c6f752db986a1160c18f15e9a492d | MATLAB | 261 | 9 | function [ x_px, y_px, z_px ] = mm2pxl( x_mm,y_mm, z_mm, opt )
%MM2PXL Change to mm coordinates to pixel coordinates
x_px = x_mm/opt.one_pxl_mm;
y_px = opt.yres - y_mm/opt.one_pxl_mm;
if nargin == 4
z_px = -z_mm/opt.one_pxl_mm;
end
end
|
692e82a32f0f0a0d83ae5857474cb1ef4cdfc60f1b15eefa210526798fdc1747 | MATLAB | 263 | 11 | function x = logdet(A)
% LOGDET - computes the log-determinant of a matrix A
%
% x = logdet(A);
%
% This is faster and more stable than using log(det(A))
%
% Input:
% A NxN - A must be sqaure, positive semi-definite
x = 2*sum(log(diag(chol(A))));
|
9bf6d43b149846e6e43a73e23980d0970352f489803649a308ede324f9f4b4ca | MATLAB | 263 | 8 | function [similarity indSim] = SSSimColourTextureSize(a, b, blobStruct)
% Colour + Texture + Size
indSim(:,1) = SSSimColour(a, b, blobStruct);
indSim(:,2) = SSSimTexture(a, b, blobStruct);
indSim(:,3) = SSSimSize(a, b, blobStruct);
similarity = mean(indSim, 2); |
efc0a608b920076d6e7fc308f038f844f6dd39388ce5b6d751153144a0f1c469 | MATLAB | 263 | 15 | function lab= convertLab(lab,nlab)
%keyboard
lab = char(lab);
for i=1:nlab
ilab=lab(1,:,i);
ind= strfind(ilab,'D_');
ilab(ind:ind+1)=[];
ind= strfind(ilab,'_');
ilab(ind)=[];
ilab(isspace(ilab))=[];
labs{i}=ilab;
end
lab=labs; |
17c844c0930202acded82d1913bb44fd2ae0f797f9419dabeedbbfd918bbc5a3 | MATLAB | 264 | 8 | function [similarity indSim] = SSSimTextureSizeFill(a, b, blobStruct)
% Texture + Size + Fill
indSim(:,1) = SSSimTexture(a, b, blobStruct);
indSim(:,2) = SSSimSize(a, b, blobStruct);
indSim(:,3) = SSSimBoxFillOrig(a, b, blobStruct);
similarity = mean(indSim, 2); |
1c668dde7859e95c1a6831d76e0f244a59e3402ae919d3973f252abd2bf7223e | MATLAB | 264 | 8 | function buffsize=SONPhySz(fh, chan)
% SONPHYSZ returns the buffer size for the specified chanel
%
% Author:Malcolm Lidierth
% Matlab SON library:
% Copyright © The Author & King's College London 2005-2006
buffsize=calllib('son32','SONPhySz', fh, chan);
|
7ca24e40841380738c2916b91dbe378ed6149a2f21084f134fa268a30b8effd0 | MATLAB | 264 | 15 | load('imports-85')
Y = X(:,14:15);
[n,d] = size(Y);
X1 = zscore(X(:,3));
X2 = zscore(X(:,7));
X3 = X(:,18)==20;
Xmat = [ones(n,1) X1 X2 X3];
Xcell = cell(1,n);
for i = 1:n
Xcell{i} = [kron([Xmat(i,:)],eye(d))];
end
[beta,sigma,E,V] = mvregress(Xcell,Y);
beta |
b8f4f37907e70341b1751418f47f746d05141dbaafb34606a7455ae951d5b3d2 | MATLAB | 264 | 11 | function R=conc(wm, vent, WB, FR)
%% function R=conc(wm, vent, WB, FR)
%
% This function concatenate and detrend regressors. It adds derivatives to
% wm, vent and WB
%%
sR=[wm vent WB]; %simple regressors
dR=diff(sR);
dR=[0 0 0;dR];
R=[sR dR FR];
% R=detrend(R);
|
33404df4c8dc8907fd613cc2ee76b98f7fd498949557c905424d0a4d2a050598 | MATLAB | 267 | 7 | function fix_SetCreatedObjectBgColor( hObject, color )
% set the background color for a newly created GUI object
% JAB 6/23/12
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',color);
end
|
ff8b2a9ab317fe3be587819e65d68e812b21b612dabeb0309dd774de19e42bf8 | MATLAB | 267 | 10 | function maskdata = refinenetPredict(net, I)
imwrite(I, 'temp.png');
task_info=[];
task_info.img_dir='./';
task_info.img_filename='temp.png';
task_result=net.runner_info.run_task_fn(net.runner_info, task_info);
maskdata = task_result.mask_data;
end
|
11e8aba2d7add4b30eb5b1249eeea82cc651304a1d1b4c3435d4f0caac5935ed | MATLAB | 268 | 10 | %% s_prepareDataForModelFits.m
projectDir = simseqRootPath;
subjnr = 1;
%% Step 1: Get square ROIs
getStimROIsFromRetinotopy(projectDir,subjnr);
%% Step 2: concatenate par files with stimulus condition onset/offsets
concatParfilesUniqueRuns(projectDir, subjnr)
|
0779415b0160091828785541b520ecb53593a3d8f7c97dc4603f141297f72fe2 | MATLAB | 269 | 1 | function Dif = GetAngleDif(x,y)
% This function subtracts x from y, taking into consideration
% "wrap-around" issues with a period of 360
Dif = y - x;
Index = find(Dif > 180);
Dif(Index) = 360 - Dif(Index);
Index = find(Dif < -180);
Dif(Index) = -360 - Dif(Index);
|
cf20fd16e9a91110f94f134df012312e2b02125bba5ed372fe0bdb69de776806 | MATLAB | 270 | 7 | function [hsize, hhsize] = ml_util_compute_gaussian_size(smoothingKernelGaussianSize_cm, cmperbin_square)
hsize = ceil(smoothingKernelGaussianSize_cm / cmperbin_square);
if mod(hsize,2) ~= 1
hsize = hsize + 1;
end
hhsize = floor((hsize-1)/2);
end |
f297cbc8439ac27513ca1acf57f747a85ca42a9e1864c6dac628a40583310704 | MATLAB | 270 | 8 | function tmpRes = initTmpRes(gaborBank, powerMapF)
tmpRes(numel(gaborBank)).value = 0;
for g = 1 : numel(gaborBank)
%get size of current powermap
currentSize = size(powerMapF(g).value);
tmpRes(g).value = zeros(currentSize);
end %for g = 1 : numel(gaborBank) |
8af1255d1114a4b0f2a90530375b0b15416cba0c3840ab54d2b460ec8bf68a65 | MATLAB | 272 | 12 | function out = ndims(fa)
% Number of dimensions
%_______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%
% $Id: ndims.m 8776 2013-11-14 09:04:48Z roboos $
out = size(fa);
out = length(out);
|
fd7c9f9b275401b96a165f7c3f7398835f5de14b9f3a90f44ba6534229d7dbae | MATLAB | 273 | 10 | function OutMask = imerode3dslice(InMask, se)
OutMask = InMask;
for sliceInd = 1:size(InMask, 3)
if (~isempty(find(InMask(:,:,sliceInd)>0, 1)))
OutMask(:,:,sliceInd) = imerode(InMask(:,:,sliceInd), se);
end
end |
20b558b0219cf71ac8c8dd83e6597087bd233bb149bb5b81361b87727cb3daa8 | MATLAB | 274 | 11 | % Author: Zachary Chiang, Buenrostro Lab, Harvard University
% Loads a 3D .tif file with the given dimensions
function[img] = read_3d_tif(filename, xlen, ylen, zlen)
img = zeros(xlen, ylen, zlen);
for z = 1:zlen
img(:,:,z) = imread(filename, z);
end
end
|
b411977e22dcc235b4bc59c7ab9bd571807ea9d8bf6443aa04b56a76d93fdf2a | MATLAB | 274 | 9 | function has_variance_flag = has_variance_file(cousin_file)
[ filepath , name , ext ] = fileparts(cousin_file);
old='_mask';
new='_timeseries_variance';
name = strrep( name , old , new );
var_file=[filepath filesep name '.txt'];
has_variance_flag=isfile(var_file); |
caa0e41428fa50f657afe890e99064a317927be1ed364044210815b878e82475 | MATLAB | 274 | 14 | function lab= convertLab(lab,nlab)
lab=char(lab)
for i=1:nlab
%ilab=lab(:,:,i);
ilab=lab(i,:);
ind= strfind(ilab,'D_');
ilab(ind:ind+1)=[];
ilab(ilab=='_')=[ ];
ind= strfind(ilab,'resA');
ilab(ind:ind+3)=[];
labs{i}=ilab;
end
lab=labs; |
d60910e0999184263b86ebadddf3d3ac23ae4c67ebc142059c0c4bfc5fd46b9f | MATLAB | 274 | 9 | %% Data for Fig. 5
% The authors are currently preparing a follow-up paper that will provide
% a more detailed analysis of the data presented in Figure 5.
%
% The data is available upon request and will be deposited alongside the
% publication of the upcoming paper.
%
|
1334f030a34e24af6d5af20c5b751e407494aeeedd098176d871ba5eb1f07186 | MATLAB | 275 | 9 | global rrr;
if ~exist('rrr'), rrr=0; end;
rrr=rrr+1;
[user sys]=memory;
MALAB_used_mem(rrr) = user.MemUsedMATLAB/10^6; %in MB
fprintf(1,'available memory: %.0f matlab used: %.0f MB rrr=%d\n',sys.PhysicalMemory.Available/10^6,user.MemUsedMATLAB/10^6,rrr)
T0=tic;
|
5541702d1966fb93609e585d90b3a43df3edb931737e4a2c851d9280d8f579c7 | MATLAB | 275 | 14 | function lab= convertLab(lab,nlab)
lab=char(lab)
for i=1:nlab
%ilab=lab(:,:,i);
ilab=lab(i,:);
ind= strfind(ilab,'D_');
ilab(ind:ind+1)=[];
ilab(ilab=='_')=[ ];
ind= strfind(ilab,'resA');
ilab(ind:ind+3)=[];
labs{i}=ilab;
end
lab=labs; |
a3be98a85adda3e9d36e81e1d51a6a0ecdafaef51a35afa56c415e9451de4b3b | MATLAB | 275 | 10 | function OutMask = imdilate3dslice(InMask, se)
OutMask = InMask;
for sliceInd = 1:size(InMask, 3)
if (~isempty(find(InMask(:,:,sliceInd)>0, 1)))
OutMask(:,:,sliceInd) = imdilate(InMask(:,:,sliceInd), se);
end
end |
aa034d385a302d7b1dd5e1d9e99dbed4a344b5b2e2ed786876c6e2976a936891 | MATLAB | 275 | 9 | function [similarity indSim] = SSSimSize(a, b, blobStruct)
% function similarity = SSSimSize(a, b, blobStruct)
%
% Calculate size similarity
similarity = (blobStruct.imSize - blobStruct.size(a) - blobStruct.size(b)) ...
./ blobStruct.imSize;
indSim = similarity; |
f2735a54b7a719ed4bbf7871331e92daf15278c129b3b06650fbfc1f2c63ede3 | MATLAB | 275 | 22 | function[max_proj,sum_proj]=make_maxproj(red_wavelength_stack)
maxpocks=squeeze(max(red_wavelength_stack,[],1));
max_proj=squeeze(max(maxpocks,[],1));
min_proj=nan(512,512);
sumpocks=squeeze(sum(red_wavelength_stack,1));
sum_proj=squeeze(sum(sumpocks,1));
end
|
32e85c9642f0015a6f4705494f79f5eab896a464fe972479fb0c95f82f8ca789 | MATLAB | 276 | 16 | function [stars,posi]= getStars(p)
stars=''; posi=0;
if p<.1 && p>=.05
stars='(*)';
posi=.15;
elseif p<.05 && p>=.01
stars='*';
posi=.08;
elseif p<.01 && p>=.001
stars='**';
posi=.12;
elseif p<.001
stars='***';
posi=.15;
end |
397d203fe9772e7a741aa00f814300dff961e4bd3aee6731a1cfbca407a376ce | MATLAB | 276 | 12 | function check_successful()
delete(sprintf('dat/check_error.%s', getenv('network')));
data = 0;
OUT = fopen(sprintf('dat/check.%s', getenv('network')), 'w');
if OUT < 0, error('fopen'); end
fprintf(OUT, '1\n');
if fclose(OUT) < 0, error('fclose'); end
exit(0);
|
d1c24dd55520b4fdc0d3ba0c848cd38fd39ecadf39c848e5f9b6bde512440f42 | MATLAB | 276 | 8 | function [mutualInformation] = ml_alg_mutual_information_images(Ia, Ib)
% Ia and Ib must be discrete valued
Ea = ml_alg_entropy_image(Ia);
Eb = ml_alg_entropy_image(Ib);
Eab = ml_alg_joint_entropy_images(Ia, Ib);
mutualInformation = Ea + Eb - Eab;
end |
e0dd3a48e107dc775066fdda473a3cb86a9e919317e48915890cc497d010345b | MATLAB | 276 | 7 | % mglIsCursorVisible.m
%
% by: Christopher Broussard
% date: 02/15/11
% copyright: (c) 2007 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING)
% purpose: Returns whether or not the cursor is visible on any display.
% usage: mglIsCursorVisible |
eccbb7079e98e4b688dab10c75cbb091871da871bb0d07f28456ebacf7b4edfe | MATLAB | 276 | 10 | function [entropy] = ml_alg_entropy_image(I)
% Ia and Ib must be discrete valued
ind = double(I(:))+1;
hist = accumarray(ind, 1);
prob = hist ./ numel(ind);
indNoZero = hist ~= 0;
prob1DNoZero = prob(indNoZero);
entropy = -sum( prob1DNoZero .* log2( prob1DNoZero ) );
end |
b13b53e6a2fd7609da47c2199d0510b911c1f4b0727c5b7fc7459f380744e87a | MATLAB | 277 | 11 | function [labels] = get_label_nodes(file)
% This funtion gets the labels of each node from a txt file and puts them in a string matrix
cell_labels=importdata(file);
n_nodes=length(cell_labels);
labels=strings(1,n_nodes);
for i=1:n_nodes
labels(i)=cell_labels(i);
end
end
|
022457ae3435f1eb45b68d6cc88eeea2b1267a53773045e6615d8c3afb9aa31e | MATLAB | 278 | 5 | function las_SLM_func(f_mat,SC,fx,fy,interp_type)
%place f_mat on laser SLM, multiplied by phase ramp:
%exp(1i*2*pi*(fx*SC.gfx+fy*SC.gfy)), where SC.gfx/y are fourier plane grids.
%interp_type decided which interpolation goes from f_mat to the SLM (nearest neibour, linear,..)
|
9ad3ff4e0b71b71fc8b39f7f69451e16adf2d57537baa987b7f03a0243fdec81 | MATLAB | 278 | 12 | function [fim] = applyFilter(f,im)
% function [fim] = applyFilter(f,im)
%
% Apply a filter to an image with reflected boundary conditions.
%
% See also fbCreate, fbRun.
%
% David R. Martin <dmartin@eecs.berkeley.edu>
% March 2003
fim = fbRun({f},im);
fim = fim{1};
|
d65920476ec17171df2d91c7019167e8aafa3d9a4baa74e3ce31815cb8d6da7b | MATLAB | 278 | 17 | clear;
% Testing by numerical integral
k=35;
p=4;
f = @(x) VMFMeanDirDensity(x,k,p);
integral(f,-1,1) % Should be 1
k=100;
p=3;
f = @(x) VMFMeanDirDensity(x,k,p);
integral(f,-1,1) % Should be 1
k=700;
p=4;
f = @(x) VMFMeanDirDensity(x,k,p);
integral(f,-1,1) % Should be 1
|
01ee1b604bd73570cd7f3f6f311f23982c8beaed54f7371dc58b89956ce68e5b | MATLAB | 279 | 13 | % Script to compile C code for EEG-BEM
% Christophe Phillips
% $Id: make.m 8776 2013-11-14 09:04:48Z roboos $
mex -O bem_Cii_cog.c
mex -O bem_Cii_cst.c
mex -O bem_Cii_lin.c
mex -O bem_Cij_cog.c
mex -O bem_Cij_cst.c
mex -O bem_Cij_lin.c
mex -O bem_Gi_cog.c
mex -O bem_Gi_vert.c
|
313e79765b375c6a1b509a1e762f7f77ac20a8b1749f505acf57494162325362 | MATLAB | 279 | 10 | function [newCol] = convert_ms_to_s(oldCol)
% for ITIs stored in a cell array of strings, converts units from ms to s
nTrials = size(oldCol,1);
newCol = cell(size(oldCol));
for i = 1:nTrials
itiVal = str2double(oldCol{i});
newCol{i} = sprintf('%1.3f',itiVal/1000);
end
|
52dc67c89d19284113f1f93d53ee0be92b115f22976a9c045a3f92ef5261bdd8 | MATLAB | 279 | 20 |
function ret = rmse_latent(a1, a2, a3, U, X, V)
if ~size(v)
v= u;
end
sum = 0;
for i = 1 : size(a1,1)
pred = U(a1(i),:) * X * V(a2(i),:)';
sum = sum + (abs(pred - a3(i)))^2;
end
ret = sqrt(sum / size(a1,1));
if isnan(ret) | isinf(ret), error('***'); end
|
8cba95ea7f484309838e9df72375f53c740608ea1016f83e63163af6d92504db | MATLAB | 279 | 8 | function tip_force = tip_force(P, tips, xi)
%calculates the force pinning the tip
head_force = xi * (tips(1,:) - P(1,:));
tail_force = xi * (tips(2,:) - P(end,:));
tip_force = zeros(size(P));
tip_force(1,:) = head_force;
tip_force(end,:) = tail_force;
end |
e21d77f2f61bee84aa8ddcc0d45f98c41e6d8acd5f19fdf8c11d9bf2a8d333db | MATLAB | 280 | 6 | function cam_SLM_func(f_mat,SC,fx,fy,interp_type)
%place f_mat on camera SLM, multiplied by phase ramp:
%exp(1i*2*pi*(fx*SC.gfx+fy*SC.gfy)), where SC.gfx/y are fourier plane grids.
%interp_type decided which interpolation goes from f_mat to the SLM (nearest neibour, linear,..)
|
0ad828f050ce99944e318d63c0d857fa86537a543ffb74e2ef3fc86c101b355f | MATLAB | 281 | 9 | %just to save Plots and Figures in different formats
function save_plots(name_plot)
print(gcf, name_plot,'-dpdf')
print(gcf, name_plot,'-dpng')
savefig([name_plot,'.fig']) %saves figure as matlab file
% saveas(gcf,name_plot,'epsc') %saves figure as epc for Affinity
end |
0ffe32edd2392fc12ac1eb98846a8ae7bdb610b707d7eea64c66e264fc5021b2 | MATLAB | 281 | 8 | function ret=SONSetBuffering(fh, chan, bytes)
%SONSETBUFFERING specifies the buffer size for writing to a channel
%
% Author:Malcolm Lidierth
% Matlab SON library:
% Copyright © The Author & King's College London 2005-2006
ret=calllib('son32','SONSetBuffering', fh, chan, bytes); |
eb2012c1e49a1fe52160c19b24bc28ec32300b6a1ef83353a2a1c35f51be8871 | MATLAB | 281 | 7 | addpath(genpath('/N/u/brlife/git/vistasoft'))
addpath(genpath('/N/u/brlife/git/jsonlab'))
addpath(genpath('/N/u/brlife/git/encode'))
addpath(genpath('/N/u/brlife/git/spm'))
addpath(genpath('/N/u/brlife/git/wma_tools'))
mcc -m -R -nodisplay -d compiled classificationGenerator
exit
|
3e2b93bd4253422a617526739072bf257da001a9759681aaded96a265d7c84bd | MATLAB | 282 | 15 | function lab= convertLab(lab,nlab)
lab=char(lab)
for i=1:nlab
ilab=lab(i,:);
ind= strfind(ilab,'D_');
ilab(ind:ind+1)=[];
ilab(isspace(ilab))=[];
ilab(ilab=='_')=[ ];
ind= strfind(ilab,'resA');
ilab(ind:ind+3)=[];
labs{i}=ilab;
end
lab=labs; |
e5440e381732c9dc1843170921f7f4726dcaf8052c375c1d9bd24afe0101bec6 | MATLAB | 282 | 12 | function x = vl_isoctave()
% VL_ISOCTAVE Determines whether Octave is running
% X = VL_ISOCTAVE() returns TRUE if the script is running in the
% Octave environment (instead of MATLAB).
persistent y ;
if isempty(y)
y = exist('OCTAVE_VERSION','builtin') ~= 0 ;
end
x = y ;
|
0d83c0a500c9f61bfe50d193cceee30f9783c21c5d5c2bcc2c23f37ccc66bd4b | MATLAB | 284 | 11 | function l = length(x)
% Overloaded length function for file_array objects
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%
% $Id: length.m 8776 2013-11-14 09:04:48Z roboos $
l = max(size(x));
|
b0599a98f308bb14a793a064924bf600cae8b630c68ae0a572b818b84cf55400 | MATLAB | 284 | 11 | function [ theta, alpha ] = vec2ang( v )
% [ theta, alpha ] = vec2ang( v )
% Function to convert a vector to its azimuth and elevation angles
%
% Author: Wei Zhao, 04/20/2017
%%
theta = atan2d(v(:,2), v(:,1));
alpha = atan2d(v(:,3), sqrt(v(:,1).^2+v(:,2).^2));
end
|
72b2a2794fc54c4e30230e265444515175d4ca55231382ab7414b4e168afb0e8 | MATLAB | 285 | 13 | function [val] = optCheck(opts,fld,default,validSet)
%optCheck.m
if ~isfield(opts,fld)
val = default;
elseif isempty(validSet) || ismember(opts.(fld),validSet)
val = opts.(fld);
else
error('unrecognized value %s for field %s',string(opts.(fld)),fld)
end %if
end %fn
|
d80f61fe43b8082c0a952d0578908335ae93cd5beb0ec99dbdf83a5e2aac3836 | MATLAB | 285 | 7 | function ml_egomaps_draw_facing_direction(cx, cy, facingAngleDeg, RADIUS_CM)
% This is for drawing the heading line segment
tx = RADIUS_CM*sind(facingAngleDeg);
ty = -RADIUS_CM*cosd(facingAngleDeg);
plot([cx, cx+tx], [cy, cy+ty], 'g-', 'linewidth', 10)
end % function |
d81157d0ebc1853162908ee7d73eab39dc6a4373958be77cf93b07cff37c254f | MATLAB | 285 | 11 | function R=conc_and_detrend(wm, vent, WB, FR)
%% function R=conc_and_detrend(wm, vent, WB, FR)
%
% This function concatenate and detrend regressors. It adds derivatives to
% wm, vent and WB
%%
sR=[wm vent WB]; %simple regressors
dR=diff(sR);
dR=[0 0 0;dR];
R=[sR dR FR];
R=detrend(R); |
0356d9774339d8030d5464486ba5ab12eb57cc47b421076a1b4d5e0333c94bb0 | MATLAB | 286 | 16 | clear;
% Testing by numerical integral
k=35;
p=4;
f = @(x) WatsonMeanDirDensity(x,k,p);
integral(f,-1,1) % Should be 1
k=100;
p=3;
f = @(x) WatsonMeanDirDensity(x,k,p);
integral(f,-1,1) % Should be 1
k=700;
p=4;
f = @(x) WatsonMeanDirDensity(x,k,p);
integral(f,-1,1) % Should be 1
|
7faa2f695a3e4dc5b5c6cc2832fd3d205311aa8b77e8f27c931a103fae44aba8 | MATLAB | 286 | 14 | function tex_responses = compute_texton_response(im, tim)
if isempty(tim)
tex_responses = [];
return;
end
tex_responses = zeros(size(im, 1), size(im, 2), numel(tim));
fims = fbRun(tim, im);
for i = 1:length(fims)
tex_responses(:, :, i) = abs(fims{i});
end
|
a8c0a08e6870cf4b9857c527debcda551e2c52dcc98362903618885d9f6781d3 | MATLAB | 286 | 6 | function stdout = system_with_error_handling(command_line)
[return_code, stdout] = system(command_line) ;
if return_code ~= 0 ,
error('There was a problem running the command "%s". Return code: %d. Stdout/stderr:\n%s', command_line, return_code, stdout) ;
end
end
|
d78f4713bf15cbcffaf09094405caa549d3bf66ea09e5e1d890fc964d74437e7 | MATLAB | 286 | 15 | function my_save_image(one_img, one_file, be_quite)
if nargin<3
be_quite=false;
end
if ~be_quite
fprintf('save_image, file:%s\n', one_file);
end
tmp_dir=fileparts(one_file);
mkdir_notexist(tmp_dir);
imwrite(one_img, one_file);
end |
3e0d70fdd00eaeeef85bf1e74201a907459b04c17cac9153908fe18c97e4d832 | MATLAB | 287 | 6 | function [logfeat, normfeat] = feat_augment_log_and_norm()
% take log of the following features
logfeat = {'vel','ang_vel','min_wing_ang','max_wing_ang','fg_body_ratio'};
% normalize the following features
normfeat = {'mean_wing_length','axis_ratio','contrast'};
end
|
2a962b0baefcedb272cc6f625249b8cafc07b955710fb49a9d09ed692876cc64 | MATLAB | 288 | 8 | function ret=SONSetBuffering(fh, chan, bytes)
%SONSETBUFFERING specifies the buffer size for writing to a channel
%
% Author:Malcolm Lidierth
% Matlab SON library:
% Copyright © The Author & King's College London 2005-2006
ret=calllib('son32','SONSetBuffering', fh, chan, bytes); |
314141c4df0a04d77c70255d8aadeab1a48d2995cb97c90daf6420d49880cac0 | MATLAB | 288 | 14 | function drawErrorLine(x,y,error,facecolor,facealpha)
x = x(:)';
y = y(:)';
error = error(:)';
x1 = x;
x2 = fliplr(x);
y1 = y - error;
y2 = fliplr(y + error);
patch([x1 x2],[y1 y2],facecolor,'EdgeColor','none','FaceAlpha',facealpha);
hold on;
plot(x,y,'color',facecolor,'LineWidth',2); |
404096650b49d5f5cb69e462ac1aea6067c487936b2895b3a9ae5b857ed79ba6 | MATLAB | 289 | 13 | function drawPhotodiode(color, window)
global black white photoSquareSize
switch color
case 'black'
squareColor = black;
case 'white'
squareColor = white;
end
baseRect = [0 0 photoSquareSize photoSquareSize];
Screen('FillRect', window, squareColor, baseRect);
end |
802b6898dd2446bb08a8798765e59cb5662e02043f838e5e6d12cbe5820ef7f6 | MATLAB | 289 | 14 | function [refined]=refineMask(mask,zone)
refined=zeros(size(mask));
for ii=1+zone:size(mask,1)-zone
for jj=1+zone:size(mask,2)-zone
temp=mask(ii-zone:ii+zone,jj-zone:jj+zone);
if sum(temp(:))>(2*zone+1)^2*0.6
refined(ii,jj)=1;
end
end
end
end |
9568fe5bb04cee8f5697c61cb340947b91031929ed39d0eafce29522cee5f2ce | MATLAB | 289 | 13 | function delta = chi2delta(chi, D)
% delta = chi2delta(chi, D)
%
% susceptibiltiy to field change with dipoe kernel D
%% Author: Xu Li
% Affiliation: Radiology @ JHU
% Email address: xuli@mri.jhu.edu
%% convolution
chi_k = fftshift(fftn(chi));
delta = real(ifftn(ifftshift(chi_k.*D))); |
aa8f88c6a42e200c35be37c93a0f0149fad1fee98946f1b71c3d0c1a6475b51d | MATLAB | 289 | 13 | function [rateVector] = calculateMfrVector(s, label)
nTrials = length(s.trial);
rateVector = nan(1, nTrials);
for tr = 1:nTrials
idx = strcmp(s.trial(tr).label, label);
if ~any(idx)
rateVector(tr) = nan;
else
rateVector(tr) = s.trial(tr).mfr{idx};
end
end |
1d303afd4c2b21c1731a48d1a96d115817621f7cc20d20852589b8982d313626 | MATLAB | 290 | 15 | % bem5a_figure_scales
Emax = 50;
Emin = -50;
Eprimax = 50;
Eprimin = -50;
n_ELevels = 25;
%% Define dimensionless radius of the integration sphere (for precise integration near boundaries)
R = 2;
%% Define observation points in the cross-section (MsxMs observation points)
Ms = 500;
|
68f079770f3f06e7da3a937ee40f282806ec8596aed14102d0287b0cfdb0ed1a | MATLAB | 291 | 15 | % bem5a_figure_scales
Emax = 25;
Emin = -25;
Eprimax = 25;
Eprimin = -25;
n_ELevels = 20;
%% Define dimensionless radius of the integration sphere (for precise integration near boundaries)
R = 2;
%% Define observation points in the cross-section (MsxMs observation points)
Ms = 1000;
|
771b910557b3150c068f5825d1f510951590ccd1e5423b759cd68bb1a843c535 | MATLAB | 291 | 15 | % bem5a_figure_scales
Emax = 30;
Emin = -30;
Eprimax = 30;
Eprimin = -30;
n_ELevels = 30;
%% Define dimensionless radius of the integration sphere (for precise integration near boundaries)
R = 2;
%% Define observation points in the cross-section (MsxMs observation points)
Ms = 1000;
|
0d1f9df2fac83d86f7ebc0eace9fe8aa8ec24fe2ab0b4884afe8aa68238a514c | MATLAB | 292 | 15 | % bem5a_figure_scales
Emax = 25;
Emin = -25;
Eprimax = 25;
Eprimin = -25;
n_ELevels = 30;
%% Define dimensionless radius of the integration sphere (for precise integration near boundaries)
R = 10;
%% Define observation points in the cross-section (MsxMs observation points)
Ms = 1000;
|
047912f384e3cc1b6f12d8df8e536624c5e3caaa30818929f6a769546d58306d | MATLAB | 293 | 10 | %%
nrJobs = 1000;
progress = 0;
fprintf('Progress: %3.0f%%\n', 0);
while progress < nrJobs
progressInPercentage = 100*progress/nrJobs;
fprintf('\b\b\b\b\b%3.0f%%\n', progressInPercentage);
drawnow();
progress = progress + 1;
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.