There are papers with algorithms on how to do that. Look here: http://www.visionbib.com/bibliography/contentschar.html#OCR,%20Document%20Analysis%20and%20Character%20Recognition%20Systems at this section:
23.2.2.2 Document Layout, Document Segmentation, Page Layout, Structure Analysis
23.2.2.2.1 Page Segmentation, General Evaluations
23.2.2.2.2 Find Text in Documents
23.2.2.2.3 Text Detection, Find Text in General Scenes, Documents, Scene Text
23.2.2.2.4 Recognize Text from Signs in General Scenes
23.2.2.2.5 Find Text in Video Scenes
23.2.2.2.6 Text vs. Non-Text Regions
23.2.2.2.7 Separate Images and Graphics from Text
23.2.2.2.8 Newspaper Structure Extraction
23.2.2.2.9 Table Segmentation, Extract Tables or Forms, General
23.2.2.2.10 Document Layout, Structure Analysis, Web Documents, Online Documents
Sections 23.2.2.2.6 and 23.2.2.2.7 look particularly relevant to your needs. Pick an algorithm and code it up (I don't have one in MATLAB code to give you, so you'll have to do it yourself).