<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: MATLAB Basics: Getting a directory listing</title>
	<atom:link href="http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/</link>
	<description>&#60;a href=&#34;http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1093599&#38;objectType=author&#34;&#62;Brett&#60;/a&#62; &#38; &#60;a href=&#34;http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1094142&#38;objectType=author&#34;&#62;Jiro&#60;/a&#62; share favorite user-contributed submissions from the File Exchange.</description>
	<lastBuildDate>Fri, 10 Feb 2012 16:12:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: sunny</title>
		<link>http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/#comment-14286</link>
		<dc:creator>sunny</dc:creator>
		<pubDate>Sat, 29 Oct 2011 16:40:27 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/#comment-14286</guid>
		<description>Hi,

I have a simple question, I would like to extract the directory name from the file path given.
For eg: getDir(&#039;../testDir/test.dat&#039;);

i want to get back only the dir name in this case &#039;../testDir/&#039;. 
Is there a way to do it in matlab.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I have a simple question, I would like to extract the directory name from the file path given.<br />
For eg: getDir(&#8216;../testDir/test.dat&#8217;);</p>
<p>i want to get back only the dir name in this case &#8216;../testDir/&#8217;.<br />
Is there a way to do it in matlab.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jc</title>
		<link>http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/#comment-14256</link>
		<dc:creator>jc</dc:creator>
		<pubDate>Tue, 04 Oct 2011 23:10:15 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/#comment-14256</guid>
		<description>I would like to find tiff images within several folders. Once located, I want to copy them in a new directory. Is there a short way to do this?</description>
		<content:encoded><![CDATA[<p>I would like to find tiff images within several folders. Once located, I want to copy them in a new directory. Is there a short way to do this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhusudan</title>
		<link>http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/#comment-14227</link>
		<dc:creator>madhusudan</dc:creator>
		<pubDate>Tue, 06 Sep 2011 10:32:13 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/#comment-14227</guid>
		<description>my mmreader is not working also the problem is aviread is giving warnings and not playing larger average quality video</description>
		<content:encoded><![CDATA[<p>my mmreader is not working also the problem is aviread is giving warnings and not playing larger average quality video</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Katz</title>
		<link>http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/#comment-14189</link>
		<dc:creator>Mike Katz</dc:creator>
		<pubDate>Tue, 12 Jul 2011 13:35:56 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/#comment-14189</guid>
		<description>@Anne,

 You can take advantage of the DIR function which lists all files/folders in the directory and eliminate the non directories:
&lt;pre&gt;
x = dir;
justdirs = x([x.isdir])
dirnames = {justdirs.name}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@Anne,</p>
<p> You can take advantage of the DIR function which lists all files/folders in the directory and eliminate the non directories:</p>
<pre>
x = dir;
justdirs = x([x.isdir])
dirnames = {justdirs.name}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anne Rionta</title>
		<link>http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/#comment-14188</link>
		<dc:creator>Anne Rionta</dc:creator>
		<pubDate>Tue, 12 Jul 2011 12:52:01 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/#comment-14188</guid>
		<description>I&#039;ve been trying to list only the folders in the path, that is to say, I want to exclude files and just list the folders.

I have been able to do this using the unix command line from matlab using:

[Status,Folders]=unix(&#039;ls -d */&#124; grep -v private&#039;);

However, I would like my scripts to be portable to windows systems so I would like to find a native solution in matlab.

Any ideas?

Thanks in advance,</description>
		<content:encoded><![CDATA[<p>I&#8217;ve been trying to list only the folders in the path, that is to say, I want to exclude files and just list the folders.</p>
<p>I have been able to do this using the unix command line from matlab using:</p>
<p>[Status,Folders]=unix(&#8216;ls -d */| grep -v private&#8217;);</p>
<p>However, I would like my scripts to be portable to windows systems so I would like to find a native solution in matlab.</p>
<p>Any ideas?</p>
<p>Thanks in advance,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: D</title>
		<link>http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/#comment-14085</link>
		<dc:creator>D</dc:creator>
		<pubDate>Wed, 30 Mar 2011 10:59:23 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/#comment-14085</guid>
		<description>The naming system of this function is an epic fail.

For example it takes as 2190 is smaller than 920. Because it is starting with 2!</description>
		<content:encoded><![CDATA[<p>The naming system of this function is an epic fail.</p>
<p>For example it takes as 2190 is smaller than 920. Because it is starting with 2!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephane hordoir</title>
		<link>http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/#comment-13603</link>
		<dc:creator>stephane hordoir</dc:creator>
		<pubDate>Tue, 08 Jun 2010 14:56:23 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/#comment-13603</guid>
		<description>Thanks a lot Doug !
Your example also works with directories  !</description>
		<content:encoded><![CDATA[<p>Thanks a lot Doug !<br />
Your example also works with directories  !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ShaneAhmed</title>
		<link>http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/#comment-13602</link>
		<dc:creator>ShaneAhmed</dc:creator>
		<pubDate>Sat, 05 Jun 2010 22:32:23 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/#comment-13602</guid>
		<description>The command dir is useful for the current directory.
for example, If I have to open a file which is not in the current directory but located at some path &#039;D:\abc\&#039;, &#039;D;\abcd&#039; and of type .tif
now using the code 
a = dir(&#039;D:\abc\*.tif&#039;) or a = dir(&#039;D:\abcd\*.tif&#039;)
a(1).name only returns the name of the file and not the path 
I will have to append the path with the name using strcat to open it.
I think fileattrib will be more useful here
the following code works for the above problem by sundar

&lt;code&gt;[b, a] = fileattrib(&#039;D:\abc\*.tif&#039;);
if(b)
 S = size(a)
 for i = 1:S(1,2)
  imread(a(i).Name);
 end
end
[b, a] = fileattrib(&#039;D:\abcd\*.tif&#039;);
if(b)
 S = size(a)
 for i = 1:S(1,2)
  imread(a(i).Name);
 end
end&lt;/code&gt;
sundar you can go with the above code</description>
		<content:encoded><![CDATA[<p>The command dir is useful for the current directory.<br />
for example, If I have to open a file which is not in the current directory but located at some path &#8216;D:\abc\&#8217;, &#8216;D;\abcd&#8217; and of type .tif<br />
now using the code<br />
a = dir(&#8216;D:\abc\*.tif&#8217;) or a = dir(&#8216;D:\abcd\*.tif&#8217;)<br />
a(1).name only returns the name of the file and not the path<br />
I will have to append the path with the name using strcat to open it.<br />
I think fileattrib will be more useful here<br />
the following code works for the above problem by sundar</p>
<p><code>[b, a] = fileattrib('D:\abc\*.tif');<br />
if(b)<br />
 S = size(a)<br />
 for i = 1:S(1,2)<br />
  imread(a(i).Name);<br />
 end<br />
end<br />
[b, a] = fileattrib('D:\abcd\*.tif');<br />
if(b)<br />
 S = size(a)<br />
 for i = 1:S(1,2)<br />
  imread(a(i).Name);<br />
 end<br />
end</code><br />
sundar you can go with the above code</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sundar naganathan</title>
		<link>http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/#comment-13601</link>
		<dc:creator>sundar naganathan</dc:creator>
		<pubDate>Thu, 03 Jun 2010 17:13:49 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/#comment-13601</guid>
		<description>Hi
   I have a list of folders and inside each folder i have a list of tif files which I have to process. I am now able to read all the tif files using a combination of &#039;dir&#039; command and &#039;imread&#039; command in a m-file. 
My intention is to go into first folder, read all the tif files, process them, then come out. Then I will have to read the second folder, read all the tif files and process them and so on. Can you tell me how to open a folder and come out of a folder ? Basically I need an alternative for cd command to be used in a m-file.

Thanks
sundar</description>
		<content:encoded><![CDATA[<p>Hi<br />
   I have a list of folders and inside each folder i have a list of tif files which I have to process. I am now able to read all the tif files using a combination of &#8216;dir&#8217; command and &#8216;imread&#8217; command in a m-file.<br />
My intention is to go into first folder, read all the tif files, process them, then come out. Then I will have to read the second folder, read all the tif files and process them and so on. Can you tell me how to open a folder and come out of a folder ? Basically I need an alternative for cd command to be used in a m-file.</p>
<p>Thanks<br />
sundar</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/#comment-13421</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Mon, 08 Feb 2010 15:42:09 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/02/26/matlab-basics-getting-a-directory-listing/#comment-13421</guid>
		<description>Ben,

The name is in the name field as you saw in the video:

files(1).name

will give you just the name of the first file.

Depending on the files you are reading, you would use different functions, like CSVREAD, XLSREAD, IMREAD

What kind of files are you trying to read?

Doug</description>
		<content:encoded><![CDATA[<p>Ben,</p>
<p>The name is in the name field as you saw in the video:</p>
<p>files(1).name</p>
<p>will give you just the name of the first file.</p>
<p>Depending on the files you are reading, you would use different functions, like CSVREAD, XLSREAD, IMREAD</p>
<p>What kind of files are you trying to read?</p>
<p>Doug</p>
]]></content:encoded>
	</item>
</channel>
</rss>

