Last active
July 31, 2022 13:44
-
-
Save neurojojo/1747bd4bff0795672ffe26a30cbfffae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
classdef fileclass | |
properties | |
Filename | |
Size | |
end | |
methods | |
function obj = fileclass(inputfile) | |
obj.Filename = inputfile; | |
info = dir( obj.Filename ); | |
obj.Size = info.bytes; | |
end | |
function summary(obj) | |
fprintf('File is named %s and has size %1.2f kilobytes\n',obj.Filename,obj.Size/1000); | |
end | |
function tf = lt(obj1,obj2) | |
if obj1.Size < obj2.Size | |
fprintf('%s is smaller than %s\n',obj1.Filename,obj2.Filename); | |
else | |
fprintf('%s is smaller than %s\n',obj2.Filename,obj1.Filename); | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment