- •Is the same as the previous syntax, but accepts attribute value pairs,
- •Xlsfinfo Determine if file contains Microsoft Excel spreadsheet.
- •Internet resource
- •Is a string. Message is either a string or a cell array. If it is a
- •Variables and the Windows registry.
- •Zip file access
- •Individual file can be specified relative to the current directory or
- •Tar file access
- •Individual file can be specified relative to the current directory or
- •Gzip file access
- •Individual file can be specified relative to the current directory or
- •Formatted file I/o
- •Icinterface/fgets
- •If %s is used an element read may cause several matlab matrix
- •Integer NaN as zero.
- •If true, textscan treats
- •File opening and closing
- •It on the matlab search path. On unix systems, filename may also start
- •Binary file I/o
- •If the most recent I/o operation was successful, message is empty
- •Indicator in the specified file. Position is indicated in bytes
- •Memory-mapped file support
- •Is correct for platform it's executed on.
- •Is also a valid partial pathname.
- •Serial port support
- •Instrfind will not find an object with a Name property value of
- •Instrfind will not find an object with a Name property value of
- •Timer support
- •Visible timer objects whose property names and property values match
- •Command window I/o
- •In the current directory. The folder contains an m-file for each web service
Is correct for platform it's executed on.
See also fullfile, path, tempdir, prefdir.
Reference page in Help browser
doc matlabroot
<mexext> - MEX filename extension for this platform.
MEXEXT MEX filename extension for this platform, or all platforms.
EXT = MEXEXT returns the MEX-file name extension for the current
platform.
ALLEXT = MEXEXT('all') returns a struct with fields 'arch' and 'ext'
describing MEX-file name extensions for all platforms.
There is a script named mexext.bat on Windows and mexext.sh on UNIX
that is intended to be used outside MATLAB in makefiles or scripts. Use
that script instead of explicitly specifying the MEX-file extension in
a makefile or script. The script is located in $MATLAB\bin.
See also mex, mexdebug.
Reference page in Help browser
doc mexext
<partialpath> - Partial pathnames.
PARTIALPATH Partial pathnames.
A partial pathname is a MATLABPATH relative pathname that is used to
locate private and method files which are usually hidden or to
restrict the search for files when more than one file with the given
name exists.
A partial pathname contains the last component, or last several
components, of the full pathname separated by '/'. For example,
"matfun/trace", "private/children", "inline/formula", and
"demos/clown.mat" are valid partial pathnames. Specifying the
"@" in method directory names is optional so "funfun/inline/formula"
Is also a valid partial pathname.
Many commands accept partial pathnames instead of a full pathname.
Here's a (partial) list of such commands
HELP, TYPE, LOAD, EXIST, WHAT, WHICH, EDIT,
DBTYPE, DBSTOP, and DBCLEAR, FOPEN.
Partial pathnames make it easy to find toolbox or MATLAB relative
files on your path in a portable way that is independent of
where MATLAB is installed.
<pathsep> - Path separator for this platform.
PATHSEP Path separator for this platform.
F = PATHSEP returns the path separator character for this platform.
The path separator is the character that separates directories in
the MATLABPATH variable.
See also path, filesep, fullfile.
Reference page in Help browser
doc pathsep
<prefdir> - Preference directory name.
PREFDIR Preference directory name.
D = PREFDIR returns the name of the directory containing preferences
for MATLAB and related products, the command history file, the MATLAB
shortcuts, and the MATLAB desktop layout files. The existence of the
directory is not ensured.
D = PREFDIR(1) creates the directory if it does not exist.
See also getpref, setpref.
Reference page in Help browser
doc prefdir
<tempdir> - Get temporary directory.
TEMPDIR Get temporary directory.
TEMPDIR returns the name of the temporary directory if one exists. A
file separator is appended at the end.
See also tempname, fullfile.
Reference page in Help browser
doc tempdir
<tempname> - Get temporary file.
TEMPNAME Get temporary file.
TEMPNAME returns a unique name, starting with the directory returned by
TEMPDIR, suitable for use as a temporary file.
TMP_NAME = TEMPNAME(DIRNAME) uses DIRNAME as the directory instead of
TEMPDIR.
Note: When running MATLAB without the JVM, the filename that tempname
generates is not guaranteed to be absolutely unique.
See also tempdir.
Reference page in Help browser
doc tempname
XML file handling
<xmlread> - Parse an XML document and return a Document Object Model node.
XMLREAD Parse an XML document and return a Document Object Model node.
DOMNODE = XMLREAD(FILENAME) reads a URL or file name in the
string input argument FILENAME. The function returns DOMNODE,
a Document Object Model (DOM) node representing the parsed document.
The node can be manipulated by using standard DOM functions.
Note: A properly parsed document will display to the screen as
>> xDoc = xmlread(...)
xDoc =
[#document: null]
Example 1: All XML files have a single root element. Some XML
files declare a preferred schema file as an attribute of this element.
xDoc = xmlread(fullfile(matlabroot,'toolbox/matlab/general/info.xml'));
xRoot = xDoc.getDocumentElement;
schemaURL = char(xRoot.getAttribute('xsi:noNamespaceSchemaLocation'))
Example 2: Each info.xml file on the MATLAB path contains
several <listitem> elements with a <label> and <callback> element. This
script finds the callback that corresponds to the label 'Plot Tools'.
infoLabel = 'Plot Tools'; infoCbk = ''; itemFound = false;
xDoc = xmlread(fullfile(matlabroot,'toolbox/matlab/general/info.xml'));
% Find a deep list of all <listitem> elements.
allListItems = xDoc.getElementsByTagName('listitem');
%Note that the item list index is zero-based.
for i=0:allListItems.getLength-1
thisListItem = allListItems.item(i);
childNode = thisListItem.getFirstChild;
while ~isempty(childNode)
%Filter out text, comments, and processing instructions.
if childNode.getNodeType == childNode.ELEMENT_NODE
%Assume that each element has a single org.w3c.dom.Text child
childText = char(childNode.getFirstChild.getData);
switch char(childNode.getTagName)
case 'label' ; itemFound = strcmp(childText,infoLabel);
case 'callback' ; infoCbk = childText;
end
end
childNode = childNode.getNextSibling;
end
if itemFound break; else infoCbk = ''; end
end
disp(sprintf('Item "%s" has a callback of "%s".',infoLabel,infoCbk))
See also xmlwrite, xslt.
Reference page in Help browser
doc xmlread
<xmlwrite> - Serialize an XML Document Object Model node.
XMLWRITE Serialize an XML Document Object Model node.
XMLWRITE(FILENAME,DOMNODE) serializes the DOMNODE to file FILENAME.
S = XMLWRITE(DOMNODE) returns the node tree as a string.
Example:
% Create a sample XML document.
docNode = com.mathworks.xml.XMLUtils.createDocument('root_element')
docRootNode = docNode.getDocumentElement;
docRootNode.setAttribute('attribute','attribute_value');
for i=1:20
thisElement = docNode.createElement('child_node');
thisElement.appendChild(docNode.createTextNode(sprintf('%i',i)));
docRootNode.appendChild(thisElement);
end
docNode.appendChild(docNode.createComment('this is a comment'));
% Save the sample XML document.
xmlFileName = [tempname,'.xml'];
xmlwrite(xmlFileName,docNode);
edit(xmlFileName);
See also xmlread, xslt.
Reference page in Help browser
doc xmlwrite
< xslt> - Transform an XML document using an XSLT engine.
XSLT Transform an XML document using an XSLT engine.
RESULT = XSLT(SOURCE,STYLE,DEST) transforms an XML document using
a stylesheet and returns the resulting document's URL. The
function uses these inputs, the first of which is required:
SOURCE is the filename or URL of the source XML file. SOURCE
can also be a DOM node.
STYLE is the filename or URL of an XSL stylesheet
DEST is the filename or URL of the desired output document; if
DEST is absent or empty, the function uses a temporary filename.
If DEST is '-tostring', the output document will be returned
as a MATLAB string.
[RESULT,STYLE] = XSLT(...) returns a processed stylesheet
appropriate for passing to subsequent XLST calls as STYLE.
This prevents costly repeated processing of the stylesheet.
XSLT(...,'-web') displays the resulting document in a
Web Browser.
Example:
This will convert a file "info.xml" to a temporary file
using the stylesheet "info.xsl" and launch the result
in the help browser. MATLAB has several info.xml files
which are used by the Start Button.
xslt info.xml info.xsl -web
See also xmlread, xmlwrite.
Reference page in Help browser
doc xslt