Can you clarify? Are you having a MATLAB issue, or a general how-to-detect-building issue? This is your thesis, so you probably know more than anyone in the forum how to do the latter. We know more about how to fix MATLAB codes.
I found this article that may be relevant:
"Building Detection Using Enhanced HOG–LBP Features and Region Refinement Processes"