sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
2793cc050c20fdf215bb5c5a8091f398b0b28daf0bb65686619d5aaa259af521
MATLAB
119
4
function [cell ind] = removeEmptyCells(cell) ind = ~cellfun('isempty',cell); cell = cell(~cellfun('isempty',cell)); end
3569604487b5a420879d8b94901af837d083b7aa9314d719f92096cc8e580931
MATLAB
119
4
% Chapter 11: Interior-point methods % % log_utility_flow.m - Section 11.8.4: Network rate optimization help Contents
a82bfd64e919b231ff02e581a927b567b4ea6db587615b5917d48792e0e0190c
MATLAB
119
4
function [m,b]=lineariz(average,top,buttom) m = (top-buttom)/(max(average)-min(average)); b = top - m*max(average); end
64e98d4da0028bac5c513b4db49d91065f1602d0316de35fe513f3cd6ab29e4e
MATLAB
125
11
function s=pval_to_star(p) if p<0.001 s='***'; elseif p<0.01 s='**'; elseif p<0.05 s='*'; else s=''; end end
328121d6159f69644e3b66df90be925c308870b2ab3a84347731ee4f4676fea4
MATLAB
126
6
function res = myerf(x) res = x; idx = abs(imag(x))>eps; res(idx) = erfi(imag(x(idx)))*1.i; res(not(idx)) = erf(x(not(idx)));
25aa2543f0e8b5ff210e82b5322e93c64fa88689a516ea055a56c5bef747c11b
MATLAB
128
7
function img=ea_createatlascheck(h,gf,options) % options.d2=options.prefs.machine.d2; %set(hf,'Position',[0,0,800,800]);
7def88b17b0c57b7d5fd6c337dbe6b6b133f43437720d18cf9dc145a0127bf62
MATLAB
128
7
N = 100; parfor_progress(N); parfor i=1:N pause(rand); % Replace with real code parfor_progress; end parfor_progress(0);
2fd0bf04c390d891f60c97b66152e98551144a3ef960456b08033eff822f1d6b
MATLAB
129
8
function [Energy]=Sum_of_Squares(k) len=length(k); Energy=0; temp=k-min(k); for i=1:len Energy=Energy+temp(i).*temp(i); end
43757df31c5fc18a7884ff523dd5437a49861aa1d1b56d471b5d8e59648a9619
MATLAB
129
6
function fibs=ea_discfibers_addjitter(fibs,jit) for fib=1:length(fibs) fibs{fib}=fibs{fib}+randn(size(fibs{fib}))*jit; end
c6b6a4d59b4af2a352854eb6e7325a766f9d87d5334355b110d41a073bd97e88
MATLAB
129
6
function [r,g,b,ii] = mygetrgb( img ) r = img(:,:,1); g = img(:,:,2); b = img(:,:,3); ii = max(max(r,g),b);
e7a26886ed33a91e843c4534975a0618667e2f7179fa66c179bb5b42ef9ae984
MATLAB
131
3
function CBIG_aaa() % Written by [xxx] and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md end
5cea63b43b468f8d5261cb63863849687a5054f6cd271d5d18bb392eeb6854a5
MATLAB
133
6
function fibs=ea_unifiedmapping_addjitter(fibs,jit) for fib=1:length(fibs) fibs{fib}=fibs{fib}+randn(size(fibs{fib}))*jit; end
c1b50a8637a994833c69f14fefb176dfe6ebe14065afdbe960a593ac469d0bb3
MATLAB
133
5
clearvars clc close all fclose('all'); ea_explorer20('F:\ExampleData\derivatives\leadgroup\20200407121650\explorer\mytest.explorer');
62738827f3e75ce755e5cf056e63ec3e3cc71aded95a2f39e9e8d520575df65f
MATLAB
135
6
function [ y c] = dirPrior( p,x ) p(2) = 10.^(p(2)); y = p(2).*cos(circ_ang2rad(x)-circ_ang2rad(p(1))); c = y; y = exp(y)./(1+exp(y));
d1840f539e54dd7615a1ef4cfd03c7d8a55acf2dc8c1bc52a2b016bad8140064
MATLAB
135
6
function start_display(ring,fig) set(fig,'XData',(1:length(ring)),'YData',ring); axis([1,length(ring),-0.3,0.3]) drawnow return
785ccb13e63c68f056f08689a705769f50ccb07a6942fb61e9ff983c5df80e7c
MATLAB
136
3
function show_imgnmap2( img , smap ) smap = mat2gray( imresize(smap,[size(img,1) size(img,2)]) ); imshow(heatmap_overlay( img , smap ));
46b3acbcd53afc2c2bb20cb62d05038e2ea87b4b044fe2dcc2efed558d8988c6
MATLAB
140
10
function cmd = histcmd() fid = fopen([prefdir,'/history.m'],'rt'); while ~feof(fid) last = fgetl(fid); end fclose(fid); cmd = last; end
e36382cd9f874e33d9a419def2ed97558c33219888b1f3f8df56b6719a6befb8
MATLAB
141
6
function start_display(ring,fig) set(fig,'XData',(1:length(ring)),'YData',ring); axis([1,length(ring),-0.3,0.3]) drawnow return
536bbce3b73313c67c14599ab82b8d0d91a120c6c82f8720a36a66af80f77c02
MATLAB
142
5
function nl=newline() % Newline character generator. This is a work-around for missing %`newline` function prior Matlab 2016b. nl=char(10);
e94ebf90832de4c51e4f867473d71d1a9962672ab9d74b19506875bf651bc96d
MATLAB
142
3
function CBIG_wo_MIT_license() % Written by [xxx] and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md end
8924a5ff5aaccb908e5d6c289c37c2727c9d626e8fa9280d7d5c5e7ccfb9a6ff
MATLAB
143
10
function ret = fileexists(fname) ret = false; fi = fopen(fname); if fi == -1, return; else ret = true; fclose(fi); return; end;
07a2c9d54add55e747a427bdc473ea52a7438709f98798a458d9f2a230e5a354
MATLAB
145
6
function scaledInput = scaleZeroToOne(input) scaledInput = input-min(input(:)); scaledInput = scaledInput / max(input(:)); end
5a4754b1ebc4c083f182ef1332dfa956f942fe6736478437a3452a34d0cdfd0c
MATLAB
145
7
function y=ea_pdist(varargin) % if license('test','Statistics_Toolbox') % y=pdist(varargin{:}); % else y=octave_pdist(varargin{:}); %end
bac3899ee9b2ba81d8cc40aa0744b6b540dce793f6ac0f94e1495b9260f3547c
MATLAB
147
6
function [ t ] = isempty( self ) % Returns whether the spike structure is empty t = cellfun(@isempty,reshape({self.ts},size(self))); end
08638752ad5cbd27fe52fb27b963f30eef082b9894e6fe159d618a91f766aeb6
MATLAB
148
6
function sem = getSEM(data) % calculates the standard error of the mean of data % data must be a vector sem = std(data)/sqrt(length(data)-1);
b71c4f75b41776892af44198db0b1b5d6dee7c48295e849fc2eb6f95ee61c677
MATLAB
148
10
function [ Output , explained ] = subfun_PCAtoPC( Input ) [coeff,score,latent,tsquared,explained,mu] = pca(Input); Output = Input*coeff; end
e60b5a0d6e1490647c37268ca3a9e2d773c0d616a42271659fb746170db61716
MATLAB
149
5
function this = orderfields(this, vals); for index = 1:length(this) this(index).EEG = orderfields(this(index).EEG, vals); end;
ae1d44ea712320e437e37ecfe11a9f342b395b283ddecc58ed149342fb9207b3
MATLAB
150
5
function this = horzcat(varargin); this = varargin{1}; for index = 2:length(varargin) this.EEG(index) = varargin{index}.EEG; end;
157d0eade32fc3f21c99044514ec4302979888fa50e58f50d24e12f4df1d45e7
MATLAB
152
4
function CBIG_test_bbb() % Written by [xxx] and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md CBIG_test_aaa() end
3f4e49511256e004e353b87677e7a0893aad6cd12fa0ee665dbdb6e1a9f91ed7
MATLAB
152
9
function r = drchrnd(a,n) % Draw samples from Dirichlet distribution p = length(a); r = gamrnd(repmat(a,n,1),1,n,p); r = r./repmat(sum(r,2),1,p); end
38ccd3c71d44bc21ab85e31e978197b07bf739033c054b3e331cff19a1f97933
MATLAB
154
4
% simple dataset tests p = fileparts(which('eeglab')); EEG = pop_loadset('filename','eeglab_data_epochs_ica.set','filepath',fullfile(p, 'sample_data'));
62c3ba35f53ffd1c2e96ba31ca3be35a336bd9bd297655820efc6a6802a1da50
MATLAB
154
7
% Add path to dependencies. setup() function setup() root = fileparts(mfilename('fullpath')); addpath(root); addpath(genpath(root)); end
8de5e8b9e9b42702a24a64d33491cfb0409f5e135645b1d51378ac10a7556e11
MATLAB
154
7
% iseeglabdeployed - true for EEGLAB compile version and false otherwise function val = iseeglabdeployed try val = isdeployed; catch val = 0; end
9f4ffb8daf9f32daa893cb6f13c2a17ccf338a07a717e872b1ee0ddb3e99b157
MATLAB
154
5
function cmap = cmapSubpops() % For the original 4 subpopulations cmap = [[59, 133, 204];[75, 155, 119];[193 124 165];[219,162,65]]; cmap = cmap./256; end
16be8fcdbeb427d341df3e4fd4455d841945daf8c8bfe8b18cd3fc3a0b2e6638
MATLAB
155
6
function [data] = bz_shuffleCircular(data) % circularly shifts each row for i=1:size(data,1) data(i,:) = circshift(data(i,:),randi(size(data,2))); end
98ac128b889ecccc915a0b570dcaf7018e6a248256456bfcc9f1d4060b7e41da
MATLAB
156
5
function r = drchrnd(a,n) % take a sample from a dirichlet distribution p = length(a); r = gamrnd(repmat(a,n,1),1,n,p); r = r ./ repmat(sum(r,2),1,p);
3f0606313f77bf7c69f46fb2c9c47ba1ea2264e96e19b4213c236d7685ea8c2e
MATLAB
159
6
function [] = CompileMexFiles() %Compiles mex files that accelerate B-spline evaluation mex evalBin.c mex evalBSpline.c mex evalBinTimesY.c end
f49eccdc5085c21f3dd52e93c6c77f00f8b82d547dc7a5ef2f5d01f89b8dfbe1
MATLAB
159
12
function [ b ] = isempty( self ) % Returns boolean of whether the session has cells b = builtin('isempty',self); if ~b b=isempty(self.cells); end end
c901b608b4c6bda5f472fee6c14d55429f582c9cc48b55c25d23719fd5835f8d
MATLAB
160
6
function b = iscellnumeric(C) % Return 1 if all elements of cell array are numeric % % Tim Mullen, 2011, SCCN/INC, UCSD b = all(cellfun(@(x) isnumeric(x),C));
30fcf326548d9b487e5bb104ce1ca05c515f4b63211b140db06dd8fde248dbd3
MATLAB
161
9
function z=lfknots(fit,varargin) % % very spartan version of the S lfknots function... % % Author: Catherine Loader. z = fit.fit_points.fitted_values; return;
ecdd5806ffa8f72165ad8abd9172d6ca9f8ab5ca02771924b4e736514777fa36
MATLAB
161
11
function rimg = rankimg(img) img = uint8(mat2gray(img)*255); rimg = zeros(size(img)); img = img(:); for i = 0 : 255 rimg( img == i ) = mean( img < i ); end
f1b457549b4e8a6c36524f487d313d1e96255bbd51530acb96a3d05f2c852688
MATLAB
162
7
function showscalebar(im, s) [d1, d2] = size(im); d3 = ceil(d1*0.05); d4 = ceil(d2*0.05); hold on, plot([d4 d4], d1-[d3, d3-1+s], 'color', 'm', 'linewidth', 2)
588e87dc65ccade3a4bf6f2569958bb3e9eca8ade02489db000b5ce479a30ad5
MATLAB
164
4
function d_circle(x,y,r) RGB = brewermap(9, 'Greys'); rectangle('Position',[x-r,y-r,2*r,2*r],'Curvature',[1,1],'linewidth',2,'Edgecolor',RGB(8,:)),axis equal end
78c54cec716857175de83c18185413d165d4921f86d7fa258888ff9c34b483b1
MATLAB
165
8
function test_components %% msgid = 'matlab_bgl:test_components'; %% biconnected_components load('../graphs/tarjan-biconn.mat'); [a C] = biconnected_components(A);
72e2fd95563197e2ee563a56150935f4b8cfbf729701516d6ed7dd4be43a5bcb
MATLAB
170
11
function [] = kwx2spk(basename) wav = h5read(kwx,'/channel_groups/1/waveforms_filtered'); spktimes = hdf5read(kwik, '/channel_groups/1/spikes/time_samples'); end
2bba0c0583140090522b2cf93ba9cc8e01cc959f3325e9deac1da8b6ed0eeaef
MATLAB
172
12
function h = hypnomap %% % Authors: Dan Denis % Date: 2021-07-14 %% h = [0.5 0.2 0 0.5 0.2 0.5 1 0 0 0.1 0.9 1 0.1 0.6 1 0.1 0.1 1 0.1 0 0.6];
bb541b920802210a1c7548f363c17727df8e3ee0ae8147c5af67cf5ddce51c3e
MATLAB
174
5
function obj = cloest_obj(data1, data2, tx, ty) data1 = [data1(:,1)+tx data1(:,2)+ty]; distmap = pdist2(data1, data2); obj = sum(min(distmap,[],1)) + sum(min(distmap,[],2));
64aa7f7ef6263626a5101f285096f0e53e6c05ead1d6924d6639b9ad6b3feb42
MATLAB
177
14
function g=aic(varargin) pen = 2.0; fit = locfit(varargin{:}); rs = rsum(fit); df0 = rs(1); df1 = rs(2); llk = rs(3); ai = -2*llk + pen * df0; g = [llk df0 df1 ai]; return;
750a0a7798984677def76e2641377ba49cec21185a838c8a6efcdd5ed3f147a2
MATLAB
179
8
function termsOfUse if verLessThan('matlab','8.5') helpview([matlabroot,'/license.txt']) else helpview([matlabroot,'/license_agreement.txt']) end end
73b7109af4cf6c5286fff16f9d10a8d994c02a5f15816d09897aaf37cdf88f71
MATLAB
180
6
% This function calls the Matlab rotate function % This prevents the issue with the function in the private folder of Dipfit function rotatematlab(varargin) rotate(varargin{:});
44889fc4663f7d23bf22d8a90a3c9ff2da789b2c340eb338d67e8414016fa0e0
MATLAB
181
5
function fnames=ea_getfslnormfuns % this is a protocol of available FSL normalization function names. These % will be used for non-SPM normalizations. fnames={'ea_normalize_fsl'};
bbc41f45e959c27a71dcc9256247f812730531235d0888ad57eb401eae1335ee
MATLAB
181
5
function cmap = cmapSubpopsScatter() % For the original 4 subpopulations, for scatter contrast cmap = [[0, 115, 180];[5, 158, 116];[204 120 167];[230,159,39]]; cmap = cmap./256; end
0ad7626385051b5b2acb193ea1593cced65eed09cf06ae7d39e847e1afeb476f
MATLAB
182
13
function [A,tmp] = areaROC( p ) tmp = -1; p = getBestRows(p); xy = sortrows([p(:,2) p(:,1)]); x = xy(:,1); y = xy(:,2); x = [ 0 ; x ; 1 ]; y = [ 0 ; y ; 1 ]; A = trapz( x , y );
ba88b013f34753c4377e522978ec226c74d56991648f562aecaef3f9dee1f1a4
MATLAB
182
9
function obj=no_legend(obj) % no_legend() remove side legend on the plot % % Useful when plotting multiple gramm objects with the same % legend obj.layout_options.legend=false; end
49762dd610ab7fce7e4ea7890a1b994b231057439f3b4854893b3e57f5ef1360
MATLAB
184
7
% finish reweighted_graphs.m % add more to test_main.m % finish new_in_3_0.m % finish matching_dmperm.m % add root vertex to prim's algorithm % check documentation for core_numbers %
73ef8728533e3a4c91a01376a233a1cae44ff288c5f5cb3034825ffe7cc7d310
MATLAB
187
7
% this function is called when the file is being saved function obj = changefile(obj, newfile) movefile(obj.dataFile, newfile); obj.dataFile = newfile; obj.writable = false;
add94761fd4cb0f2bdefbcf9de687e91b8895df5b8e47ecf65c4c4dfec067b3d
MATLAB
187
13
function C = unpack(C) % Unpack a nested cell array for i = 1:size(C, 1) for j = 1:size(C, 2) if iscell(C{i, j}) C{i, j} = C{i, j}{:}; end end end
1c04e9b6acff7cd473a93ad69c1833d7ea89a09175e3a22943bd1798f888fd28
MATLAB
190
9
function atlases=ea_atlasreducepatch(atlases,red) for atl=1:length(atlases.names) for side=1:2 atlases.roi{atl,side}.fv=reducepatch(atlases.roi{atl,side}.fv,red); end end
59d10cb381230cf68d4638980486a8336373e74e8d2d76706c0b4f6e553afb02
MATLAB
190
13
% Builds and solves a simple least-squares problem using cvx echo on n = 100; A = randn(2*n,n); b = randn(2*n,1); cvx_begin variable x(n) minimize( norm( A*x-b ) ) cvx_end echo off
6e8b1855f1fa14930a8d3ed9b3cd9ae379c2d8ea2f59a296f3cfb6b606fe75cd
MATLAB
190
9
function ficell=ea_checknofilefolders(ficell,fname) todel=[]; for fi=1:length(ficell) if exist([ficell{fi},filesep,fname],'file') todel=[todel,fi]; end end ficell(todel)=[];
7d070b2238e5e00f4e0911caa35d96313c9f5b9b6c403090890d0445a7747865
MATLAB
190
7
% Written by [xxx] and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md addpath('ad/cds/'); addpath('xxxx/fsf/'); addpath /dadf/dafsf rmpath('ad/cds/');
02ea00efaadeb87edf8dee2d3e6d9d4e500558a77afd6accf91995c3f14bfaa4
MATLAB
191
11
function y = ea_nanmean(varargin) if nargin==2 x=varargin{1}; dim=varargin{2}; elseif nargin==1 x=varargin{1}; dim=1; end N = sum(~isnan(x), dim); y = ea_nansum(x, dim) ./ N;
2a541de7a391017fa21ab5777c970223e57a0df31c8ba7ce0cd2e24f3502569b
MATLAB
191
13
function g=gcv(varargin) fit = locfit(varargin{:}); rs = rsum(fit); df0 = rs(1); df1 = rs(2); llk = rs(3); n = size(fit.data.x,1); gc = -2*n*llk/((n-df0)^2); g = [llk df0 df1 gc]; return;
5bf02d9a58b742444c244066de0b0917813fba7c70f2f4424a7b204fc615ab10
MATLAB
191
10
function sel=multi_sel(to_sel,value) %Do a selection on the basis of string equality or numerical equality if ischar(value) sel=strcmp(to_sel,value); else sel=to_sel==value; end end
e83b91f7d15d89106c7e54c999ba26ed9278f2fb46045416c472ee0e0443f563
MATLAB
191
9
function ficell=ea_checknofilefolders(ficell,fname) todel=[]; for fi=1:length(ficell) if ~exist([ficell{fi},filesep,fname],'file') todel=[todel,fi]; end end ficell(todel)=[];
0ac1814ad0dd787c03d193054bdf72a50420a920ad6e8ad42bc9ada08739b09a
MATLAB
193
6
function y = In y = cvxin; % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
2000e32a98a3e9883b983483a7c4b8eb82f76d4acb91af33532cc284a657d3c3
MATLAB
193
6
function [ dev ] = dirPriorDev( p, y_emp, x ) %DIRPRIORDEV Summary of this function goes here % Detailed explanation goes here y_pred = dirPrior(p,x); dev = nansum((y_emp(:)-y_pred(:)).^2);
f7cc6ecb5a728501581732764b199d5a6194c66e1a0a1bba0a094be59909bb68
MATLAB
194
6
function fwrite_excepting(fid, data, type, filename) count = fwrite(fid, data, type); if count ~= numel(data) error(['failed to write data to file "' filename '"']); end end
f7abaf48d5340da7dde4bac68eaa2584d3b4c5b74d2860696678c927e1a48458
MATLAB
195
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());
1dbbe8615e89e1213925cd573e54124739843f90ca61f869db659c1b1e34e056
MATLAB
197
8
% counts the number of self-loops in the graph % INPUT: adjacency matrix % OUTPUT: interger, number of self-loops % Last Updated: GB, October 1, 2009 function sl=selfloops(adj) sl=sum(diag(adj));
a013625285c555e2e8866300fc7659c8b858ab07e4e8259be24044a4e3e92be0
MATLAB
197
15
segmentBlobs_locmax() condColocPt2Pt2Pt() condColocPt2Pt2Blob() condColocGeneral() runColocalizationAnalysisSimulation() plotSaveConditionalColoc() condColocStatTest() plotCondColocPvalues()
b9b21ef62c5c5e92ab5a256ad822632a14a7940f6748c563e635bfeb9f914513
MATLAB
197
8
function separatePausedNSx(varargin) % separatePausedNsx Obsoleted. Use splitNSxPauses instead. disp('This function is obsoleted.') disp('Use splitNSxPauses instead.'); splitNSxPauses;
9869beda3ee68e6a0d8f83fbfe7850ae33363088357b301bb635d28348e5b38e
MATLAB
198
9
% Local Regression and Likelihood, Figure 3.1. % % Bivariate Local Regression. load ethanol; fit = locfit([E C],NOx,'alpha',0.5); figure('Name','fig3_1: Bivariate local Regression'); lfplot(fit);
ef46d2a8b2f31c8245157b188806f8d2033d0b7aec2a500c5567bcc126f346b4
MATLAB
198
10
function vernum = get_matlab_version ab = version; dot = findstr(ab, '.'); a = ab(1:dot(1)-1); b = ab(dot(1)+1:dot(2)-1); vernum = str2num(a)*1000+str2num(b); return;
a5d264e1b18063ab11febc56717b9573da2577a9b6e00abf10b7f121c56425dd
MATLAB
199
11
function [ Query , ni ] = tokenize( inputquery ) s = inputquery; ni = 0; while length( s ) > 0 [token, rem] = strtok(s); ni = ni + 1; Query{ ni } = token; s = rem; end
b8e619edf8417312b0380fa9db7703b0c253744fd6b83dc0abfb941da2206753
MATLAB
199
6
function x = rhs( y ) x = y.rhs; % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
93662f17247c1d60bdf05c18ebbd12054bfc99ff9a358f386e44edac00dd9313
MATLAB
200
7
function stats=ea_centroid(bw) % small replacement for the regionprops function (centroid only) which % requires the image processing toolbox. [xx,yy]=find(bw); xy=[yy,xx]; stats.Centroid=mean(xy,1);
146f1db5a43fefc5786d3b0db7e9b873eee2b0f7d580de6adbf634d8712a4b5e
MATLAB
201
12
function refreshdisp(str,prevstr,iteration) if ~exist('iteration','var') iteration=2; end if iteration==1 fprintf(str) else fprintf(char(8*ones(1,length(prevstr)))); fprintf(str); end
354849cc095f32ad32d8e6bc5e48cf5096e9f5266be7863ee76291ba40536ca4
MATLAB
201
5
function [cfg, def] = cfg_mlbatch_appcfg % Auto-configuration file for batch system. cfg_util will scan the MATLAB % path for cfg_mlbatch_appcfg files and evaluate all of them. cfg = dti_cfg; def = [];
4e26215c61b936bc89699e2a8b8fe37af0997609ae25cf9d1d2deb0943def8e3
MATLAB
201
14
% FileExists(FileName) % % returns 1 if the file exists, 0 otherwise function exists = FileExists_ss(FileName) fp = fopen(FileName, 'r'); if (fp==-1) exists = 0; else fclose(fp); exists = 1; end;
832ca7a7a25a4bce630ba4749e18257ef8dea46adf43589f4e5fe66162d7018a
MATLAB
201
6
function y = cvx_id( x ) y = x.id_; % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
17642c6dfdee197dc1c7e4b07279af3dcf0f5f1ad4f6e1b76028a9207d6e4ba8
MATLAB
202
6
function y = name( x ) y = x.name_; % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
485b4d5dcd86b4640138f628d20197debfa42e76fc34a15614cb4fdcba11fe9d
MATLAB
202
25
function runningOctave = isOctave() % Returns whether this code has been run using Octave or MATLAB try OCTAVE_VERSION; runningOctave = 1; catch runningOctave = 0; end
d430a8d1bdf80193c2551e36b5e3d867597deccb07e10825ebd620b6f06f1e90
MATLAB
202
8
% Local Regression and Likelihood, Figure 2.2. % % Using different smoothing parameters. load ethanol; fit = locfit(E,NOx,'alpha',0.5); figure('Name', 'figure2_2: Smoothing parameters' ); lfplot(fit);
d1c42abb6f16517575fabb93a96167c4a895120eb79ca30e0335d574726c459f
MATLAB
203
5
function plot_head_dir(self) % Plots the head direction vector on the current axis line(CMBHOME.Utils.ContinuizeEpochs(self.ts), CMBHOME.Utils.ContinuizeEpochs(self.headdir), 'Color', 'k'); end
0e29411adf1b13bf9ceb4cb1cc150b792f108d86cb5cd830e3a324fe31a87249
MATLAB
204
10
function [ outputD ] = subfun_merge_bil2uni( inputD ) if size(inputD,2)>1 outputD = (inputD(:,1:end/2)+inputD(:,end/2+1:end))/2; else outputD = (inputD(1:end/2)+inputD(end/2+1:end))/2; end end
6e50f90b90d18a9c0d90b389c4aab4ecdec9465c0b96bc1e30e9517fde6dc60a
MATLAB
204
6
function y = cvx_getdual( x ) y = []; % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
0852ce11571c498efc4b334975c458666e710e5b45083f66c4ac79c18824ab7c
MATLAB
206
6
function v = cvx_value( x ) v = x; % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
281f23e8f64f20994418e14cd029f9c939759065c8be7d58af04fc59c95cf273
MATLAB
207
6
function y = cvx_basis( x ) y = x.basis_; % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
c2977e366a5a459cc31b4e54d4120d8df6a74389fa4044d459c9a781c60b2fd9
MATLAB
207
6
function z = ne( x, y ) z = ~eq( x, y ); % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
9be973567c4b26c85bb8a31e0f0e40e4adfc4bf84e4a0ef01942c53b2592b49a
MATLAB
208
5
% Example from <a href="http://stanford.edu/~boyd/papers/l1_trend_filter.html">l1 Trend Filtering</a> % % l1_trend_filter_snp500.m - l1 trend filtering % snp500.txt - (no title) help Contents
b9ee12a136281ccb50a0e472e6dc1be2c976aacb5ddc86814bfb8b8d9c51d3d8
MATLAB
208
6
function z = cvx_getdual( x ) z = x.dual_; % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
cfb9539ecf45373c003a856c1e0a953ff399c444e4bfcc429edac5ebfc8177f3
MATLAB
208
6
function x = cvx_getdual( x ) x = x.dual_; % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
23b2f0ef2bec16e779d85c6e3a3d4cef06c61bdacfcf1d03b4f21fcd96f63d9b
MATLAB
209
11
function k = mygausskernel( std , nstds ) maxi = round(std * nstds); a = [ normpdf(0,0,std) zeros(1,maxi) ]; for i = 1 : maxi a(1+i) = normpdf( i , 0 , std ); end k = [ a(end:-1:2) a ]; k = k / sum(k);
e0295fda9ff0dcca95773bfb70990a91f25a690ab1d1f684260d3fe6b88cec8d
MATLAB
209
6
function v = cvx_value( x ) v = value( x ); % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
fb212b133c038cb940e4164bdb400bf980d5fdba5fe5523e355667dfdcad927f
MATLAB
209
6
function y = inuse( x ) y = ~isempty( x ); % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
2f39dcbf8121a7de79e857b6fcc6c98c0e10a4892bbbf9f55d391641e4525959
MATLAB
210
6
function y = index( x ) y = x.index_; % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.
9f6c432d9bd7b4a8410478cf5daf09bea48cda9034792c6c80ee90e74f0c5888
MATLAB
210
13
function y = fitted(fit) % Fitted values from a locfit object. % % Input arguments: % fit - the locfit() fit. % % Author: Catherine Loader. z = predict(fit,'d','restyp','fit'); y = backtr(z,fit); return;
f3b81db0e7c22f32db868dc9b9d155c66a4723c85defaf7d5c62544669e6632f
MATLAB
210
12
import client.EEGLABChat; import client.VisualToolbar; import java.awt.*; import javax.swing.*; tb = VisualToolbar(); F = gcf; tb.setPreferredSize(Dimension(0, 75)); javacomponent(tb,'South',F); refresh(F);
2103af4e1cc71b64488df2aee3eff5baf3ce27182861b448887aaddf21d73fdc
MATLAB
211
6
function y = cvx_id( x ) %#ok y = -Inf; % Copyright 2005-2016 CVX Research, Inc. % See the file LICENSE.txt for full copyright information. % The command 'cvx_where' will show where this file is located.