Function with two input arguments to do the following actions?? - Homework
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Nora
am 10 Nov. 2013
Kommentiert: Nora
am 10 Nov. 2013
This function will have two inputs, a path of a directory file and a file extension.
For example: 'C:\lime\green' and 'pdf'
The function will need to :
1. Find the total number of files with the given file extension
2. Find the name and size of the largest file with the given extension
3. name and size of the smallest files with the given extension in this folder
4. Return the names of all files with this extension that are in the folder.
What I have is still a work in progress:
function FolderInfo( path,fext )
D = dir(path);
% 18 1
[~, c] = size(D);
cell = struct2cell(D);
cn = 0;
for i = c
s1 = cell(1,i);
if s1(end-3) == fext
cn = cn + 1;
cs{cn}=str;
end
end
fprintf('THERE ARE A TOTAL OF %.1f FILES IN FOLDER.',length(D));
fprintf('%s WITH EXTENSION %s',path,fext);
celldisp(cs);
end
Please comment on why you do the changes you do. Thank you.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 10 Nov. 2013
3 Kommentare
Walter Roberson
am 10 Nov. 2013
You have entries that are shorter 2 characters long or shorter. Every directory has an entry named "." and another named ".."
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Search Path finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!