How to access web sites or internet using matlab and make a custom browser using app designer?

This video shows the steps to access the internet and browse web pages using matlab. Towards the later part this video shows to create a custom interface using app designer. In the end it creates/ packages the gui into a matlab app.

We will be glad to hear from you regarding any query, suggestions or appreciations at: programmerworld1990@gmail.com

Source Code:

classdef Web_Browser_MATLAB < matlab.apps.AppBase

% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
GmailButton matlab.ui.control.Button
GoogleButton matlab.ui.control.Button
YoutubeButton matlab.ui.control.Button
MathWorksButton matlab.ui.control.Button
Button5 matlab.ui.control.Button
end

% Callbacks that handle component events
methods (Access = private)

% Button pushed function: GmailButton
function GmailButtonPushed(app, event)
web(‘gmail.com’);
end

% Button pushed function: GoogleButton
function GoogleButtonPushed(app, event)
web(‘google.com’);
end

% Button pushed function: YoutubeButton
function YoutubeButtonPushed(app, event)
web(‘youtube.com’);
end

% Button pushed function: MathWorksButton
function MathWorksButtonPushed(app, event)
web(‘mathworks.com’);
end

% Button pushed function: Button5
function Button5Pushed(app, event)
web(‘https://www.youtube.com/user/democracynow/playlists?disable_polymer=1&#8217;);
end
end

% Component initialization
methods (Access = private)

% Create UIFigure and components
function createComponents(app)

% Create UIFigure and hide until all components are created
app.UIFigure = uifigure(‘Visible’, ‘off’);
app.UIFigure.Position = [100 100 640 480];
app.UIFigure.Name = ‘UI Figure’;

% Create GmailButton
app.GmailButton = uibutton(app.UIFigure, ‘push’);
app.GmailButton.ButtonPushedFcn = createCallbackFcn(app, @GmailButtonPushed, true);
app.GmailButton.Position = [73 350 116 57];
app.GmailButton.Text = ‘Gmail’;

% Create GoogleButton
app.GoogleButton = uibutton(app.UIFigure, ‘push’);
app.GoogleButton.ButtonPushedFcn = createCallbackFcn(app, @GoogleButtonPushed, true);
app.GoogleButton.Position = [240 350 134 57];
app.GoogleButton.Text = ‘Google’;

% Create YoutubeButton
app.YoutubeButton = uibutton(app.UIFigure, ‘push’);
app.YoutubeButton.ButtonPushedFcn = createCallbackFcn(app, @YoutubeButtonPushed, true);
app.YoutubeButton.Position = [435 350 109 57];
app.YoutubeButton.Text = ‘Youtube’;

% Create MathWorksButton
app.MathWorksButton = uibutton(app.UIFigure, ‘push’);
app.MathWorksButton.ButtonPushedFcn = createCallbackFcn(app, @MathWorksButtonPushed, true);
app.MathWorksButton.Position = [141 240 100 22];
app.MathWorksButton.Text = ‘MathWorks’;

% Create Button5
app.Button5 = uibutton(app.UIFigure, ‘push’);
app.Button5.ButtonPushedFcn = createCallbackFcn(app, @Button5Pushed, true);
app.Button5.Position = [339 240 100 22];
app.Button5.Text = ‘Button5’;

% Show the figure after all components are created
app.UIFigure.Visible = ‘on’;
end
end

% App creation and deletion
methods (Access = public)

% Construct app
function app = Web_Browser_MATLAB

% Create UIFigure and components
createComponents(app)

% Register the app with App Designer
registerApp(app, app.UIFigure)

if nargout == 0
clear app
end
end

% Code that executes before app deletion
function delete(app)

% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end

Leave a Reply

%d bloggers like this: