I want an OOP like interface with Matlab, in a way that I have something like
classdef Foo
properties (Constant)
dict = NaN;
end
methods (Static)
function list = search(varargin)
%...
Foo.dict = cell(10,5); % etc..
end
end
end
So I can access and modify the (static) property. How should I set it? Not Constant
I guess..
Update:
My problem is that t9.load();
does not update t9.dict
classdef t9
%T9 Summary of this class goes here
% Detailed explanation goes here
properties% (Static)
dict = {};
end
methods (Static)
function load()
load('usdict.mat');
t9.dict = usdict;
end
function matches = search(varargin)
matches = {};
num_words = nargin-1;
for word=t9.dict(num_words, :)
if strcmp(word,'')
continue;
end
word_cell = word{1};
success = true;
for i=1:num_words
char = word_cell(i);
if ~ismember(char, varargin{i})
success = false;
end
end
if success, matches{end+1} = word_cell; end
end
end
end
end
Wishes:
t9.load();
t9.search('ABC', 'DEF');
t9.search('DEF', 'GHI', 'MNO');