It is a hard day, because I always sleep over the mid night. Ok, it’s about text mining. We want search from the data that has a particular family name, for example, may name, rahmadya trias handayanto. Ok, because our data usually cell type (for database), use this kind of data type:
name={‘rahmadya trias handayanto’}
We use symbol { for creating a cell type that we always find in table format. The logic for searching my lastname is by finding the last space. Try using the regular expression.
index=regexp(name,’ ‘)
Don’t forget to type space between ‘ because we want to search the index of space for name. Type celldisp(index) to see the content of index, because it is cell type. Many people have more than two names, with middle name. So we have to choose the biggest index using function max.
bigindex=max(index{1})
We have to convert the name into character if we want to present the last name using char function.
charname=char(name);
key=charname(bigindex+1:end)
We use ‘+1’ because we don’t include space to our last name. You can see the instruction below, it is very easy.