-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPath.m
More file actions
40 lines (31 loc) · 1.15 KB
/
Path.m
File metadata and controls
40 lines (31 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
classdef Path
methods(Static)
% Combines two paths into one
function combinedPath = Combine(pathPart1, pathPart2)
%METHOD1 Summary of this method goes here
% Detailed explanation goes here
combinedPath = [char(pathPart1) filesep char(pathPart2)];
end
function fileName = GetFileName(path)
[~, fileName, ~] = fileparts(char(path));
end
function extension = GetExtension(path)
[~, ~, extension] = fileparts(path);
end
function directory = GetDirectory(path)
[directory, ~, ~] = fileparts(char(path));
end
function directoryName = GetDirectoryName(path)
splitted = strsplit(Path.GetDirectory(path), filesep);
directoryName = splitted(length(splitted));
end
function result = IsJpgFile(fileName)
extension = Path.GetExtension(char(fileName));
if extension == ".JPG" || extension == ".jpg"
result = true;
else
result = false;
end
end
end
end