MATLAB Examples

Using the Google Toolbox

By Matthew Simoneau

This is a basic introduction to the Google Toolbox, available on the MATLAB Central File Exchange:



Download this submission and put the M-files on your MATLAB path. One way to do this is to add the directory containing them with ADDPATH. For more information on ADDPATH, see

cd P:\Matthew_Simoneau\google

Go to and download the developer's kit. Unzip the download and copy googleapi.jar to a convenient place.

zipUrl = '';

Add JAR file to your Java classpath. On older versions of MATLAB, you need to modify toolbox/local/classpath.txt, but on newer versions you can use JAVAADDPATH. For more info, see

%edit classpath.txt

Back at Google's site,, create a Google account. You'll just need to give them your e-mail address so they can validate it and send you an access key.

web -browser

Before using the functions, set the key in your preferences:

%key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';

Finding Pages about MATLAB

Now use GOOGLESEARCH to get information about a search for "matlab".

s = googlesearch('matlab',30);
                ResultElements: [1x30 struct]
                   SearchQuery: 'matlab'
                    StartIndex: 1
                      EndIndex: 30
             DocumentFiltering: 0
    EstimatedTotalResultsCount: 28700000
               EstimateIsExact: 0
                SearchComments: ''
                    SearchTime: 0.2681
                    SearchTips: ''
           DirectoryCategories: []


for i = 1:s.EndIndex
    % Strip HTML from the title.
    title = s.ResultElements(i).Title;
    title = regexprep(title,'<\/?b>','');
    title = strrep(title,'&gt;','>');
    title = strrep(title,'&lt;','<');
    title = regexprep(title,'&#(\d+);','${char(str2double($1))}');
    title = strrep(title,'&amp;','&');

    % Display the title and URL for each page.
    fprintf('%4.0f) %s\n      %s\n\n', ...
   1) The MathWorks - MATLAB and Simulink for Technical Computing

   2) MATLAB

   3) MATLAB

   4) The MathWorks - Online Documentation, R2006a

   5) MATLAB

   6) The MathWorks - Academia

   7) Matlab

   8) MATLAB Summary and Tutorial

   9) Matlab Primer

  10) A Practical Introduction to MATLAB

  11) : MATLAB


  13) MATLAB

  14) The MathWorks - Student Version - MATLAB Student Version

  15) The MathWorks - Products & Services

  16) The MathWorks - MATLAB® - The Language of Technical Computing

  17) The MathWorks - MATLAB and Simulink for Technical Computing

  18) The MathWorks - MATLAB Central - File Exchange

  19) MATLAB Central

  20) Matlab - Indiana University

  21) Matlab Tutorial

  22) The MathWorks - Support

  23) MATLAB

  24) The MathWorks - Product Listing - Products by Category

  25) The MathWorks - MATLAB® 7.2 - Requirements

  26) MATLAB Functions

  27) MATLAB Help Desk

  28) Control Tutorials for MATLAB

  29) MATLAB - Wikipedia, the free encyclopedia

  30) MATLAB - Wikipedia, the free encyclopedia

Opening Up a Web Page

Use FEELINGLUCKY to jump straight to the first hit for "MathWorks".

feelinglucky MathWorks