MATLAB Function Reference |

Get MATLAB code from M-files published to HTML

**Syntax**

`grabcode('name.html')`

copies MATLAB code from the file `name.html`

and pastes it into an untitled document in the Editor/Debugger. Use `grabcode`

to get MATLAB code from demos or other published M-files when the M-file source code is not readily available. The file `name.html`

was created by publishing `name.m`

, an M-file script containing cells. The MATLAB code from `name.m`

is included at the end of `name.html`

as HTML comments.

`codeString = grabcode('name.html')`

get MATLAB code from the file `name.html`

and assigns it the variable `codeString`

.

**Examples**

sineWaveString = %% Simple Sine Wave Plot %% Part One: Calculate Sine Wave % Define the range |x|. % Calculate the sine |y| over that range. x = 0:.01:6*pi; y = sin(x); %% Part Two: Plot Sine Wave % Graph the result. plot(x,y)

**See Also**

gplot | gradient |

© 1994-2005 The MathWorks, Inc.