| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
dir(f,'dirname')
d = dir(...)
dir(f,'dirname') lists the files in the specified directory, dirname, on the FTP server f, where f was created using ftp. If dirname is unspecified, dir lists the files in the current directory of f.
d = dir(...) returns the results in an m-by-1 structure with the following fields for each file:
| Fieldname | Description | Data Type |
|---|---|---|
| name | Filename | char array |
| date | Modification date timestamp | char array |
| bytes | Number of bytes allocated to the file | double |
| isdir | 1 if name is a directory; 0 if not | logical |
| datenum | Modification date as serial date number | char array |
Connect to the MathWorks FTP server and view the contents.
tmw=ftp('ftp.mathworks.com');
dir(tmw)This code returns the following:
README incoming matlab outgoing pub pubs
Save the folder contents to the structure m and view element 5.
m=dir(tmw); close(tmw); m(5)
This code returns:
ans =
name: 'pub'
date: '13-Aug-2008 00:00:00'
bytes: 512
isdir: 1
datenum: 733633![]() | dir | disp | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |