sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
b5e6ecc0ba4de3d56b8236de4f52269b148c91876fc3fc03278d0e85f81735fa
MATLAB
107
5
% showtimes plot(nor1(MALAB_used_mem),'r'); hold on; plot(nor1(Tload1),'g'); plot(nor1(Tcorr1),'b');
ea2a536683f9546ca8ac2a1a2e163c54f8b708e7fc1e96daa9bf1601df96fdd5
MATLAB
107
7
function [g] = cellgte(c,t) %cellgte.m %3/14/21 g = cellfun(@(x) x >= t, c,'UniformOutput',false); end
5db032aabedc7694133ede6f3671086088f6fd60f48298e4c3f73fe88a7c5caa
MATLAB
111
7
function [s] = cellsum(c,dim) %cellsum.m %3/13/21 s = cellfun(@(x) sum(x,dim),c,'UniformOutput',false); end
956d9864fd72d01cc8a9419565cfa8f6de9de7b085d2a09e80a95744a083971f
MATLAB
111
6
% try sytem calls img = screencapture(0, 'Position', [1285 0 1900 1023]); figure(80) image(img); savefig(
9e8ed71285de4b3a864a8d1731b222b28f34bc3261b5f5b9c9dbea2ee88f136f
MATLAB
111
6
function [newX, scaleFact] = scaleFunc(X) scaleFact = prctile(abs(X(:)),95); newX = X ./ scaleFact; end
e524755570b1cb606ee8eb0766bce404a2a7dcb02044529fe4994447e22f88bc
MATLAB
111
9
function [T] = tagFirst(V) T = zeros(size(V)); ix = find(V); if ~isempty(ix) T(ix(1)) = V(ix(1)); end end
0238108b5025c3a16ccac61ac3ee78634e701f384b4ebd2f67cb101cc9b44e05
MATLAB
113
6
function seed_e_idxes=my_randperm(seed_e_idxes) seed_e_idxes=seed_e_idxes(randperm(length(seed_e_idxes))); end
e38548dc70e60ab4145587d7a5e911144ba396175cb93cbc708726ff738697ea
MATLAB
113
4
addpath /home/kristin/FLIES/data/multiplespecies/; setmultispeciesmovienames; DISPLAYAREAS = true; fixmanymovies;
fa277d4830c1560b745657df2b39d9e9575f9b69b0640aaec1e4efb0c5ceebe6
MATLAB
113
7
function [s] = cellnnz(c) %cellnnz.m %3/13/21 s = cell2mat(cellfun(@(x) nnz(x),c,'UniformOutput',false)); end
9052fbeb5ba6d5870ca887d964ba7d6b2612498393425ba87fa716cbf1e41b44
MATLAB
115
4
function sampNum = getSampleNumber(filename) [C, ~] = strsplit(filename, {'_', '.'}); sampNum = str2double(C{2});
6ba372e6b2d097432638c3e9caf70c76f2153896c1f0f3c415b0de7a3601b0f6
MATLAB
116
9
% x^2+y^2=r^2 % (x-x0)^2+y^2=r^2 % (16-r)^2+6^2=r^2 % % 16^2-32r+r^2+36=r^2 r = (16^2-36)/32 a = pi*r^2
6fc6d2c5354762c6c4cd1c15ffccaad91d60019cbb70897be1695b8499e2895e
MATLAB
116
11
function my_imshow(img_data) try imshow(img_data); catch err_info disp('image cannot display!'); end end
d5232cd5d326c2ccb998e99f5a48f2895d0ee3fac5372afd6fba20ac09579c96
MATLAB
118
10
function my_diary_flush() tmp_status=get(0,'Diary'); if strcmp(tmp_status, 'on') diary off diary on end end
b26cd9c2e786519c8926ddaf53b918350cd305ae03c8edc06ba1127a6e9b8787
MATLAB
119
6
function [U,V] = means_e(T_training, m, n) e = .5 * mean(at_training(:,3)); U = e * ones(m,1); V = e * ones(n,1);
c7b15fd9de585637518e43919e43450f9b1a205476e7a40d4b270bf1bfb0d3e9
MATLAB
120
5
function loss = hamming_loss(Y,F) [dummy label] = max(Y,[],2); [dummy est] = max(F,[],2); loss = sum(label~=est);
0100ccc8df66807b9a22df74dd402ac573b3bf88c92deac2d1eafe1c8d96667a
MATLAB
121
3
function mltp_plot_bfo_90_session_grouped(obj, session) mltp_plot_bfo_general_session_grouped(obj, session, 90); end
23dedc4b9c8ca509ea6c84939f5e1d3906e85e488d119c074b95d36f3680be75
MATLAB
121
3
function mlgp_plot_bfo_90_session_grouped(obj, session) mlgp_plot_bfo_general_session_grouped(obj, session, 90); end
153f6c6a994ae3bfc876e3521f5367d250194f75054a95f46919a5db5a0e12c6
MATLAB
122
4
function nonan = nanfree(x) % returns a shorter vector with all nan places removed nonan = x(~isnan(x) & ~isinf(x));
7059508351e29da1d738c826faaf6214d875a206d2172b3949ca24d468d91cf3
MATLAB
122
5
function loglin = loglinspace(xmin, xmax, npnts) loglin = 10.^(linspace(log10(xmin), log10(xmax), npnts)); end
9efa869387acbc34f2ddc1599dbfce7266d88308d25823afb300869406afdf39
MATLAB
123
5
function activeNeighbours = getActiveNeighbours(active, network) activeNeighbours = intersect(active, network); end
c7dbd5fcc8767257f194fad005af997f9be151df2b444f13c396b71c2d5fd649
MATLAB
123
3
function mltp_plot_bfo_180_session_grouped(obj, session) mltp_plot_bfo_general_session_grouped(obj, session, 180); end
030fd0c569e092c07e9d0214dfe55e3e57dbe007f99baad44a2cedd66bec1e45
MATLAB
124
4
function [parent, name] = fileparts2(path) [parent, base, ext] = fileparts(path) ; name = horzcat(base, ext) ; end
eb7f9fc22b61cca872695f0b3d21285181c4020e630abdb0865d02d3bb62d301
MATLAB
124
7
function clim = getImageLimits(im) if max(abs(im(:))) == 0 clim = [-1 1]; else clim = max(abs(im(:))) * [-1 1]; end
fd31dbc7de825310d6cf3215c2395905fab445254a2bb30e6203e730959ddcdf
MATLAB
124
7
function img = normalizzaImg(I) I = double(I); minimo = min(I(:)); I = I - minimo; massimo = max(I(:)); img = I / massimo;
3fb07289a378d229220a014a2679f3de32263e8c3a1f4a1d3a6f0c81cb71752b
MATLAB
128
4
function [output] = mygrid(limit1, limit2, N) output = limit1 + [0:N-1]*(limit2-limit1)/N + 0.5*(limit2-limit1)/N; end
4e2ad9464dbd1d4de30cf0d345367b4764d2bcf3689edbac5c95874c856cf44f
MATLAB
129
3
function samples = ml_stats_gen_uniform_samples(nSamples, xMin, xMax) samples = xMin + (xMax - xMin) * rand(1,nSamples); end
6f27891af6639027236718beea9b56f1ce413ddd7d7e88e174026bf44fd7ba94
MATLAB
129
2
% calibrate tracking results: convert from pixels to mms, frames to seconds [CONVERTUNITS_SUCCEEDED,savename] = convert_units_f;
c5e07ed0aea449be70f8c1d403e161f115818e9626667af2cfa035170a5de9ab
MATLAB
129
6
function SONMarkerDisplay(in) % SONMarkerDisplay is used by sigTOOL and is not part of the stand-alone % SON library return end
64fedeebe6e530f0f308469346d978e90c95b8ee775d6ca1233d1332148ab51d
MATLAB
134
6
function SONMarkerDisplay(in) % SONMarkerDisplay is used by sigTOOL and is not part of the stand-alone % SON library return end
1cb2a4162ef943949b9c3dd6a7d07510a4729d81aad9f4e105090164575c3cab
MATLAB
135
3
function mltp_plot_bfo_90_placey_session_grouped(obj, session) mltp_plot_bfo_general_placey_session_grouped(obj, session, 90); end
31575099f48e730157162be62170bd28c5b712c0c9974a851098c0d55308ea68
MATLAB
135
8
function flag=my_any(one_exclude_flags) flag=any(one_exclude_flags); if(numel(flag)>1) flag=my_any(flag); end end
ea89d8b7c12c1686f822b864fee90e6c453945640af00d53dffe360a3a31dc2b
MATLAB
135
10
function [Histr] = Hist(lag,spike) Histr = zeros(length(spike)-lag,lag); for i=1:lag Histr(:,i) = spike(lag-i+1:end-i); end end
65d6e8878cc2ebf90017968ab182f06ddba59fcd8cd9e4132570fc477efd1b5e
MATLAB
137
9
function input_info=cnn_layer_dummy_backward(input_info, layer, work_info_batch, output_info) input_info.dzdx=output_info.dzdx; end
0a6ec18b14659f3a217f92670429e53cbce3803546172ef4cdb0afebea3427e7
MATLAB
138
7
function boxes = Blobs2Boxes(blobs) boxes = zeros(length(blobs), 4); for i=1:length(blobs) boxes(i,:) = blobs{i}.rect; end
5494232913e9974d6596b0e1710c40e54a2e425d418c27345174873e7b4bddc5
MATLAB
139
10
function res = TVOP() %res = TVOP() % % Implements a spatial finite-differencing operator. % res.adjoint = 0; res = class(res,'TVOP');
02f3b41a4edcecef7beea1514b58e2c607c0c08e2b8b4bdbee4ebd5c28139d0d
MATLAB
140
10
function A=quotes_if_space(A) if A(1)=='"' else if sum(ismember(A,' '))>0 A=['"' A '"']; end end
69cfb582576da5fa66736f90eee2fa2edd1e3b22f7d4cf87dc16a0fe14478d56
MATLAB
142
9
function dx=deriv(x); ss=size(x); dx=diff(x); if diff(ss)<0, dx = [dx; dx(length(dx))]; else dx = [dx, dx(length(dx))]; end
5f06e5d3a5e8121cbbc258fca1b948061c777e99112f8069840f1f17b7b84188
MATLAB
146
4
function [Z] = ml_bs_occupancy_xy(bs, x, y) % Computes the occupancy for the positions in (x,y) Z = ml_bs_accumulate_xy(bs, x, y, 1); end
a5bc36b4ed3c39239ac4133c35b50579fcb055abe8be630ca0ab220333e87355
MATLAB
148
6
function [out]= zscore_norm(in, range1, range2) mu=mean(in(range1:range2)); sigma=std(in(range1:range2)); out=(in-mu)/sigma; end
d7aa1c3587c4fd0f95810948b45f6b25b8dd416d2d3ad7e9d4ad871c1779f68d
MATLAB
149
9
function[final_redcells]=add_redcells(redcell_vect,toadd) for i =1:length(toadd) redcell_vect(toadd(i))=1; end final_redcells=redcell_vect;
32164ae78949cc815f794a7fd297263a32ea5e92b8ac0583cc10241aa227d4ea
MATLAB
150
7
function mkdir_pers(directory, savefile) if savefile if exist(directory, 'dir') ~= 7 mkdir(directory); end %if exist end %if savefile
509b71b288d9aa46ba7c13334cb35555b3c5a45c0dfc6617d3c51f272f5c1dd9
MATLAB
150
9
function y = rmvNanCol(x,dim); if nargin<2, dim=2; end; if dim==1,x=x'; end nanm = nanmean(x); y=x(:,~isnan(nanm)); if dim==1,x=x'; end
b2fd5272b4502ebcf31bd9a46bff4dce9e85a9508f8eb2796d8fa8ea34b523bd
MATLAB
150
8
function xx = suptitle( txt ) %UNTITLED Summary of this function goes here % Detailed explanation goes here title(txt); xx=-1; return; end
b5b3aa1c6d6a68b58fb298669b6d24258773d9a63fda663b8ebed575cb5eeab0
MATLAB
150
9
% mglOpen(); initScreen; mglClearScreen(22); mglFlush(); mglEyelinkOpen(); mglScreenCoordinates(); mglEyelinkSetup(); mglEyelinkClose(); % mglClose();
b6fee8e051f9e4c53749b4979b8188d328baff159632fd0801f4ef5d73ae919a
MATLAB
150
8
function output_info=cnn_layer_dummy_forward(input_info, layer, work_info_batch) output_info.is_group_data=false; output_info.x=input_info.x; end
550b3348125893924aa367c93788df1743bbec3a20a7b56850361977cabc118d
MATLAB
151
6
% getSourceFigData % select the panel of interest, and then run this script. h = findobj(gca,'Type','line') x=get(h,'Xdata'); y=get(h,'Ydata');
29bbfeddc2bc515cce4b4f67a8744071a77b5328367e8399b70a97fa3b796733
MATLAB
152
10
function[final_redcells]=sub_redcells(redcell_vect,toadd) for i =1:length(toadd) redcell_vect(toadd(i))=0; end final_redcells=redcell_vect; end
ceb8a7f5fb4f08bbb8b6d6d6d522b09b7b213321b7b322cf2229f02c0a811851
MATLAB
152
8
% maximize current figure function maximize(hf) if ~exist('hf','var') hf = gcf; end set(hf,'Units','normalized','outerposition',[0 0 1 1]) drawnow;
7d588fcb4acac0cee8b7c7bdcfa16cb77a5d490043449f879a16d44859720004
MATLAB
153
4
function SC = set_PG_ND(SC) SC = flip_m(SC,'ND'); SC = change_exposure(SC,'PG',SC.PG_settings.ND_exp); SC = laser_set(SC.laser_settings.laser_PG_ND,SC);
d8736eb5147dfb1e2bcdb4ec367dff33d5682b74d985e47b4660492c32e50d49
MATLAB
153
4
function SC = set_PG_BP(SC) SC = flip_m(SC,'BP'); SC = change_exposure(SC,'PG',SC.PG_settings.BP_exp); SC = laser_set(SC.laser_settings.laser_PG_BP,SC);
450fdc56a088bc8f3e710fb5b3ae1b8dbb549635e2b878cffe2da1b10486f8a9
MATLAB
154
13
function x=move_to_cpu_values(x) if iscell(x) for tmp_idx=1:length(x) x{tmp_idx}=gather(x{tmp_idx}); end else x=gather(x); end end
285525ad397af3a54a6c1a25a1a40bb99edb22e2c46014f5df6b580adcd70b24
MATLAB
155
8
function fun = ForwProbV1(x,ynn_v,tv,no) ynn_v_r = x(1:no*tv); ynn_v_r = reshape(ynn_v_r,size(ynn_v)); fun = sum((ynn_v - ynn_v_r).^2,'all'); end
8bfac11843e98e4ea9676d093dbf8ae8e9d3b3f663d83984c23e16624806f672
MATLAB
155
10
function x = logit(p) % x = logit(p) % % Compute logit function: % x = log(p./(1-p)); % % Input: p \in (0,1) % Output: x \in Reals x = log(p./(1-p));
0863d7fa307ad2bd28eaccdfb49866b0d451c1fd04bbfe5079c60698a82ea9be
MATLAB
156
6
function h = ml_egomaps_draw_circle(x,y,r) th = 0:pi/50:2*pi; xunit = r * cos(th) + x; yunit = r * sin(th) + y; h = plot(xunit, yunit, 'k-'); end % function
160d17a12338126160405ae4dbeaa85531cc425429020f18d7dfd835a4f4c1f7
MATLAB
157
7
function [rr,ii] = mp2ri( mm, pp ) % Pass in the magnitude and phase and return % the real and imaginary data rr = mm .* cos( pp ); ii = mm .* sin( pp );
1f1aca5446b780caa88879a0cf7f26ef2a6c01a4d9b987d058b52f3f0ee25d8c
MATLAB
157
6
function y =LTP_D_func(temp,a,b,c,d,e,f,g,lam,p_d) if p_d == 1 y = (a*tanh((temp/b)-c)).*(temp>=b*c); else y = d*exp(-(temp+e)/lam) + f*temp - g; end
ee36d544047e0ec8029d97ff676090c354c6ba5e0f2375606a4a586216423ba6
MATLAB
157
9
function [I] = maxind(x,dim) %maxind.m 8/3/21 % for when it is useful to not have to have I be the 2nd output % inputs: x, dim [v,I] = max(x,[],dim); end
56b8c1a666e850598363dcdb3f16feaa09038f0d50e75ba73f6ee8707713bead
MATLAB
158
8
function showStructLabel( slabel) for j = 1 : pixNum, segs_pertree = slabel(:,:, j, :); figure(i); montage2(segs_pertree * 255); end end
6353eac63e403e84927f993801c16c6330fc344f911f8688be4e8e5b87305de8
MATLAB
158
13
function x=move_to_gpu_values(x) if iscell(x) for tmp_idx=1:length(x) x{tmp_idx}=gpuArray(x{tmp_idx}); end else x=gpuArray(x); end end
6c6268fb666b553fdb4b4e60417c16491a4bced0343e2c33cb6133045d8da874
MATLAB
159
11
% main_script chamber_dim = 15; % or choices=15,45,135 model02_main_script; model03_cross_section_XY; model03_cross_section_XZ; model03_cross_section_YZ;
b9c9a8282d40fa3534c991281ef611ea454c99d3e581bec88887244fe4c4e429
MATLAB
159
7
function [mm,pp] = ri2mp( rr, ii ) % Pass in the real and imaginary data and return % magnitude and phase mm = abs( rr + 1i * ii ); pp = atan2( ii, rr );
26a0d71d3d84f89f38e74d081409c035bbbe98ddd760f73c51782e0ab10bd385
MATLAB
161
4
function [edgesX, edgesY] = ml_it_edges_xy_uniform_density(x,y) edgesX = ml_it_edges_x_uniform_density(x); edgesY = ml_it_edges_x_uniform_density(y); end
4653e909ff55f98c228d1a93545ec0a9951fed3fe31cc89ec47e59181d3f154c
MATLAB
162
9
function lengths = returnCellLengths(x) L = length(x(:)); lengths = zeros(size(x)); for i=1:L lengths(i) = length(x{i}(:)); end
0758c3ff6ff1727ea5659d89acd463662e22b9b35212b6bb91932c2c69ae1b3a
MATLAB
164
8
function [controlFit] = controlFit (dat1, dat2) reg = polyfit(dat2, dat1, 1); %dat1 is signal, dat2 is control a = reg(1); b = reg(2); controlFit = a.*dat2 + b;
50996562a4913023fa805af441f69a784c8ce25845fa8dff9cb0997db0b5335b
MATLAB
165
11
%% import and plotting functions fn=('130625_001.2.wcp'); out=import_wcp(fn,'debug') %% plot_wcp(out,'recordings',10:20) plot_wcp(out) plot_wcp(fn)
6944cad3bc03e8fc9a1329589b59acabf7f9956cd0d97c1dabd01fb80ced58f5
MATLAB
165
7
function result = fif(test, result_if_true, result_if_false) if test , result = result_if_true ; else result = result_if_false ; end end
8de8e2e72cf0e5e0468249f405b633a1b186a14d059a1f325476dc37629c7198
MATLAB
165
11
function C=My_colour_palette C=[158 1 66; 213 62 79; 252 141 89; 254 224 139; 230 245 152; 153 213 148; 50 136 189; 94 79 162]./255; end
95a24bfd8db6303c1dcbccb94ae8411f91b448769f1ffd65865bc3c5c0181a07
MATLAB
167
9
function indexes = randSample(N, fac) indexes = false(1, N); for i = 1 : numel(indexes) if mod(i, fac) == 0 indexes(i) = true; end %if mod end %for i
a8946deff9e104e3ee0feb0b35e9ee62e21c3fd0df78fda80fafee848efd68b0
MATLAB
167
8
function [vc] = toCol(v) %toCol.m % vector to col orientation if not already assert(isvector(v),'this function assumes a vector input') vc = reshape(v,[],1); end %fn
b517d06c55a803c73cdb1c4fc476f3a27da51961092125e5143d94c0a5ee67b3
MATLAB
169
7
function step = computeStepFromScale(scale) if scale == 0 step = 2^scale; else %if gaborBank(g).scale == 0 step = 2^scale * 3/2; end %if gaborBank(g).scale == 0
25a14330972e2e739a4e1bf50e3d5a8254d84e238f090a2c599cf9e7320f7e25
MATLAB
171
6
function W = exp_weight(X) norm = X(:, 1) + 0.0001; numer = exp(bsxfun(@rdivide, -X, norm)); denom = sum(numer, 2); W = bsxfun(@rdivide, numer, denom); end
0288d02226cad28cc066deb5851ce39d26f14c6c15f5f9ca741afe967d7c574c
MATLAB
173
12
function w = precompute_dpss % assume 1 second and 1000 Hz sampling rate s = 1:0.5:50; n = 1000; w = cell(size(s)); for i=1:length(s) w{i} = dpss(n, n*s(i)/1000); end
648fa796f71846b76d4000fcea5e6e3c09b7620184904bae3de8128ec640ed38
MATLAB
173
9
function out = sampleFromMatrix(data,N) L = length(data(:,1)); if L <= N out = data; else q = randperm(L); out = data(q(1:N),:); end
7605115d2f26a76807bd3e89d6abb99f65eb9c3aa9745f31f8c60e35b3194c89
MATLAB
173
8
function in = inrange(chan, range) % function in = inrange(chan, range) % % Return logic if chan is within range % % RST 2006-04-05 in = chan > range(1) & chan < range(2);
6612379de10006a0e4f4e52fe89a60f0c8c3b3a841ed2ac0b8048158792923c0
MATLAB
174
13
function b_set=my_random_sample(a_set, sample_num) a_num=length(a_set); if a_num>sample_num b_set=a_set(randsample(a_num, sample_num)); else b_set=a_set; end end
9d43763d8d3aa15dfb192d0082f7e197bf4bef20ebe8cd5efc39dfbfc78ee4da
MATLAB
175
8
function [x,y] = getcirc(cx, cy, radius) theta = linspace(0,2*pi,100); %you can increase this if this isn't enough yet x=cx + radius*cos(theta); y=cy + radius*sin(theta);
f7a4f7ac27f94ed56f95282c5b028773efa09e385e994942b201aed4ea7e207b
MATLAB
175
4
function y =dopa_func(temp,thresh_size,d_0) y = (temp-(d_0+thresh_size/2)).*(temp>=(d_0+thresh_size/2))... + (temp -(d_0-thresh_size/2)).*(temp<=(d_0-thresh_size/2)) ; end
36709b586fda9dcaddf25c8ff6e2187aa5a39d55dbeab85177f3cc58364f6b09
MATLAB
176
5
function [positionProbMap] = ml_placefield_positionprobmap(dwellTimeMap) % Location probability, p(x,y) positionProbMap = dwellTimeMap / sum(dwellTimeMap, 'all'); end
21bcd9576b088ca62608a22a0380ab1ac96c7f3993dba39f79fd601bfb29b0af
MATLAB
177
5
% Marc Normandin, Muzzio Lab, Psychological & Brain Sciences, University of Iowa, 2024 function [fieldNames] = helper_possibleScalar3FieldNames() fieldNames = {'map'}; end
1ab6f13266ef2acd2769d50b56303ad593a63147724da2ca95376a0d039f8eef
MATLAB
178
11
function labeledFrame = labelSingleFrame(clusters, Ncells) labeledFrame = zeros(1, Ncells); for i = 1:length(clusters) labeledFrame(clusters{i}) = i; end end
e3489881d3d454af052c5311560181655cad9af389fae8f4ce3d65114a1087d4
MATLAB
178
16
%% Dendritic analysis guide Alex %% Align using app %% Make DFs %% Make ROIs %% Prep ephys edit cutEPNikon % Saves ephys for each image as 'epData' %%
9adc6664c1f8f91c55c6a5c49657d01b51d9a0c9ba72ba4e452638a3b70e798f
MATLAB
179
4
function v = isdummytrk(trk) v = (any(isnan(trk.x)) || length( trk.x ) == 0); % if v, fprintf( 1, '%d of %d are NaN\n', length(find(isnan(trk.x))), length(trk.x) ); end %%%%%%%%
d81718d6e63a89a9652b49f481318b97bcfd4d150a2c672e4ba01686d450207d
MATLAB
179
13
function [newA] = insertValue(A,V,ix) % assumes vector tmpA = toCol(A); newA = [tmpA(1:ix-1); V; tmpA(ix:end)]; if ~iscolumn(A) newA = newA'; end end
b7d800c70d14f1227a25926276bb410f0c7ba9031118fc6beab82c295db7e96b
MATLAB
180
14
function [subY] = sub_sqrt_y(Y,Nc); Y = sqrt(Y); neurons = 1:size(Y,1); if Nc==0 Nc=size(Y,1); end neurons = neurons(randperm(size(Y,1))); subY=Y(neurons(1:Nc),:); end
e856b59b573fe463cdbe968f57fdfc440af0d15a6fe6a94340fb76e2340c4920
MATLAB
180
13
% % % function [] = mglEyelinkCMDPrintF(message, varargin) % % % formattedMessage = sprintf(message, varargin{:}); mglPrivateEyelinkCMDPrintF(formattedMessage); end
6b89ab5d01516d707d7a0b300124f3298ebe630701f518a7a7ecf92e4e6995e9
MATLAB
182
10
% aslDefaultCallback.m % % usage: aslDefaultCallback() % by: justin gardner % date: 09/04/10 % purpose: % function [task msc] = aslDefaultCallback(task,msc)
6d30f4fea31e075485d3ee42cbeef5dc927613498b553f2773b03029915e95e9
MATLAB
182
10
function out = shuffledMatrix(x) N = length(x(:,1)); L = length(x(1,:)); out = zeros(N,L); for i=1:L q = randperm(N); out(:,i) = x(q,i); end
9d5adef3bf0cfd5b7e3f4f3e7b6f468c525819eedd53d03466bb4a4dba9a318b
MATLAB
182
14
function make_ref_obj(input_var) if isa(input_var, 'ref_obj') return; end one_mutable=ref_obj; one_mutable.ref=input_var; assignin('caller', inputname(1), one_mutable); end
1a76498a5b2b7f366ec5e40b52e8ffc0845feaa9e3d4450a372728149ebc46c6
MATLAB
183
10
% % main_script.m % Comment: Just run this script and it will create the model % model02_main_script; model03_cross_section_XY; model03_cross_section_XZ; model03_cross_section_YZ;
aa22ffcf3e76d4097a977bd9238289287823eb9e45268218ebec0ab752785f46
MATLAB
183
8
function [amp] = rmsamplitude(eeg) %ALPHAPOWER Calculates log band power in the alpha (8-13Hz) band of an % EEG signal. eeg = sqrt(sum((eeg./mean(eeg)).^2)); amp = sum(eeg.^2); end
10d708214e053a44599b59dfda5fc4fab888ee852be2f5c42e324d4a6e46d906
MATLAB
184
17
function ret = corr(a, b) if nargin == 2 ret = corrcoef(a, b); elseif nargin == 4 ret = corrcoef(a, b, c, d); else error('*** unsupported case'); end
782d05213929ea705cce984095e57a977d8bc6a21ab45ef334da01e9f4255946
MATLAB
184
12
function ret = rmse_full(A, U, X, V) if ~size(V) V= U; end di = A - U * X * V'; ret = sum(sum(conj(di) .* di)) / prod(size(A)) if isnan(ret) | isinf(ret), error('***'); end
ba4082a2f59bf54d8e6e7f2a8a4d12fd33b2513a206fe128fb82874553758f44
MATLAB
184
11
figure(1); clf; zmat=ones(8,8); for ii=1:8, zmat(:,ii) = ii; end zmat(:,ii+1) = zmat(:,ii); zmat(ii+1,:) = zmat(ii,:); surf(zmat) view(0,-90); colormap('jet'); colorbar
c4c14cd51a538125b2e1c31c4231a6dedfe37ad6a858cf37902359182f07d922
MATLAB
184
7
function [] = renameParsedVariables(p) fnToRename = fieldnames(p.Results); for ff = 1:length(fnToRename) eval([sprintf('%s = p.Results.(fnToRename{ff});', fnToRename{ff})]); end
53b7390f48c8e5266901f5b527e3f9f8b8b038e4059e246336925591f390a4d9
MATLAB
187
6
function output = GliomaImmunotherapyEndpoint(input) % For optimal control using GPOPS-II % used in the code GBMoptimalcontrol.m Cf = input.phase.finalstate(1); output.objective = Cf;
7e3c5db87a87ffef744ffeb45d1f595d6abb04251b140bf7e56a828be46c5823
MATLAB
187
9
function display(ipa) % INPLACE/DISPLAY Display an inplace array from the command line. % % Example: % ipa = inplace(ones(5)); % ipa disp([inputname(1), ' = ']); disp(ipa.get_a());
2daf18aba06da9f9767d7a76a6196b85caee31aa4d9997009da3512e6b394461
MATLAB
188
8
function writelog(LogFile, LogText, perm) % writing to log file for cluster version if nargin < 3 perm = 'a'; end fID = fopen(LogFile, perm); fprintf(fID, LogText); fclose(fID);
33ce745d144ff6c0a6b74634e232dead832b76971ef1c46022a4fd98ef8e1016
MATLAB
188
6
function R2adj = computeAdjustedR2(data,prediction,numExplanatoryParams) R2 = computeCoD(data,prediction); n = size(data,1); R2adj = ( (1 - R2)*(n-1) ) ./ (n - numExplanatoryParams -1);
59f641b4d720358b3931c6b2bb0cdb842ea2a595b0c5f454f1d4e119186b8d92
MATLAB
188
15
val = 2x2x4 struct array with fields: Ns sts NsShuf stsShuf ShufStd SpikesExcluded ShufAll ShufAllNs sts2dShufAll sts2dShufAllNs
75fa8cd43250fcc12e176ad9fd2ade666ce39072cd5b9fdc3f742964d729f593
MATLAB
188
4
function v = isalive(track,f) v = ~isdummytrk(track) && track.firstframe <= f && track.endframe >= f; % if isdummytrk(track), fprintf( 1, 'track at frame %d is dummy\n', f ); end %%%%%%%