Skip to content

Instantly share code, notes, and snippets.

@neurojojo
Last active July 31, 2022 13:44
Show Gist options
  • Save neurojojo/1747bd4bff0795672ffe26a30cbfffae to your computer and use it in GitHub Desktop.
Save neurojojo/1747bd4bff0795672ffe26a30cbfffae to your computer and use it in GitHub Desktop.
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