sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
3ba622a387df97f1fda0e0d2a153dee7bed36394c07a07d3f7ce55a9330e8dfd | MATLAB | 227 | 19 | rng(0)
N = 100;
Ny = 15;
Nx = 12;
Nz = 10;
Nw = 10;
nP = 100;
Y = randn(N,Ny);
X = randn(N,Nx);
Z = randn(N,Nz);
%[pfwer,r,A,B,U,V] = permcca(Y,X,nP,Z);
[pfwer,r,A,B,U,V,pA,pB] = permloads(Y,X,nP,Z,[],[],true,false,10);
|
166a62987521056683fc05be2938c98c2f5c5ff8e5f64e25cf74343990f1ceec | MATLAB | 228 | 12 | function pfh = hsvPlaceF(pf,varargin)
if ~isempty(varargin)
m = varargin{1};
mn = m(1);
mx = m(2);
else
mn = min(pf(:));
mx = max(pf(:));
end
% pf = gausssmooth(pf,20);
pfh = 1-((pf-mn)/(1.5*(mx-mn))+0.333); |
3ffe7f3672c3cba0017ac88e8fe9a46b9f542cfbc8536cd2590045b209402b6a | MATLAB | 229 | 11 | function l = len(O)
% l = len(D) returns number of items in dictArray D
% copyright (c) 2004 Francesco P. Battaglia
% This software is released under the GNU GPL
% www.gnu.org/copyleft/gpl.html
l = length(O.keys);
|
4b8641bb3f7a453ab3a3527f454d5fdf26d2951545f5a4055e66fc9754e6da4f | MATLAB | 229 | 9 | function [H,B] = normCrossCorr(tx,ty,bins,nbBins,epoch)
mx = rate(tx,epoch);
my = rate(ty,epoch);
T = tot_length(epoch,'s');
[H,B] = CrossCorr(Range(tx),Range(ty),bins,nbBins);
H = mx*(H - my);
H = sqrt(bins/1000*T/(mx*my))*H;
|
914d12fccb0c1d79eee902e677f54b4e4ced549a41a8d71faab83b1bbdbdce2a | MATLAB | 230 | 13 | function [med] = mean_ignore_nans(vec)
% Calculate the mean of vector VEC, excluding NaNs
%
% [MED] = MEAN_IGNORE_NANS(VEC)
if ~isvector(vec)
error('VEC must be a vector');
end
vec = vec(find(~isnan(vec)));
med = mean(vec);
|
4696005fec25d4778851a278f1a52e07d8971901fe2d3775b07684fe33578499 | MATLAB | 231 | 10 | function rs = corrVecChop(a, b, clipids)
clips = unique(clipids);
nclip = length(clips);
rs = nan(nclip, 1);
clipids = clipids(:);
a = a(:);
b = b(:);
for i = 1:nclip
rs(i) = corr(a(clipids == i), b(clipids == i));
end |
a98a6648b09162ad91b38e4d0df16fdbbe7a7564c52a9d89594dfeb1f6642894 | MATLAB | 233 | 13 | function n = Name(tsa)
% Returns name propery of object
%
% USAGE:
% n = Name(tsa)
% copyright (c) 2004 Francesco P. Battaglia
% This software is released under the GNU GPL
% www.gnu.org/copyleft/gpl.html
n = tsa.name;
|
47076e44a2d54fe08a9de8ab147afc641f7b329a104c8839580184e14ffc9773 | MATLAB | 234 | 17 | function wf = GetWaveforms(filename)
wf = Make_MeanWaveF_FromDat(filename);
wf2 = wf;
for i = 1:length(wf)
wf{i} = double(wf{i});
end
SaveAnalysis(pwd,'MeanWaveforms',{wf},{'Waveforms'})
Make_WaveFormFeatures(wf)
|
f92053079e14bedb21eaefde942a11a84a9ab055cf8d2242a77755b0eb4b762a | MATLAB | 235 | 8 | function h_im = imagescWNans(varargin)
% sets NaN pixels to white by adding white to the colormap given
h_im = imagesc(varargin{:});
%%
cmap = colormap(gca);
new_cmap = [1 1 1; cmap];
colormap(gca, new_cmap)
end |
ab599ea1d087af8f7aab58681a5fa56eabb739917faf65961cfde97143b21427 | MATLAB | 236 | 10 | function [Thresh] = determineThresh(cfg, input)
if ~isfield(cfg, 'BetaThresh')
cfg.BetaThresh = 0.75;
else end
nThresh=round(size(input,2)*(1-cfg.BetaThresh));
sorted=sort(input(:,:), 2, 'descend');
Thresh = sorted(:,nThresh);
end |
1800d145dce0177f5e94132fc54b42d8494c5ae0870cea1d0471e922d4857221 | MATLAB | 238 | 12 | function [ Wnew ] = TransitionFields( W )
zeroindex = find(sum(W,2)==0);
W = W*length(W);
W = NE_dn(W,'ave');
w = sqrt(sum(abs(W))+eps);
W = W./repmat(w,length(W),1);
W = W*W';
Wnew = W;
Wnew(zeroindex,:) = 0;
Wnew(:,zeroindex) = 0;
end
|
31e09511da37e0e92490cfc39a46bbf6dcfe184a09279fd75b6723828f345fd1 | MATLAB | 239 | 6 | function id_of_remaining_states = getRemainingStateIds(temporal_evolution_of_states)
n_subjs = length(temporal_evolution_of_states);
for subj = 1:n_subjs
id_of_remaining_states{subj} = unique(temporal_evolution_of_states{subj});
end |
3a6dffaa77fe8ca018544b7d3263b8f6dec2dd2c13809f9af3ff085471221c3e | MATLAB | 239 | 17 | function trlen = lentrk(tr);
s = size(tr);
ndat = s(2)
[b,u] = unique(tr(:,ndat));
ntracks = length(u)
u = [0;u];
for i=2:ntracks
res(i-1,1) = tr(u(i),ndat-1) - tr(u(i-1)+1, ndat-1);
res(i-1,2) = tr(u(i),ndat);
end
trlen=res; |
74143fd019d9924bfd29ee4adc20a115d632c0e78b9b5623bc4c291baa87156c | MATLAB | 239 | 7 | function [outputArg1,outputArg2] = frame_coordinates(inputArg1,inputArg2)
%FRAME_COORDINATES ´Ë´¦ÏÔʾÓйش˺¯ÊýµÄÕªÒª
% ´Ë´¦ÏÔʾÏêϸ˵Ã÷
outputArg1 = inputArg1;
outputArg2 = inputArg2;
end
|
d8ade100bc209f2d0323b7bc347af093c15c88f3c2b5e01e60820cb9801e7ec7 | MATLAB | 239 | 11 | function q = quantity(O)
% q = quantity(O) returns the quantity string for the unit
% copyright (c) 2004 Francesco P. Battaglia
% This software is released under the GNU GPL
% www.gnu.org/copyleft/gpl.html
q = O.quantity;
|
cddc5e0a9159adb6249238d872fd0c37747628e3aeab84df101169e74693f422 | MATLAB | 240 | 10 | % zscore function
% October 24 2022
% Amirhossein Farzmahdi
function [output] = zscore(input,dim)
% input: matrix feature x images
% ouput: zscored input
std_ = std(input,[],dim);
mean_ = mean(input,dim);
output = (input - mean_) ./ std_;
|
d797bd7561da9d672051f5fd1c9c97f68c523f6835e1c6d4dba55c42d9b0c2af | MATLAB | 241 | 11 | % f
function [f, f1, f2, f3] = VMMix_f(x, mu, k, p1, p2, p3)
g = VMMix_g(x, mu, k);
g_pi = VMMix_g(x, mu + pi, k);
const = 1/2/pi;
z = sum(exp([p1, p2, p3]));
f1 = exp(p1)*g/z;
f2 = exp(p2)*g_pi/z;
f3 = exp(p3)*const/z;
f = f1 + f2 + f3;
end |
a39764d960f5f2a3324f54744339651781fb7b4354cd5a5e319532ed4bfb14e6 | MATLAB | 242 | 12 | function [meanDif ] = group_mean(data,n1)
%GROUP_MEAN ´Ë´¦ÏÔʾÓйش˺¯ÊýµÄÕªÒª
% ´Ë´¦ÏÔʾÏêϸ˵Ã÷
mean1 = mean(data(1:n1));
mean2 = mean(data(n1+1:end));
meanDif = mean1 - mean2;
end
|
a09df870e5ebe0b8f4cbf45ced10b0c445d393ae71da29a1a88551423a724aca | MATLAB | 243 | 12 | function C = cellArray(S)
% Returns the inner cell array of a tsdArray
%
% USAGE:
% C = cellArray(S)
% copyright (c) 2004 Francesco P. Battaglia
% This software is released under the GNU GPL
% www.gnu.org/copyleft/gpl.html
C = S.C; |
694c47e3e0c97cdb213212d33e80faff00a905951a1e61eb573f98e840fe481a | MATLAB | 246 | 9 | function MyPointer(name)
fname= ['/u12/antsiro/matlab/draft/' name '.map'];
if exist(fname,'file')
map = load(fname);
set(gcf,'PointerShapeCData',map);
set(gcf,'Pointer','custom');
else
fprintf('cursor %s doesnot exist',name);
end |
895854b4d3521866df2956c603190dcc20d99e86cf61f53ef554ea22fb8dde03 | MATLAB | 246 | 6 | function p = getProbeIniPath()
%Returns probe ini absulte path for usage by this function
currentFileFolder = [fileparts(mfilename('fullpath')) '\'];
p = awsModifyPathForCompetability(...
[currentFileFolder '\Probe - Olympus 10x.ini']); |
95e7b41c33285c204d273f00ddacae7c5543c38a988e0dd510c2fa8ca85aa5cb | MATLAB | 246 | 12 | nStates = size(Lm,2);
alphaa = 1;
alphapi = 1;
ua = ones(1,s)*(alphaa/s);
upi = ones(1,s)*(alphapi/s);
FPI=0;
for state = 1:nStates,
FPI = FPI - kldirichlet(Wa(state,:),ua);
end;
Fpi = - kldirichlet(Wpi,upi);
lowerBoundHMMparams = FPI + Fpi; |
fb5fd4d3d7cbcc10b3758bdb4ef3a51adf1df565044c51eefce922fb7e524fb1 | MATLAB | 246 | 6 | function dircoords=dirprojectcoords(anterdir,dorsaldir,leftdir,midpoint,coords)
dircoords(1)=dirproject(anterdir,midpoint,coords);
dircoords(2)=dirproject(dorsaldir,midpoint,coords);
dircoords(3)=dirproject(leftdir,midpoint,coords);
|
16afb7729151719bfa72d9a3e4ca8e92f7420fff9f9e02d26117872776b5e0c6 | MATLAB | 247 | 8 | function [vcondition]=load_condition_InfoCapON_tbi(trial,cond)
for i=1:trial
load(sprintf('Wtrials_%03d_%d_err_hete_ON_tbi.mat',i,cond));
vcondition.infocap_all(i,:)=infocapacity;
vcondition.suscep_all(i,:)=susceptibility;
end |
3160dda7e544d743331efa39994273cc352ea2c6bebcb7c981ee733fbc257c1f | MATLAB | 247 | 4 | function [fractional_occupancy, mean_life] = compute_occupancy_and_mean_life_group_wise(temporal_evolution_of_states, max_nstates)
[fractional_occupancy, mean_life,~] = summary_stats_fast(cell2mat(temporal_evolution_of_states), 1:max_nstates);
|
b1b3faae1947c65ed24929e8e92eea5ac4bbc34acc09006081c34ca959def721 | MATLAB | 247 | 7 | function [vcondition]=load_condition_InfoCapON_hc_tp1(trial,cond)
for i=1:trial
load(sprintf('Wtrials_%03d_%d_err_hete_ON_hc.mat',i,cond));
vcondition.infocap_all(i,:)=infocapacity;
vcondition.suscep_all(i,:)=susceptibility;
end |
95f7d5a54b832a75bb89a84a3c7812a62ecba440a416944020ae26b5f9c1da52 | MATLAB | 248 | 7 | %Orders flicker conditions in increasing frequency order.
function conditions=order_flicker_conditions(conditions)
temp=arrayfun(@(x) str2double(regexprep(x,'Hz.+','')),conditions);
[~,temp]=sort(temp);
conditions=conditions(temp);
end |
aa32ed26c879bd1e0987a0aa344a44e1fb620ccc4e9c73070abafc0e0b47576d | MATLAB | 248 | 9 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function bq = bq(v)
bq = 0.94 * exp((-75-v)/17);
end |
d6d46e2175c21c6ecc72e06bd5d85d6ea12934a2482b8de79c1eb5acb283fb74 | MATLAB | 248 | 5 | function name = key2name(key)
keys = ['a','z','e','r','s','d','f','v','g','h','t'];
events_names = {'Basal','door_eat','go_eat','eat','door_run','go_run','w_on','w_on2','w_off','w_blk','plt1'};
name = events_names{keys==char(key)};
end
|
dcfda48133cc0d2372d59f1afcbfdafa02cad70f8eb20d865f408e1d27f83214 | MATLAB | 249 | 19 |
function cut=kreis(r,xdim,ydim,midy,midx)
cut=zeros(xdim,ydim);
for i = 1:xdim
for j = 1:ydim
x=i-xdim/2-midx; y=j-ydim/2-midy;
%disk
if((x^2+y^2)<r^2)
cut(i,j)=cut(i,j)+1;
end
end
end
end
|
de3f397dbc50bc858a434afe53040364e906121382e6aae8e2372068c812c96d | MATLAB | 249 | 14 | function l = get_lookup()
ltime = dictArray({ { 'ts', 1},
{ 'ms', 0.001},
{ 's', 1},
{ 'min', 60},
{ 'h', 3600} });
ptime = dictArray({ { 'none', 1 } });
l = dictArray({ { 'time', ltime},
{ 'none', ptime} });
|
3bec28e117b5b829d82dba771b5b1a39ac8ae896fe6bbd050b35524803b8e4af | MATLAB | 251 | 7 | function [vcondition]=load_condition_InfoCapON_hc_tp2(trial,cond)
for i=1:trial
load(sprintf('Wtrials_%03d_%d_err_hete_ON_hc_tp2.mat',i,cond));
vcondition.infocap_all(i,:)=infocapacity;
vcondition.suscep_all(i,:)=susceptibility;
end |
cbdf7088111762634dd2e79e497fa6d84f97ec611cd1a6720d93557f3d130ae8 | MATLAB | 251 | 9 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function Vtraub= v2(V, VTraub)
Vtraub = V - VTraub;
end |
00d81ef6aba897b54f58cc022c62302687aa8d8e70e1ac0199b294c4fa914a7a | MATLAB | 252 | 8 | function beta=exponentialfit_ap(t,y,beta0)
% beta=exponentialfit_ap(t,y,beta0)
% fit to exponential function by calling nlinfit with exponential_ap
% where f = beta(1)*exp(beta(2)*x) + beta(3);
beta=nlinfit(t,y,'doubleexponential_ap',beta0);
|
2d0a250bb53f90c93d23411d8b9de8564bdb9f8bcbb540b6d7a64ae1bcb64d67 | MATLAB | 252 | 9 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function ar = ar(v)
ar = 0.000457 * exp((-13-v)/50);
end |
3dad6b63570eca77a4b12bed6741cca078492e3e374a2bcb3e3ea250c184d36b | MATLAB | 252 | 9 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function tau_r = tau_r(v)
tau_r = 1/(ar(v)+br(v));
end |
5fedb8187b25e243157b86ec93263942492f72d2231d01116b6ca39cb5a34687 | MATLAB | 252 | 11 | function [a, r] = fitcubic(x, y)
% fit a cubic with only a non-zero 3d and 1st power (because its symmetry
% axis should be the y-axis, and it should go through [0, 0]
X = [x(:) x(:).^3];
a = pinv(X)*y;
yhat = X*a;
r = sum((y-yhat).^2)./sum(y.^2);
|
b523d1349d92c658437e8e3585fadb4d6fe93cf0ea5ee409e8cc3f5291598a9a | MATLAB | 252 | 9 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function x = Euler(dx, xpre, Dt)
x = xpre + dx * Dt;
end |
c0df50e04cb711a6968cd5862902dc5efdd8b6d51e832396f5c259f99a761737 | MATLAB | 252 | 9 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function tau_q = tau_q(v)
tau_q = 1/(aq(v)+bq(v));
end |
db8be96d6656da7265477bc1082a525a5e1717ead850ede0bfaa79e0758cfdc1 | MATLAB | 252 | 9 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function br = br(v)
br = 0.0065/(exp((-15-v)/28)+1);
end |
85c3b1e3bd353127ec19cb4994a9c1ecccc8a6ae47b5f1b9fe529b1d9fc62f84 | MATLAB | 254 | 12 | % trials is channels x time x trials
function trials = offsetTrials(trials,zeroT)
% Offset
for i1 = 1:size(trials,1)
for i2 = 1:size(trials,3)
offset = trials(i1,zeroT,i2);
trials(i1,:,i2) = trials(i1,:,i2) - offset;
end
end
end |
8d58291ee2fc969843d4b2402a3ee3cc264c1e1fb4ad64dbeade162df41a565a | MATLAB | 254 | 18 | function [x] = sample(vec,n)
% [X] = SAMPLE(VEC,N)
%
% Pick N values (X) at random from a vector VEC.
%
% N defaults to 1 if not provided.
%
% If N==0, N is set to 1.
if ~exist('n','var'), n=1; end
if ~n, n=1; end
vec = shuffle(vec);
x = vec(1:n);
|
a91773b03f335c042d11b6b311bd9008b1fc9e136a164a0024f7d55d036369d0 | MATLAB | 254 | 10 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function dM = dM( Vpre, M )
dM = 5*(Minf(Vpre) - M);
end
|
ae1759c253b5d8eaf8ae6128bf36f412f98157f593b71eda594c8455f3b0033b | MATLAB | 254 | 8 | function edges = bins2edges(bins)
% gets bin centers from edges vector
edges = zeros(1, length(bins)+1);
edges(2:end-1) = (bins(1:end-1) + bins(2:end))/2;
edges(1) = bins(1) - 0.5*(bins(2)-bins(1));
edges(end) = bins(end) + 0.5*(bins(end)-bins(end-1)); |
6fe51e0580c93459d3bae5b9f35193a121a2dcafa1e3b1b7c71886080a22fafe | MATLAB | 255 | 7 | function [gx] = g_fictious(x,P,u,in)
game = in.game; % game's payoff table
player = in.player; % agent's role
Po = VBA_sigmoid(x(1)); % P(o=1)
DV = fplayer(Po,exp(P(1)),player,game); % incentive for a=1
gx = VBA_sigmoid(DV+P(2)); % P(a=1) with bias |
2017f39ded45ff2185a42a2b0316663c1f9a4b82491e3ba0072a1748a23ba8e2 | MATLAB | 256 | 17 | function [C_z]=creaC_z(N,alfa,beta)
n=N-alfa;
t=exp(-beta*[1:n]);
t=fliplr(t);
for i=1:n;
B(i,i:n)=[(t(i).^2)/2].*(t(i:n)-t(i)/3);
B(i:n,i)=B(i,i:n)';
end
B=rot90(B);B=rot90(B);
A=(1e-12)*eye(alfa);
C_z=[A zeros(alfa,N-alfa);zeros(n,alfa) B]; |
75cf5751b6d1ca8197356007897ade228c9759e1a2f537b665a3f102ddf11a6b | MATLAB | 256 | 13 | function s = unit_string(O)
% s = unit_string(O) provides the string with the abbreviation for the unit
%
% copyright (c) 2004 Francesco P. Battaglia
% This software is released under the GNU GPL
% www.gnu.org/copyleft/gpl.html
s = O.unit;
|
a888b919bbba98d14b7076c42c9405c43a6d117c41d8744e697be59a30bc34ee | MATLAB | 256 | 9 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function q_inf = q_inf(v)
q_inf = aq(v)/(aq(v)+bq(v));
end |
c2410d9022468852434facbb4eee95b25a153f6f964eb20a5c2910c641e84e33 | MATLAB | 256 | 9 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function r_inf = r_inf(v)
r_inf = ar(v)/(ar(v)+br(v));
end |
cd16354c14fb25c3a3e24c9d90173265f0b0d2af32540a30f92ff49374f23b49 | MATLAB | 256 | 13 | lv = length(varargin);
i = 1;
done = 0;
while ~done
cs = ['%' num2str(i)];
vs = ['varargin{' num2str(i) '}'];
if isempty(findstr(cmd_string, cs))
done = 1;
break;
end
cmd_string = substr(cmd_string, cs, vs);
end |
f9482a2f2ca62c728960434db8fa4ae8ff7cae5455fb57013c70aafd46b42c7f | MATLAB | 256 | 9 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function dM = dMV2( Vpre, M )
dM = 5*(MinfV2(Vpre) - M);
end |
d11ba6e0f2e126861f6342cf6c2e84341ef57e0ed841953f55474e575b06e18e | MATLAB | 257 | 13 | function l = length(O)
% l = length(D) returns number of items in dictArray D
%
% just another name for len
% copyright (c) 2004 Francesco P. Battaglia
% This software is released under the GNU GPL
% www.gnu.org/copyleft/gpl.html
l = len(O);
|
3f0d45f24893d0b25ea613553e86a2c46830dca59cd934c89407f9cb70d87ee1 | MATLAB | 258 | 18 | % FileLength(FileName)
%
% Returns the length of the file in bytes
% If the file is not there, returns -1.
function n = FileLength(FileName);
fp = fopen(FileName, 'r');
if (fp == -1)
n = -1;
return;
end;
fseek(fp, 0, 'eof');
n = ftell(fp);
fclose(fp); |
cc011687644fbcda9c1110226dcc30c50638639032e968ad8d459041d9c03e3c | MATLAB | 258 | 9 | % List of open inputs
nrun = X; % enter the number of runs here
jobfile = {'D:\home\Data\4AshO\phantom_images_job.m'};
jobs = repmat(jobfile, 1, nrun);
inputs = cell(0, nrun);
for crun = 1:nrun
end
spm('defaults', 'EEG');
spm_jobman('run', jobs, inputs{:});
|
e7118b0fd6fcf41ef33044a11438d44891a3a4deb8cf1d18c1d90d9963e544d3 | MATLAB | 258 | 10 | function im_pd = imPadToMeetPatchSize (im, minPatchSizeX, minPatchSizeY, padValue)
h=size(im,1);
w=size(im,2);
im_pd = ones(...
max(h,minPatchSizeY+1),...
max(w,minPatchSizeX+1),...
size(im,3),'uint8')*padValue;
im_pd(1:h,1:w,:) = im; |
9d6e12d9ec0898ece69827ba311c97ae07872b55b370b07147d6c2185f1a093f | MATLAB | 259 | 7 | % minFunc
fprintf('Compiling minFunc files...\n');
mex -outdir minFunc/compiled minFunc/mex/mcholC.c
mex -outdir minFunc/compiled minFunc/mex/lbfgsC.c
mex -outdir minFunc/compiled minFunc/mex/lbfgsAddC.c
mex -outdir minFunc/compiled minFunc/mex/lbfgsProdC.c
|
f07ad5509f0e76bf9261335062d771b8b97787386babb637eabe24e20843b0e1 | MATLAB | 259 | 9 | function y=multi_imshow(A)
% imshow 2D multi XY image, A=[X,Y,index], multi_imshow(A,scale)
A=squeeze(A);
sz = size(A);
for idx=1:sz(end)
figure(77); imagesc(A(:,:,idx)); colormap gray; title([num2str(idx) '/' num2str(sz(end))]);
pause
end
end |
100c7d0c9c9ee258cc10ae87b0d754d9ba2015074261223d32745e08b7c28ea4 | MATLAB | 260 | 8 | function varargout = write_image_spm5(varargin)
% write_image:
% inputs: header, volume (X x Y x Z)
% output: written header (normally not needed)
varargin{1}.dt(1) = 16; % set datatype to int16
varargout{1} = spm_write_vol(varargin{:}); |
8ef3fe08cb2e2e10c71233368d889844fc66555376ee33a3695356b279790aa3 | MATLAB | 260 | 8 | function varargout = write_image_spm8(varargin)
% write_image:
% inputs: header, volume (X x Y x Z)
% output: written header (normally not needed)
varargin{1}.dt(1) = 16; % set datatype to int16
varargout{1} = spm_write_vol(varargin{:}); |
074d6abf6888f6b39118d8231d3cd8b0484210f0595aeac670b27cc41cabb88a | MATLAB | 261 | 12 | %%% 4-10-11:
% function [] = setpospap(pos)
% Sets position to vector pos and paperpositionmode to auto
function [] = setpospap(pos)
if ~exist('pos','var')
pos = get(gcf,'position');
end
set(gcf,'paperPositionMode','auto','position',pos);
end |
08d6b21b6c2af7963e2bca75529cf7a6a8a98e44ee2bc87aabaa53895d3538c1 | MATLAB | 261 | 8 | function varargout = write_image_spm8b(varargin)
% write_image:
% inputs: header, volume (X x Y x Z)
% output: written header (normally not needed)
varargin{1}.dt(1) = 16; % set datatype to int16
varargout{1} = spm_write_vol(varargin{:}); |
b3941b8ee9bfe6e822cc189dd994dbeede149bb4652e871d27a7d98b87a8f708 | MATLAB | 261 | 8 | function varargout = write_image_spm12(varargin)
% write_image:
% inputs: header, volume (X x Y x Z)
% output: written header (normally not needed)
varargin{1}.dt(1) = 16; % set datatype to int16
varargout{1} = spm_write_vol(varargin{:}); |
8c47e875f5badf9c2accc214e0aa316a382b77933de1b17dca5ce9bc225f5da8 | MATLAB | 262 | 17 | %% Draw moving trajectory
x_r = traj1.x1;
y_r = traj1.y1;
% x_r = traj1.xraw;
% y_r = traj1.yraw;
% figure
xlim([-50 50])
ylim([-50 50])
axis ij
h = animatedline;
for ii= fms1;
addpoints(h,x_r(ii),y_r(ii));
drawnow % limitrate
end
|
bed45cd207833e84177936e885d8fd6b05fdb57b56b7b5dd8c1da2e6d3e20421 | MATLAB | 262 | 8 | function varargout = write_image_spm12b(varargin)
% write_image:
% inputs: header, volume (X x Y x Z)
% output: written header (normally not needed)
varargin{1}.dt(1) = 16; % set datatype to int16
varargout{1} = spm_write_vol(varargin{:}); |
42e29149e7c6f46c4ef2a773154b43427f3657f5bccd05a2e8b16966e44336ab | MATLAB | 263 | 14 | function s = or(a, b)
% Union of two intervalSet's (overload of the | operator)
%
% USAGE
% s = and(a, b)
% copyright (c) 2004 Francesco P. Battaglia
% This software is released under the GNU GPL
% www.gnu.org/copyleft/gpl.html
s = union(a, b);
|
82d6ebea9d52157c613dd6c3de9349df88b18aca1d2b71fbaa79b660380f20eb | MATLAB | 263 | 9 | function varargout = write_image_spm2(varargin)
% write_image:
% inputs: header, volume (X x Y x Z)
% output: written header (normally not needed)
varargin{1}.dim(4) = 16; % set datatype to int16
varargout{1} = spm_write_vol(varargin{:}); |
6cac68c3a39aa4d2f9598af28c5cfdce9e373203b749ce193d29e9500603a51b | MATLAB | 264 | 18 | function val = get(O,prop_name)
% GET Get intervalSet properties from the specified object
% and return the value
% batta 2001
% starting version
switch prop_name
case 'start'
val = O.start;
case 'stop'
val = O.stop;
case 'units';
val = O.units;
end
|
eefea4f1a358c166ddf8343b4654e4ddff89174c77359b734fdcf6654b81fa7e | MATLAB | 265 | 8 |
for i = 1:length(unassignedTracks)
ind = unassignedTracks(i);
tracks(ind).age = tracks(ind).age + 1;
tracks(ind).consecutiveInvisibleCount = ...
tracks(ind).consecutiveInvisibleCount + 1;
end
|
300f30ba2a0a589383c906595f34aaf608a80ba55353834892f8c60e98b5d4dc | MATLAB | 266 | 7 | function [t_tr, iso_tr, physio_tr] = left_trim_signals(t, iso, physio, duration_sec)
sfreq = 1/median(diff(t));
trim_size = floor(duration_sec * sfreq);
t_tr = t(trim_size:end);
iso_tr = iso(trim_size:end);
physio_tr = physio(trim_size:end);
end |
45c35875cbc83765047ab85ddd52188515fae9f80b5a8ac1488f39bbf0b4c8bb | MATLAB | 266 | 16 |
inferQtheta;
inferQnu;
XmState_old = XmState;
Ybar_old = Ybar;
inferAR3;
inferQX;
inferQL;
inferpsii2;
infermcl;
computeLogOutProbs;
[loglik,QnsCell,Qnss] = vbhmmEstep(Ycell,stran', sprior,logOutProbs);
Qns = [];
for ns=1:nSubjs
Qns = [Qns; QnsCell{ns}];
end |
7b32b84a6669cc7a0b3f95921425e288f2b40c2ee59a19c6f3f277852f343cb0 | MATLAB | 266 | 9 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function am = am(V, VTraub)
am = 0.32*vtrap((13-v2(V, VTraub)),4);
end |
010c5992da4f5bd80ed81258c520c9dda3cf7fa9b74c59ce51a90001addb8c8a | MATLAB | 267 | 15 | function k = keys(O);
% dictArray/keys K = keys(D) returns keys of dictArray D
%
% k is a cell array of key strings
% copyright (c) 2004 Francesco P. Battaglia
% This software is released under the GNU GPL
% www.gnu.org/copyleft/gpl.html
k = O.keys;
|
d5376808a58c2437ec1b6c871eadb6058b00600a967deea199ae28de5a7017eb | MATLAB | 267 | 9 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function bh = bh(v, VTraub)
bh = 4/(1+exp_t((40-v2(v, VTraub))/5));
end |
3d118a160702fbfdd052e3eed2ccd4677395663b3a3eefe4d50ca998eb24a6fe | MATLAB | 268 | 15 | function O = setName(tsa, name)
% Set name property of object
%
% USAGE:
% O = setName(tsa, name)
% copyright (c) 2004 Francesco P. Battaglia
% This software is released under the GNU GPL
% www.gnu.org/copyleft/gpl.html
O = tsa;
O.name = name;
|
5b158fb914980bdc2ee470e67ebc5dadac91a684b9cc68993305bdcab87bbd9b | MATLAB | 268 | 18 | function [success errmsg] = test_compare_size()
success = 1;
errmsg = '';
a = rand(10);
if ~compare_size(a,a)
success = 0;
errmsg = 'Something basic wrong';
end
b = rand([10 5]);
if compare_size(b,b')
success = 0;
errmsg = 'Problem with transposing';
end
|
c00ea189bd755a2fef2af1f251592f8a09e0aca9d0ac2362a947dab8bc711b8f | MATLAB | 268 | 9 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function ah = ah(v, VTraub)
ah = 0.128*exp_t((17-v2(v, VTraub))/18);
end |
1ce4e73bd36d186dc77e41a8129b0697c467cc9c49cb42e01db8259ac57ab149 | MATLAB | 269 | 11 | function beta=atanfit_ap(t,y,beta0)
% beta=exponentialfit_ap(t,y,beta0)
% fit to exponential function by calling nlinfit with exponential_ap
% where f = beta(1)*exp(beta(2)*x);
try
beta=nlinfit(t,y,'atan_ap',beta0);
catch
keyboard
beta = [NaN NaN];
end
|
333c56ed574e3207f08e875889eb036e7a1e9537fa3c2931b285fb28071afbb6 | MATLAB | 269 | 19 |
function T=Triangle(r,xdim,ydim,midy,midx)
T=zeros(xdim,ydim);
for i = 1:xdim
for j = 1:ydim
x=i-xdim/2-midx; y=j-ydim/2-midy;
R=sqrt((x^2+y^2));
%disk
if((x^2+y^2)<r^2)
T(i,j)=1-R/r;
end
end
end
end
|
ca596180580ff551d0cdcafe7b92b9e199426a6863307e3772471386f93e631f | MATLAB | 270 | 15 | classdef ClassifierModel
methods (Abstract)
train(mdl,X,y)
predict(mdl,X,y)
end
methods
function accuracy = evaluate(mdl,X,y)
preds = mdl.predict(X);
accuracy = mean((preds==y'));
end
end
end |
14b17c141d609ac8af8f19454786a7ef2f342aecfb511f170ec2d270e1c58217 | MATLAB | 271 | 12 | function hk = has_key(O, k)
% hk = has_key(D, k) returns 1 if key k is present in D, 0 otherwise
% copyright (c) 2004 Francesco P. Battaglia
% This software is released under the GNU GPL
% www.gnu.org/copyleft/gpl.html
ix = key2idx(O, k);
hk = ix > 0;
|
749aa3f835ebb1e148c72856e7e69567f27f6f0c317f24ab89532ccfd5db4b4d | MATLAB | 271 | 12 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function y = dP( I_Ca, P )
B = 10;
y = I_Ca - (B * P);
end
|
7be29db062f39913c93ed08b10a70dbaff6871352bad7d3d2db27975231200eb | MATLAB | 271 | 10 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function y = A_inf( V_pre )
y = (10^-10)/(1+exp(-100*(V_pre+0.02))) ;
end
|
99764a769188e7a3d609059443281b2002e744a4bc77e081a4e0bbbd6ab9ef64 | MATLAB | 271 | 12 | function l = length(S)
% Returns number of item in the tsdArray (overload of length function)
%
% USAGE:
% l = length(S)
% copyright (c) 2004 Francesco P. Battaglia
% This software is released under the GNU GPL
% www.gnu.org/copyleft/gpl.html
l = length(S.C); |
aa863d58d45a5d30b974aeb08b2c9c6ab6d4bdc9ad5ef675c0749e5ef41f9c8f | MATLAB | 271 | 8 | function [vcondition]=load_condition_InfoCapON_tbi_mask2SD_bin(trial,cond)
for i=1:trial
load(sprintf('Wtrials_%03d_%d_err_hete_ON_tbi_mask2SD_bin.mat',i,cond));
vcondition.infocap_all(i,:)=infocapacity;
vcondition.suscep_all(i,:)=susceptibility;
end |
b89e431427bd944ad001b1b0770a673e5cc76bd34b83afe2ee2cd19e6af8c095 | MATLAB | 271 | 7 | function save_step1(step1)
if isfield(step1.raw_signals,'digSig3_on_idx')
step1.dio3.raising_times = step1.raw_signals.time(step1.raw_signals.digSig3_on_idx);
end
step1.raw_signals = [];
save([step1.figure.folder filesep step1.figure.prefix '_step1.mat'],'step1');
end |
da9a1365c24b92e5cee637fb3f9eb274f82befdbc2e7d10cdde87a9464b91f1d | MATLAB | 271 | 6 | function f=doubleexponential_ap(params,x)
% f=doubleexponential_ap(params,x)
% f=params(1)*exp(params(2)*x)+params(3) + params(4)*exp(params(5)*x);
%f=params(1)*exp(params(2)*x) + params(3)*exp(params(4)*(x-params(5)));
f = params(1)*(x+0.01).^-1-params(2)*(x+0.01).^-2; |
16a582de61be357867b61d704b13fb8c584ee53e54938e20bf341d025379cd98 | MATLAB | 272 | 10 | % function ind = uniqueqs(x)
%
% Provides unique numbers sorted in the order of appearance, not ascending.
% For ascending sorting or when data is sorted, use uniqueq.
function ind = uniqueqs(x)
x = x(:);
[xs,v] = sort(x);
ind = x(sort(v([true; diff(xs)>0]))); |
478210297b7531462d98308923676f919fdf2bd1ae60c38ad14601c956f9c5ea | MATLAB | 272 | 9 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function finf = Funcinf(a, b, V)
finf = 1./( 1 + exp(a.*( V + b )) );
end |
9a8b54da2eb9c467855495d6bbedd36a56c012d9faf5619848c02ac5598c0ecd | MATLAB | 272 | 14 | function wn=dn(w,type);
w = w*length(w);
w = double(w);
D=sum(abs(w),2)+eps;
if type == 'ave'
D=1./D;
D=sparse(1:length(D),1:length(D),D);
wn=D*w;
elseif type == 'gph'
D=1./sqrt(D);
D=sparse(1:length(D),1:length(D),D);
wn=D*(w*D);
end |
9af0b9152ed06aa5f8395b1dd2e003a4a2cd0e4d338e05ddd526dede77babdca | MATLAB | 272 | 9 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function Minf = MinfV2(Vpre)
Minf = 0.4499*tanh(0.5*Vpre + 20) + 0.5499;
end |
b04d214fa7f74514661c08cd93a861f1ce18acedd3fa5f67eca9117fa9918329 | MATLAB | 273 | 10 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function y = dA( Vpresyn, Aprev )
y = ( A_inf(Vpresyn) - Aprev ) / 0.2;
end
|
349355bf49367066362227bf84acb53d363558e90c76d6716dccdcb484969908 | MATLAB | 274 | 9 | function niiFile = select_nii_anat(cfg, subject, prefix)
%SELECT_NII_ANAT Get the filename of the anatomical T1w image
% Detailed explanation goes here
niiFile = fullfile(cfg.sub(subject).anat_dir, strcat(prefix, ...
cfg.sub(subject).anat_fn));
end
|
4a148dac69c2823c89d5c738de6ac3a832416c5b5cb04791ff3cead5fa75a305 | MATLAB | 274 | 14 | function F = FischerInfo(h,B)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
db = median(diff(B));
F = 0;
for ii=1:length(h)
f = (((diff(h{ii}).^2)./h{ii}(1:end-1)));
f(isnan(f) | isinf(f))=0;
F = F+f;
end
F = F/length(h);
end
|
d6f95680bf04e5c56f74fd635a3e7d99d77867a6a407aa853e45f9b1f4ed1595 | MATLAB | 275 | 13 | function v = values(O)
% dictArray/values v = values(D) returns cell array of values in dictArray D
%
% v = is a cell array
% copyright (c) 2004 Francesco P. Battaglia
% This software is released under the GNU GPL
% www.gnu.org/copyleft/gpl.html
v = O.values;
|
12e2aaea70a3b97700b5af2e07716429addfe35f62aa26aa2fd61c46587141af | MATLAB | 276 | 15 | function A=readmovfile(fid)
% LOADTRIAL: loads a new trial from mov-file
% Synopsis
% A=readmovfile(fid)
A=[];
line=fgetl(fid);
while line(1)~='T' & line(1)~='t' & ~feof(fid)
a=sscanf(line,'%f');
A=[A;a'];
line=fgetl(fid);
end;
if (feof(fid))
fclose(fid);
end; |
1923111e32ea67fd23d57f1625b0d636c1a34acc057d0fd02aaed6eb65168f0a | MATLAB | 276 | 9 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function betam = betam(v, VTraub)
betam = 0.28*vtrap((v2(v, VTraub)-40), 5);
end |
32876c33007843d74e70e30e4a090daab70bf87c45c7fed45e9533abe628bbc6 | MATLAB | 276 | 12 | function col = mycolors(var,n)
switch var
case 'Mf'
col = [1,0,0;...
0,.6,0;...
0,0,1;...
.7,0,.7];
case 'Md'
col = lines(7);
col = col([3,2,5,1,7],:);
end
end |
38f1300af6725688e0ae2ec38ce995304fc4ce81506183a85be961e06ac7f18d | MATLAB | 276 | 9 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function tau_h = tau_h(v, VTraub)
tau_h = 1/(ah(v, VTraub) + bh(v, VTraub));
end |
3e405de29f41945edb913e8e378565d0b46fe5d16ff9fb66174c5b60a1079ebd | MATLAB | 276 | 15 | function [sem] = trimsem(x, percent, dim)
%type something here
if nargin<3
dim = find(size(x)>1, 1, 'first');
end
if nargin<2 || isempty(percent)
percent = 0.2;
end
n = size(x, dim);
sigma = winvar(x, percent, dim);
sem = sqrt(sigma)./((1-2*percent) * sqrt(n));
|
bd17705ca42772cf065e806b73fda347eb5a7a499012a3e6ffdfe65f97371dc5 | MATLAB | 276 | 10 | % @author Farad Khoyratee
% @date 16 Apr 2019
% @copyright
% SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com>
% SPDX-License-Identifier: GPL-3.0-or-later
function u_inf = u_inf(v)
vx = 7;
u_inf = 1/(1+exp((v+vx+81)/4));
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.