<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Finding Patterns in Arrays</title>
	<link>http://blogs.mathworks.com/loren/2008/09/08/finding-patterns-in-arrays/</link>
	<description>Loren Shure  works on design of the MATLAB language at &#60;a href="http://www.mathworks.com/"&#62;The MathWorks&#60;/a&#62;. She writes here about once a week on MATLAB programming and related topics. &#60;br&#62;&#60;br&#62;&#60;a href="/images/loren-full.jpg"&#62;&#60;img src="/images/loren.jpg"&#62;&#60;/a&#62;</description>
	<pubDate>Sun, 08 Nov 2009 05:43:24 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2008/09/08/finding-patterns-in-arrays/#comment-30605</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Mon, 14 Sep 2009 11:27:17 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2008/09/08/finding-patterns-in-arrays/#comment-30605</guid>
		<description>Rameez-

That's not the sort of pattern I was testing here initially.  What I would do with your situation is something like this.  Convert the array to logicals, where true represents data in the correct range.  Then look for a long-enough string on true values.  Get that index.  Voila.

--Loren</description>
		<content:encoded><![CDATA[<p>Rameez-</p>
<p>That&#8217;s not the sort of pattern I was testing here initially.  What I would do with your situation is something like this.  Convert the array to logicals, where true represents data in the correct range.  Then look for a long-enough string on true values.  Get that index.  Voila.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rameez Khan</title>
		<link>http://blogs.mathworks.com/loren/2008/09/08/finding-patterns-in-arrays/#comment-30604</link>
		<dc:creator>Rameez Khan</dc:creator>
		<pubDate>Mon, 14 Sep 2009 11:22:48 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2008/09/08/finding-patterns-in-arrays/#comment-30604</guid>
		<description>Hello,

Nice blog, and it proved quite useful to me as a student. 

I have a query, that if I am not sure of the exact no. of values that may occur for a range based pattern, then how will it may be done.

for. e.g.

I need to check for a pattern whose values may be between -3.7 to +3.7 and the no. of values in between them too aren't fixed as well. 

I have data from accelerometer against time. Which reads at 100Hz. So, I have alot data of the form for e.g:

time = [0.0000 0.0001 0.0002 0.0003 0.0004 0.0005 0.0006 0.0007 0.0008 0.0009.. ]
and
acc  = [ 2.345 3.345 6.454 6.545 -3.5 1.5 2.6 6 2.5 99 32 -3.7 1.3 -2 2.7 ... ]

Now I want to check for a pattern of values which stays between -3.7 to + 3.7 for a duration  0.05 seconds or greater not less that 0.05 seconds. I want of find the start and end time of the pattern.

thanks and kind regards,

/Rameez.</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>Nice blog, and it proved quite useful to me as a student. </p>
<p>I have a query, that if I am not sure of the exact no. of values that may occur for a range based pattern, then how will it may be done.</p>
<p>for. e.g.</p>
<p>I need to check for a pattern whose values may be between -3.7 to +3.7 and the no. of values in between them too aren&#8217;t fixed as well. </p>
<p>I have data from accelerometer against time. Which reads at 100Hz. So, I have alot data of the form for e.g:</p>
<p>time = [0.0000 0.0001 0.0002 0.0003 0.0004 0.0005 0.0006 0.0007 0.0008 0.0009.. ]<br />
and<br />
acc  = [ 2.345 3.345 6.454 6.545 -3.5 1.5 2.6 6 2.5 99 32 -3.7 1.3 -2 2.7 &#8230; ]</p>
<p>Now I want to check for a pattern of values which stays between -3.7 to + 3.7 for a duration  0.05 seconds or greater not less that 0.05 seconds. I want of find the start and end time of the pattern.</p>
<p>thanks and kind regards,</p>
<p>/Rameez.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Krishna</title>
		<link>http://blogs.mathworks.com/loren/2008/09/08/finding-patterns-in-arrays/#comment-30464</link>
		<dc:creator>Krishna</dc:creator>
		<pubDate>Sat, 11 Jul 2009 10:19:13 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2008/09/08/finding-patterns-in-arrays/#comment-30464</guid>
		<description>TRY strmatch.

Test how fast it can be</description>
		<content:encoded><![CDATA[<p>TRY strmatch.</p>
<p>Test how fast it can be</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2008/09/08/finding-patterns-in-arrays/#comment-29769</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Wed, 24 Sep 2008 13:44:57 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2008/09/08/finding-patterns-in-arrays/#comment-29769</guid>
		<description>Han-

Thanks for the comments.  The reason I type out the code for findpattern in the blog is so you can copy it to run the example.  I don't know of a way, with grabcode, to get ancillary files.

I'm not sure what you mean about adding the referenced, not built-in functions.  Perhaps an example would help me out here.  But again, grabcode only grabs the code for the published file itself.

--Loren</description>
		<content:encoded><![CDATA[<p>Han-</p>
<p>Thanks for the comments.  The reason I type out the code for findpattern in the blog is so you can copy it to run the example.  I don&#8217;t know of a way, with grabcode, to get ancillary files.</p>
<p>I&#8217;m not sure what you mean about adding the referenced, not built-in functions.  Perhaps an example would help me out here.  But again, grabcode only grabs the code for the published file itself.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Han Geerligs</title>
		<link>http://blogs.mathworks.com/loren/2008/09/08/finding-patterns-in-arrays/#comment-29768</link>
		<dc:creator>Han Geerligs</dc:creator>
		<pubDate>Wed, 24 Sep 2008 13:23:02 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2008/09/08/finding-patterns-in-arrays/#comment-29768</guid>
		<description>Hi Loren,

a little off-topic: I tried to grab the matlab-code and repeat to publish this blog. 
Unfortunately I was missing the code for the functions findpattern.
Is this a known issue for you? And further: how about adding the referenced (not built-in) functions in the code? Same goes for using existing workspace variables: they could be recreated in the code as well.

keep up the good work, Han</description>
		<content:encoded><![CDATA[<p>Hi Loren,</p>
<p>a little off-topic: I tried to grab the matlab-code and repeat to publish this blog.<br />
Unfortunately I was missing the code for the functions findpattern.<br />
Is this a known issue for you? And further: how about adding the referenced (not built-in) functions in the code? Same goes for using existing workspace variables: they could be recreated in the code as well.</p>
<p>keep up the good work, Han</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: matt fig</title>
		<link>http://blogs.mathworks.com/loren/2008/09/08/finding-patterns-in-arrays/#comment-29754</link>
		<dc:creator>matt fig</dc:creator>
		<pubDate>Thu, 11 Sep 2008 20:53:51 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2008/09/08/finding-patterns-in-arrays/#comment-29754</guid>
		<description>Hello,

I continue to be impressed with the gains Matlab has made in speeding up loops.  I solved this problem using a brute force loop written for the JIT, and it is only 3 times slower than findPattern2.m for a random vector the same length as rawdata.  This is obviously faster than findpattern.m.  
I then mexed the function and it is now faster than strfind and findPattern2.  Neat puzzle.</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>I continue to be impressed with the gains Matlab has made in speeding up loops.  I solved this problem using a brute force loop written for the JIT, and it is only 3 times slower than findPattern2.m for a random vector the same length as rawdata.  This is obviously faster than findpattern.m.<br />
I then mexed the function and it is now faster than strfind and findPattern2.  Neat puzzle.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2008/09/08/finding-patterns-in-arrays/#comment-29753</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Tue, 09 Sep 2008 15:48:25 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2008/09/08/finding-patterns-in-arrays/#comment-29753</guid>
		<description>As an aside to Daniel's solution, that wouldn't work for Jeff's cawse, because the images between the tags are compressed .jpg.  So he writes out each found jpg and then reads them in for real using imread.

--Loren</description>
		<content:encoded><![CDATA[<p>As an aside to Daniel&#8217;s solution, that wouldn&#8217;t work for Jeff&#8217;s cawse, because the images between the tags are compressed .jpg.  So he writes out each found jpg and then reads them in for real using imread.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2008/09/08/finding-patterns-in-arrays/#comment-29752</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Tue, 09 Sep 2008 12:47:03 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2008/09/08/finding-patterns-in-arrays/#comment-29752</guid>
		<description>Daniel-

Interestingly, strread seems to care that the data are really in a string, unlike strfind.

--Loren</description>
		<content:encoded><![CDATA[<p>Daniel-</p>
<p>Interestingly, strread seems to care that the data are really in a string, unlike strfind.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2008/09/08/finding-patterns-in-arrays/#comment-29751</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Tue, 09 Sep 2008 11:53:22 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2008/09/08/finding-patterns-in-arrays/#comment-29751</guid>
		<description>One more note of interest.  Yesterday I tried a different use case where the pattern to find was present much more often than for the case of the separated images.  In that case, strfind was 5 times faster than my code, instead of 2 times slower.

So, some of the performance depends very much on what the data landscape is like and what the expectations are for different conditions, e.g., lots of found patterns vs. a few.

--Loren</description>
		<content:encoded><![CDATA[<p>One more note of interest.  Yesterday I tried a different use case where the pattern to find was present much more often than for the case of the separated images.  In that case, strfind was 5 times faster than my code, instead of 2 times slower.</p>
<p>So, some of the performance depends very much on what the data landscape is like and what the expectations are for different conditions, e.g., lots of found patterns vs. a few.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2008/09/08/finding-patterns-in-arrays/#comment-29750</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Tue, 09 Sep 2008 11:24:21 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2008/09/08/finding-patterns-in-arrays/#comment-29750</guid>
		<description>Daniel-

You can use non-string inputs to sprintf for printing out numbers, etc.  But strcmp, for example, expects string inputs.  If not, you get an automatic false for the answer.

Nice algorithm for getting the images in this case.  You could rewrite it so it didn't require you to know up front how many there were without much more code.

--Loren</description>
		<content:encoded><![CDATA[<p>Daniel-</p>
<p>You can use non-string inputs to sprintf for printing out numbers, etc.  But strcmp, for example, expects string inputs.  If not, you get an automatic false for the answer.</p>
<p>Nice algorithm for getting the images in this case.  You could rewrite it so it didn&#8217;t require you to know up front how many there were without much more code.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
</channel>
</rss>
