📄 fpatdemo.html
字号:
<html xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!--This HTML is auto-generated from an M-file.To make changes, update the M-file and republish this document. --> <title>fpatdemo</title> <meta name="generator" content="MATLAB 7.0.1"> <meta name="date" content="2004-10-25"> <meta name="m-file" content="fpatdemo"><style>body { background-color: white; margin:10px;}h1 { color: #990000; font-size: x-large;}h2 { color: #990000; font-size: medium;}p.footer { text-align: right; font-size: xx-small; font-weight: lighter; font-style: italic; color: gray;}pre.codeinput { margin-left: 30px;}span.keyword {color: #0000FF}span.comment {color: #228B22}span.string {color: #A020F0}span.untermstring {color: #B20000}span.syscmd {color: #B28C00}pre.showbuttons { margin-left: 30px; border: solid black 2px; padding: 4px; background: #EBEFF3;}pre.codeoutput { color: gray; font-style: italic;}pre.error { color: red;}/* Make the text shrink to fit narrow windows, but not stretch too far in wide windows. On Gecko-based browsers, the shrink-to-fit doesn't work. */ p,h1,h2,div { /* for MATLAB's browser */ width: 600px; /* for Mozilla, but the "width" tag overrides it anyway */ max-width: 600px; /* for IE */ width:expression(document.body.clientWidth > 620 ? "600px": "auto" );} </style></head> <body><pre class="codeinput"><span class="comment">% FPAT</span><span class="comment">% Schwarz, Shoelson & Amphlett</span><span class="comment">% CSSM / 2004</span><span class="comment">% let us create two objects</span> objA=zeros(10,9); objA(4:6,6:8)=magic(3); objB={ <span class="string">'....v....x....v....x....v'</span> <span class="comment">% row 1: col finder</span> <span class="string">'a good BRETT'</span> <span class="comment">% row 2</span> <span class="string">'a bad BrrrRETt'</span> <span class="comment">% row 3</span> <span class="string">'a wide B R E T T'</span> <span class="comment">% row 4</span> <span class="string">'a shaky B RET T'</span> <span class="comment">% row 5</span> <span class="string">'a noisy bbB rRxy EeTTtTt'</span> <span class="comment">% row 6</span> <span class="string">'a wrapped BR'</span> <span class="comment">% row 7</span> <span class="string">'ET '</span> <span class="comment">% row 8</span> <span class="string">'T'</span> <span class="comment">% row 9</span> };<span class="comment">% ...and some search templates</span> tmplA=magic(3); tmplX=<span class="string">'BRETT'</span>; tmplY=<span class="string">'B RE'</span>; tmplZ=<span class="string">'B R E'</span>;<span class="comment">% search for patterns</span> resA=fpat(tmplA,objA,<span class="string">'-s'</span>); resX=fpat(tmplX,objB); resY=fpat(tmplY,objB); resZ=fpat(tmplZ,objB,<span class="string">'-mrg'</span>);<span class="comment">% ...and show matches</span> resX resY resZ rowZ=resZ.row colZ=resZ.col resA parX=resX.par</pre><pre class="codeoutput">resX = magic: 'FPAT' ver: '25-Oct-2004 20:21:42' time: '25-Oct-2004 20:50:11' runtime: 0.047 par: [1x1 struct] mode: 'ALL patterns' npat: 5 isexact: [1 0 0 0 0] ismatch: [1 0 0 0 0] iswrap: [0 0 0 0 1] isolap: [0 0 0 0 0] patlen: [5 9 8 11 24] rowbeg: [2 4 5 6 7] rowend: [2 4 5 6 9] colbeg: [8 8 9 11 11] colend: [12 16 16 21 1] matches: {5x1 cell}resY = magic: 'FPAT' ver: '25-Oct-2004 20:21:42' time: '25-Oct-2004 20:50:11' runtime: 0 par: [1x1 struct] mode: 'ALL patterns' npat: 1 isexact: 1 ismatch: 1 iswrap: 0 isolap: 0 patlen: 4 rowbeg: 5 rowend: 5 colbeg: 9 colend: 12 matches: {'B RE'}resZ = magic: 'FPAT' ver: '25-Oct-2004 20:21:42' time: '25-Oct-2004 20:50:11' runtime: 0.016 par: [1x1 struct] mode: 'ALL patterns' npat: 2 isexact: [1 0] ismatch: [1 0] iswrap: [0 0] isolap: [0 0] patlen: [5 8] row: [2x2 uint32] col: [2x2 uint32] matches: {2x1 cell}rowZ = 4 6 4 6colZ = 8 11 12 18resA = magic: 'FPAT' ver: '25-Oct-2004 20:21:42' time: '25-Oct-2004 20:50:11' runtime: 0.047 par: [1x1 struct] mode: 'ALL patterns' npat: 1 isexact: 0 ismatch: 0 iswrap: 1 isolap: 0 patlen: 21 rowbeg: 4 rowend: 6 colbeg: 6 colend: 8 matches: []parX = mos: '7.0.1.24704 (R14) Service Pack 1' rel: 14 exactflg: 0 matchflg: 0 nolapflg: 0 mrgflg: 0 ixflg: 0 sflg: 0 iclass: @uint32 template: 'BRETT' tclass: 'char' tlen: 5 tnan: [1x1 char] oclass: 'cell' osize: [9 1] sclass: 'char' ssize: [1 141]</pre><p class="footer"><br> Published with MATLAB® 7.0.1<br></p> <!--##### SOURCE BEGIN #####% FPAT
% Schwarz, Shoelson & Amphlett
% CSSM / 2004
% let us create two objects
objA=zeros(10,9);
objA(4:6,6:8)=magic(3);
objB={
'....v....x....v....x....v' % row 1: col finder
'a good BRETT' % row 2
'a bad BrrrRETt' % row 3
'a wide B R E T T' % row 4
'a shaky B RET T' % row 5
'a noisy bbB rRxy EeTTtTt' % row 6
'a wrapped BR' % row 7
'ET ' % row 8
'T' % row 9
};
% ...and some search templates
tmplA=magic(3);
tmplX='BRETT';
tmplY='B RE';
tmplZ='B R E';
% search for patterns
resA=fpat(tmplA,objA,'-s');
resX=fpat(tmplX,objB);
resY=fpat(tmplY,objB);
resZ=fpat(tmplZ,objB,'-mrg');
% ...and show matches
resX
resY
resZ
rowZ=resZ.row
colZ=resZ.col
resA
parX=resX.par##### SOURCE END #####--> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -