Hi ! While I look through the code that includes class, I found that variable 'self' behaves like 'preserved' variable.
For example...
classdef Vocabulary < handle
properties
words = {};
end
methods
function add_word(self, word, audio_signals)
new_word = Word(word);
new_word.train(extract_features(cell2mat(audio_signals)'));
self.words.(char(word)) = new_word;
end
add_word function has 3 arguments including 'self' argument. But this function is called with only 2 arguments, like 'add_word(word_labels(~~~), train_audio_signals(~~~))'.
Not only the 'add_word' fucntion, but also the other functions use similar way.
Can anyone tell me the usage of variable 'self'?
I really appreciate your help !
0 Comments
Sign in to comment.