This is machine translation

Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Translate This Page

MathWorks Machine Translation

The automated translation of this page is provided by a general purpose third party translator tool.

MathWorks does not warrant, and disclaims all liability for, the accuracy, suitability, or fitness for purpose of the translation.

grabcode

Extract MATLAB code from file published to HTML

Syntax

grabcode('name.html')grabcode('urlname')code = grabcode('name.html')

Description

grabcode('name.html') copies MATLAB® code
from the file name.html and pastes it into an untitled
document in the Editor. Use grabcode to get MATLAB code
from published files when the source code is not readily available.
The file name.html was created by publishing name.m,
a MATLAB code file containing cells. The MATLAB code from name.m is
included at the end of name.html as HTML comments.

grabcode('urlname') copies MATLAB code
from the urlname location and pastes it into an
untitled document in the Editor.

code = grabcode('name.html') gets MATLAB code
from the file name.html and assigns it the variable code.

Examples

This example illustrates how to use grabcode to
get MATLAB code from an existing HTML file:

% Copy sine_wave_f.html and the images it includes
% from the MATLAB examples directory to your
% current folder:
copyfile(fullfile(matlabroot,'help','techdoc','matlab_env',...
'examples','sine_wave_f.html'), 'my_sine_wave.html')
copyfile(fullfile(matlabroot,'help','techdoc','matlab_env',...
'examples','sine_wave_f_01.png'), 'sine_wave_f_01.png')
copyfile(fullfile(matlabroot,'help','techdoc','matlab_env',...
'examples','sine_wave_f_02.png'), 'sine_wave_f_02.png')
% If you want to view the file, double-click my_sine_wave.html
% in your current folder.
% Extract the MATLAB code from sine_wave_f.html:
code = grabcode('my_sine_wave.html')