I have this matlab function:
function trackName = getTrackName(xpath, gpxSourceDom)
% Import the XPath classes
import javax.xml.xpath.*
% Compile the expression
expression = xpath.compile('gpx/trk/name');
% Apply the expression to the DOM.
trackNames = expression.evaluate(gpxSourceDom, XPathConstants.NODESET);
end
I need a way to print every element inside trackNames NODESET. How can I do that?
A quick search of MATLAB and xpath returned this result:
using xpath in matlab
The part you’re missing is iterating through the results and displaying the name. For more ideas of what you can do with the nodes, check out the javadoc.
for i = 1:nodeList.getLengthnode = nodeList.item(i-1);
disp(char(node.getFirstChild.getNodeValue))
end