<?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: MATLAB Basics video: Row and Column indexing</title>
	<link>http://blogs.mathworks.com/pick/2007/08/31/matlab-basics-video-row-and-column-indexing/</link>
	<description>&#60;a href="http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=969735&#38;objectType=author"&#62;Bob&#60;/a&#62;, &#60;a href="http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1093599&#38;objectType=author"&#62;Brett&#60;/a&#62; &#38; &#60;a href="http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1094142&#38;objectType=author"&#62;Jiro&#60;/a&#62; share favorite user-contributed submissions from the File Exchange.</description>
	<pubDate>Mon, 23 Nov 2009 00:10:36 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/pick/2007/08/31/matlab-basics-video-row-and-column-indexing/#comment-13079</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Wed, 11 Mar 2009 13:54:34 +0000</pubDate>
		<guid>http://blogs.mathworks.com/pick/2007/08/31/matlab-basics-video-row-and-column-indexing/#comment-13079</guid>
		<description>Waggy,

I think you are on the right path.  Thank you for the kind words.

Doug</description>
		<content:encoded><![CDATA[<p>Waggy,</p>
<p>I think you are on the right path.  Thank you for the kind words.</p>
<p>Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Waggy</title>
		<link>http://blogs.mathworks.com/pick/2007/08/31/matlab-basics-video-row-and-column-indexing/#comment-13072</link>
		<dc:creator>Waggy</dc:creator>
		<pubDate>Mon, 09 Mar 2009 21:43:43 +0000</pubDate>
		<guid>http://blogs.mathworks.com/pick/2007/08/31/matlab-basics-video-row-and-column-indexing/#comment-13072</guid>
		<description>Doug,

Great help again, the reason i choose MATLAB for my project was because i heard you had great support - i truely am impressed!

Just to make sure i'm on the right tracks - I can xlsread the file, returning the text and numeric arrays.  STRMATCH the text array to identify which rows in the numeric array are NEW, UPDATE or DELETE). Then create a new mumeric array with just the matched row data? 

eg.
newparametric = strmatch('new', strvcat(2,:),'exact')

returns each row with 'new' in column 2

Many thanks,

Waggy</description>
		<content:encoded><![CDATA[<p>Doug,</p>
<p>Great help again, the reason i choose MATLAB for my project was because i heard you had great support - i truely am impressed!</p>
<p>Just to make sure i&#8217;m on the right tracks - I can xlsread the file, returning the text and numeric arrays.  STRMATCH the text array to identify which rows in the numeric array are NEW, UPDATE or DELETE). Then create a new mumeric array with just the matched row data? </p>
<p>eg.<br />
newparametric = strmatch(&#8217;new&#8217;, strvcat(2,:),&#8217;exact&#8217;)</p>
<p>returns each row with &#8216;new&#8217; in column 2</p>
<p>Many thanks,</p>
<p>Waggy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/pick/2007/08/31/matlab-basics-video-row-and-column-indexing/#comment-13071</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Mon, 09 Mar 2009 19:38:48 +0000</pubDate>
		<guid>http://blogs.mathworks.com/pick/2007/08/31/matlab-basics-video-row-and-column-indexing/#comment-13071</guid>
		<description>Waggy,

It sounds like you want to read in only rows that meet a specific criteria.  There are two ways to go about this.

* Read everything in, throw out what you do not need.

* Read in the text column, use that to decide what to read in.

Depending on the size of your data, you would make different decisions.  I think it would be easier to code the first.  You would likely use STRMATCH:

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/strmatch.html


This video:

http://blogs.mathworks.com/videos/2007/09/06/matlab-basics-video-absolute-and-logical-indexing/

Especially at time 2:30 does something similar.

If it is impractical to read in all the data, then I would use the second method, get the indices you need to read in, and do them in a loop.  You would again use the above video and STRMATCH to do this.

-Doug</description>
		<content:encoded><![CDATA[<p>Waggy,</p>
<p>It sounds like you want to read in only rows that meet a specific criteria.  There are two ways to go about this.</p>
<p>* Read everything in, throw out what you do not need.</p>
<p>* Read in the text column, use that to decide what to read in.</p>
<p>Depending on the size of your data, you would make different decisions.  I think it would be easier to code the first.  You would likely use STRMATCH:</p>
<p><a href="http://www.mathworks.com/access/helpdesk/help/techdoc/ref/strmatch.html" rel="nofollow">http://www.mathworks.com/access/helpdesk/help/techdoc/ref/strmatch.html</a></p>
<p>This video:</p>
<p><a href="http://blogs.mathworks.com/videos/2007/09/06/matlab-basics-video-absolute-and-logical-indexing/" rel="nofollow">http://blogs.mathworks.com/videos/2007/09/06/matlab-basics-video-absolute-and-logical-indexing/</a></p>
<p>Especially at time 2:30 does something similar.</p>
<p>If it is impractical to read in all the data, then I would use the second method, get the indices you need to read in, and do them in a loop.  You would again use the above video and STRMATCH to do this.</p>
<p>-Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Waggy</title>
		<link>http://blogs.mathworks.com/pick/2007/08/31/matlab-basics-video-row-and-column-indexing/#comment-13068</link>
		<dc:creator>Waggy</dc:creator>
		<pubDate>Sun, 08 Mar 2009 21:06:45 +0000</pubDate>
		<guid>http://blogs.mathworks.com/pick/2007/08/31/matlab-basics-video-row-and-column-indexing/#comment-13068</guid>
		<description>Doug,

I posted a comment recently with reguards to importing Excel data and handling it within an array.  You pointed me to the above tutorials which have been a huge help.  

I have a .xls file with samples (rows) containing various radar parameters (columns) most numeric however some text.  I need to create a GUI (some great video tutorials i've viewed!) that will re-display the table data however filtered i.e. only the UPDATE sample (as identified by a text column). Is this possible within MATLAB or will i need to create a function to convert the text into a numerical reference value?  I have looked into the XLSREAD function but couldn't really decipher exactly how i could use it!

I am very new to MATLAB therefore i hugely appreciate your advice.  

Many thanks,

Waggy</description>
		<content:encoded><![CDATA[<p>Doug,</p>
<p>I posted a comment recently with reguards to importing Excel data and handling it within an array.  You pointed me to the above tutorials which have been a huge help.  </p>
<p>I have a .xls file with samples (rows) containing various radar parameters (columns) most numeric however some text.  I need to create a GUI (some great video tutorials i&#8217;ve viewed!) that will re-display the table data however filtered i.e. only the UPDATE sample (as identified by a text column). Is this possible within MATLAB or will i need to create a function to convert the text into a numerical reference value?  I have looked into the XLSREAD function but couldn&#8217;t really decipher exactly how i could use it!</p>
<p>I am very new to MATLAB therefore i hugely appreciate your advice.  </p>
<p>Many thanks,</p>
<p>Waggy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Davis</title>
		<link>http://blogs.mathworks.com/pick/2007/08/31/matlab-basics-video-row-and-column-indexing/#comment-1898</link>
		<dc:creator>Tim Davis</dc:creator>
		<pubDate>Fri, 14 Sep 2007 12:35:07 +0000</pubDate>
		<guid>http://blogs.mathworks.com/pick/2007/08/31/matlab-basics-video-row-and-column-indexing/#comment-1898</guid>
		<description>That's right; I should have made that more clear.  If you're dealing with modest-sized problems, you won't see this effect.  The danger is when you want to scale up to solve large problems, and you wrongly conclude that MATLAB can't handle large problems.

A grad student at Stanford (Sep Kamvar) asked me why his pagerank-style computations in MATLAB were so exceedingly slow when dealing with a matrix of dimension about 680,000.  He showed me the code, and I saw x=A(i,:) in a loop.  Aha! ... and when it was fixed his run time was cut from maybe an hour to under a minute.  For his matrix, x=A(i,:) takes 0.16 seconds, but x=A(:,i) takes 0.0015 seconds.  If you're curious, you can try it with his matrix at http://www.cise.ufl.edu/research/sparse/matrices/Kamvar/ .

The profiler is a great tool for finding hot spots like this.  It won't help you to figure out why x=A(i,:) is slow and x=A(:,i) is 100's of times faster, though.  It may seem a little mysterious unless you look into how sparse matrices are stored in MATLAB.

Other "gotcha's" like this related to matrix indexing include, for full matrices and sparse alike:

x = [ ] ;
for i = 1:100000
   x (i) = i ;
end

for which mlint is a great tool for suggesting a much faster alternative.  The code above takes 50 seconds; using mlint's suggestion and changing the first line to x=zeros(1,100000); cuts the time to 0.12 seconds (yes, of course I'm just doing x=1:100000; this is just an example).</description>
		<content:encoded><![CDATA[<p>That&#8217;s right; I should have made that more clear.  If you&#8217;re dealing with modest-sized problems, you won&#8217;t see this effect.  The danger is when you want to scale up to solve large problems, and you wrongly conclude that MATLAB can&#8217;t handle large problems.</p>
<p>A grad student at Stanford (Sep Kamvar) asked me why his pagerank-style computations in MATLAB were so exceedingly slow when dealing with a matrix of dimension about 680,000.  He showed me the code, and I saw x=A(i,:) in a loop.  Aha! &#8230; and when it was fixed his run time was cut from maybe an hour to under a minute.  For his matrix, x=A(i,:) takes 0.16 seconds, but x=A(:,i) takes 0.0015 seconds.  If you&#8217;re curious, you can try it with his matrix at <a href="http://www.cise.ufl.edu/research/sparse/matrices/Kamvar/" rel="nofollow">http://www.cise.ufl.edu/research/sparse/matrices/Kamvar/</a> .</p>
<p>The profiler is a great tool for finding hot spots like this.  It won&#8217;t help you to figure out why x=A(i,:) is slow and x=A(:,i) is 100&#8217;s of times faster, though.  It may seem a little mysterious unless you look into how sparse matrices are stored in MATLAB.</p>
<p>Other &#8220;gotcha&#8217;s&#8221; like this related to matrix indexing include, for full matrices and sparse alike:</p>
<p>x = [ ] ;<br />
for i = 1:100000<br />
   x (i) = i ;<br />
end</p>
<p>for which mlint is a great tool for suggesting a much faster alternative.  The code above takes 50 seconds; using mlint&#8217;s suggestion and changing the first line to x=zeros(1,100000); cuts the time to 0.12 seconds (yes, of course I&#8217;m just doing x=1:100000; this is just an example).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/pick/2007/08/31/matlab-basics-video-row-and-column-indexing/#comment-1808</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Tue, 11 Sep 2007 20:33:24 +0000</pubDate>
		<guid>http://blogs.mathworks.com/pick/2007/08/31/matlab-basics-video-row-and-column-indexing/#comment-1808</guid>
		<description>Tim gives good advice here.  It should be noted that the kinds of optimizations he is talking about shave small fractions of a second off of a single operation in typical situations. 

These fractions add up though when you are in a loop that gets called many times.  The profiler is very good at helping to identify these places.  See my early videos for use of the profiler.

Doug</description>
		<content:encoded><![CDATA[<p>Tim gives good advice here.  It should be noted that the kinds of optimizations he is talking about shave small fractions of a second off of a single operation in typical situations. </p>
<p>These fractions add up though when you are in a loop that gets called many times.  The profiler is very good at helping to identify these places.  See my early videos for use of the profiler.</p>
<p>Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Davis</title>
		<link>http://blogs.mathworks.com/pick/2007/08/31/matlab-basics-video-row-and-column-indexing/#comment-1805</link>
		<dc:creator>Tim Davis</dc:creator>
		<pubDate>Tue, 11 Sep 2007 20:01:00 +0000</pubDate>
		<guid>http://blogs.mathworks.com/pick/2007/08/31/matlab-basics-video-row-and-column-indexing/#comment-1805</guid>
		<description>One mistake that both new and experienced MATLAB users make is to abuse A(i,j)=x and x=A(i,j) when A is a large sparse matrix.  Both work fine, but they can be very slow in some cases.  x=A(1,:) for example is much slower than x=A(:,1).  There are often better ways to write your code that avoids these slow cases.  For example, if you find yourself needing to do x=A(i,:) a lot, for a matrix A that doesn't change, then transpose A once and do x=A(:,i) instead (your code could be 100x faster as a result).  The sparse matrix data structure in MATLAB is best suited to whole-matrix operations, rather than row and column indexing.

None of this comment applies to full matrices, just sparse.  You don't get sparse matrices unless you ask for them, so if you're a MATLAB newcomer who also has no need for sparse matrices, then please ignore my comment.</description>
		<content:encoded><![CDATA[<p>One mistake that both new and experienced MATLAB users make is to abuse A(i,j)=x and x=A(i,j) when A is a large sparse matrix.  Both work fine, but they can be very slow in some cases.  x=A(1,:) for example is much slower than x=A(:,1).  There are often better ways to write your code that avoids these slow cases.  For example, if you find yourself needing to do x=A(i,:) a lot, for a matrix A that doesn&#8217;t change, then transpose A once and do x=A(:,i) instead (your code could be 100x faster as a result).  The sparse matrix data structure in MATLAB is best suited to whole-matrix operations, rather than row and column indexing.</p>
<p>None of this comment applies to full matrices, just sparse.  You don&#8217;t get sparse matrices unless you ask for them, so if you&#8217;re a MATLAB newcomer who also has no need for sparse matrices, then please ignore my comment.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
