diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index bdb0cab..0000000 --- a/.gitattributes +++ /dev/null @@ -1,17 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 7cae593..0000000 --- a/.gitignore +++ /dev/null @@ -1,55 +0,0 @@ -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# ========================= -# Operating System Files -# ========================= - -# OSX -# ========================= - -.DS_Store -.AppleDouble -.LSOverride - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -# Added manually -MATLp.txt -MATLc.m -funDef_outtakes.txt -defin -inout -defout \ No newline at end of file diff --git a/MATL_spec.pdf b/MATL_spec.pdf index 67d5f53..fefbe05 100644 Binary files a/MATL_spec.pdf and b/MATL_spec.pdf differ diff --git a/funDef.mat b/funDef.mat index ca6bd88..1c5a6e0 100644 Binary files a/funDef.mat and b/funDef.mat differ diff --git a/funDef.txt b/funDef.txt index eea8f5a..2b2b4fe 100644 --- a/funDef.txt +++ b/funDef.txt @@ -23,7 +23,7 @@ Z! 1 1 1 1 1 1 true true out{1} = full(in{1}); convert sparse matrix to full mat " X" 2 inf 3 1 1 1 true true out{1} = repmat(in{:}); replicate and tile array \matlab+repmat+ Y" 2 inf 2 1 1 1 true true out{1} = repelem(in{:}); replicate elements of array \matlab+repelem+ (run-length decoding) -Z" +Z" 1 1 1 1 1 1 true true out{1} = blanks(in{1}); string of blanks \matlab+blanks+ # 1 1 1 0 0 0 false false S_OUT = STACK{end}; STACK(end) = []; output specification specify outputs for next function % The numbers of inputs and outputs for # are not used by the code, but are used for generating the help file X# @@ -359,14 +359,14 @@ O 0 inf 0 1 1 1 true true if numel(in)==0, out{1} = 0; else out{1} = zeros(in{:} XO 1 4 1 1 1 1 true true out{1} = datestr(in{:}); string representation of date \matlab+datestr+ YO 1 6 1 1 1 1 true true out{1} = datenum(in{:}); serial date number \matlab+datenum+ ZO 1 3 1 1 6 1 true true [out{:}] = datevec(in{:}); date components \matlab+datevec+ -P 1 2 1 1 1 1 true true out{1} = flip(in{:}); flip the order of elements \matlab+flip+ -XP 1 2 1 1 1 1 true true out{1} = pdist(in{:}); pairwise distances between points \matlab+pdist+ -YP 2 5 2 1 1 1 true true out{1} = pdist2(in{:}); pairwise distances between two sets of points \matlab+pdist2+ -ZP 2 3 2 1 1 1 true true if numel(in)==2, out{1} = polyval(in{:}); else out{1} = polyval(in{1},in{2},[],in{3}); end evaluate polynomial If $2$ inputs \matlab+p+ and \matlab+x+: \matlab+y=polyval(p,x)+. If $3$ inputs \matlab+p+, \matlab+x+ and \matlab+mu+: \matlab+y=polyval(p,x,[],mu)+ +P 1 2 1 1 1 1 true true out{1} = flip(in{:}); flip the order of elements \matlab+flip+. \sa \matl+XP+ +XP 1 1 1 1 1 1 true true out{1} = flipud(in{:}); flip array in up-down direction \matlab+flipud+. \sa \matl+P+ +YP 0 0 0 1 1 1 true true out{1} = pi; pi \matlab+pi+ +ZP 2 5 2 1 1 1 true true out{1} = pdist2(in{:}); pairwise distances between two sets of points \matlab+pdist2+. Only predefined distance functions are allowed Q XQ YQ -ZQ +ZQ 2 3 2 1 1 1 true true if numel(in)==2, out{1} = polyval(in{:}); else out{1} = polyval(in{1},in{2},[],in{3}); end evaluate polynomial If $2$ inputs \matlab+p+ and \matlab+x+: \matlab+y = polyval(p,x)+. If $3$ inputs \matlab+p+, \matlab+x+ and \matlab+mu+: \matlab+y = polyval(p,x,[],mu)+ R 1 2 1 1 1 1 true true out{1} = triu(in{:}); upper triangular part \matlab+triu+. \sa \matl+XR+. XR 1 1 1 1 1 1 true true out{1} = triu(in{1},1); upper triangular part, above diagonal \matlab+triu(..., 1)+. \sa \matl+R+. YR 1 2 1 1 1 1 true true out{1} = tril(in{:}); lower triangular part \matlab+tril+. \sa \matl+ZR+. @@ -374,14 +374,15 @@ ZR 1 1 1 1 1 1 true true out{1} = tril(in{1},-1); lower triangular part, without S 1 3 1 1 2 1 true true if numel(in)==2 && in{2}<0, in{2}=-in{2}; in{3} = 'descend'; end, [out{:}] = sort(in{:}); sort \matlab+sort+. If $2$ inputs: a negative value of the second input corresponds to descending order XS 1 2 1 1 2 1 true true [out{:}] = sortrows(in{:}); sort rows \matlab+sortrows+ YS 2 3 2 1 1 1 true true out{1} = circshift(in{:}); circular shift \matlab+circshift+ -ZS 1 2 1 1 1 1 true true out{1} = squareform(in{:}); reformat distance matrix between upper triangular and square form \matlab+squareform+ +ZS 1 4 1 1 1 1 true true out{1} = std(in{:}); standard deviation \matlab+std+ T -XT 0 0 0 1 1 1 true true out{1} = pi; pi \matlab+pi+ +XT YT 1 2 2 1 1 1 true true out{1} = toeplitz(in{:}); Toeplitz matrix \matlab+toeplitz+ ZT -U -XU -YU +U 1 1 1 1 1 1 true true out{1} = str2double(in{:}); convert string to double precision value \matlab+str2double+ +XU 1 1 1 1 2 1 true true assert(isempty(regexp(in{1}, '^[^'']*(''[^'']*''[^'']*)*[a-zA-Z]{2}', 'once')), 'MATL:runtime', 'MATL run-time error: content not allowed') convert string matrix to numeric array \matlab+str2num+ with content checking + [out{:}] = str2num(in{:}); +YU 1 2 1 1 1 1 true true out{1} = num2str(in{:}); convert numbers to a string \matlab+num2str+ ZU V XV @@ -392,7 +393,7 @@ XW YW ZW X -XX 2 9 2 1 6 1 true true [out{:}] = regexp(in{:}); match regular expression \matlab+regexp+ +XX 2 9 2 1 6 1 true true if numel(in)==2, in{3} = 'match'; end, [out{:}] = regexp(in{:}); match regular expression \matlab+regexp+. With $2$ inputs: \matlab+regexp(..., ..., 'match')+ YX 3 5 3 1 1 1 true true [out{:}] = regexprep(in{:}); replace string using regular expression \matlab+regexprep+ ZX Y @@ -512,14 +513,13 @@ r 0 inf 0 1 1 1 true true out{1} = rand(in{:}); uniformly distributed pseudorand Xr 0 inf 0 1 1 1 true true if numel(in)==0, in{1} = 1; end; out{1} = randn(in{:}); normally distributed pseudorandom numbers \matlab+randn+ Yr 1 inf 1 1 1 1 true true if numel(in)==1, in{2} = 1; end; out{1} = randi(in{:}); pseudorandom integers from uniform discrete distribution \matlab+randi+. If $1$ input: \matlab+randi(...,1)+ Zr 2 4 2 1 1 1 true true out{1} = randsample(in{:}); random sample \matlab+randsample+. Does not support stream specification -s 1 4 1 1 1 1 true true out{1} = sum(in{:}); sum \matlab+sum+ -Xs 1 3 1 1 1 1 true true out{1} = cumsum(in{:}); cumulative sum \matlab+cumsum+ -Ys 1 2 1 1 1 1 true true out{1} = num2str(in{:}); convert numbers to a string \matlab+num2str+ -Zs 1 4 1 1 1 1 true true out{1} = std(in{:}); standard deviation \matlab+std+ +s 1 4 1 1 1 1 true true out{1} = sum(in{:}); sum \matlab+sum+. \sa \matl+Xs+ +Xs 1 3 1 1 1 1 true true out{1} = sum(in{1},1,in{2:end}); sum along first dimension \matlab+sum(..., 1, ...)+. \sa \matl+s+ +Ys 1 3 1 1 1 1 true true out{1} = cumsum(in{:}); cumulative sum \matlab+cumsum+ +Zs t 0 inf 1 0 0 0 false true out = in; duplicate duplicate elements in stack -Xt 1 1 1 1 1 1 true true out{1} = str2double(in{:}); convert string to double precision value \matlab+str2double+ -Yt 1 1 1 1 2 1 true true assert(isempty(regexp(in{1}, '^[^'']*(''[^'']*''[^'']*)*[a-zA-Z]{2}', 'once')), 'MATL:runtime', 'MATL run-time error: content not allowed') convert string matrix to numeric array \matlab+str2num+ with content checking - [out{:}] = str2num(in{:}); +Xt +Yt Zt 3 3 3 1 1 1 true true [out{:}] = strrep(in{:}); replace substring with another \matlab+strrep+ u 1 4 1 1 3 1 true true [out{:}] = unique(in{:}); unique \matlab+unique+. \sa \matl+Xu+. Xu 1 3 1 1 3 1 true true [out{:}] = unique(in{1},'rows',in{2:end}); unique rows \matlab+unique(...,'rows',...)+. \sa \matl+u+. diff --git a/help.mat b/help.mat index a0f9d20..2312e21 100644 Binary files a/help.mat and b/help.mat differ diff --git a/matl.m b/matl.m index c738efe..8342a94 100644 --- a/matl.m +++ b/matl.m @@ -12,6 +12,7 @@ function matl(varargin) indentCommentText = 1; % number of spaces before actual comment. Default value pOutFile = 'MATLp.txt'; % temporary file for parsed code cOutFile = 'MATLc.m'; % temporary file for compiled code + cOutFileNoExt = regexprep('MATLc.m', '\.m$', ''); % without extension. Needed to run file in olf Matlab versions funDefMasterFile = 'funDef.txt'; % function definition master file funDefMatFile = 'funDef.mat'; % function definition processed file preLitMasterFile = 'preLit.txt'; % master file that defines predefined strings with (key, value) pairs @@ -246,7 +247,8 @@ function matl(varargin) %disp('--') %disp(repmat('-',size(str))) pause end - matl_run(S, pOutFile, cOutFile, []) + matl_run(S, pOutFile, cOutFileNoExt, []) % ...NoExt because a file name without extension is + % needed in old Matlab versions end % Run compiled program in debug mode, if required @@ -255,7 +257,8 @@ function matl(varargin) disp('Press any key to run MATL program in debug mode') pause end - matl_run(S, pOutFile, cOutFile, [S.compileLine]) + matl_run(S, pOutFile, cOutFileNoExt, [S.compileLine]) % ...NoExt because a file name without + % extension is needed in old Matlab versions end diff --git a/matl_compile.m b/matl_compile.m index 051dbd2..cdd307d 100644 --- a/matl_compile.m +++ b/matl_compile.m @@ -48,7 +48,11 @@ appendLines('% Set initial conditions', 0) appendLines('warningState = warning;', 0); appendLines('format compact; format long; warning(''off'',''all'');', 0) % clc -appendLines('rng(''shuffle'')', 0) +if exist('rng', 'file') % in case an old Matlab version is used + appendLines('rng(''shuffle'')', 0) +else + warning('MATL has not been able to seed random number generator') +end appendLines('diary off; delete defout; diary defout', 0) % For arrays with brackets or curly braces: F = false; T = true; appendLines('F = false; T = true;', 0) diff --git a/preLit.mat b/preLit.mat index 0a75da7..566b915 100644 Binary files a/preLit.mat and b/preLit.mat differ diff --git a/preLit.txt b/preLit.txt index 3b28591..7557194 100644 --- a/preLit.txt +++ b/preLit.txt @@ -142,8 +142,6 @@ X8 15 'fro' 16 'Smallest' 17 'Largest' -18 'tomatrix' -19 'tovector' X9 @@ -237,4 +235,6 @@ Y2 5 ['0':'9' 'A':'F'] 11 'aeiou' 12 'AEIOU' -13 'aeiouAEIOU' \ No newline at end of file +13 'aeiouAEIOU' +20 ['Mon';'Tue';'Wed'; 'Thu';'Fri';'Sat'; 'Sun'] +21 [298 302 288 305 289 296 310] \ No newline at end of file