%% Get Attribute of HTML Tag
% Read HTML code from the URL https://www.mathworks.com/help/textanalytics using webread.

url = "https://www.mathworks.com/help/textanalytics";
code = webread(url);

% Parse the HTML code using htmlTree.

tree = htmlTree(code);

% Find all the hyperlinks in the HTML tree using findElement. The hyperlinks are the nodes with element name "A".

selector = "A";
subtrees = findElement(tree,selector);
subtrees(1:10)

% Get the hyperlink references using getAttribute. Specify the attribute name "href".

attr = "href";
str = getAttribute(subtrees,attr);
str(1:10)

% Copyright 2018 The MathWorks, Inc.