# getframe

Capture figure or axes as movie frame.

## 📝 Syntax

* F = getframe
* F = getframe(ax)
* F = getframe(fig)

## 📥 Input argument

* ax - axes object: Axes to capture.
* fig - figure object: Figure to capture.

## 📤 Output argument

* F - struct: Movie frame.

## 📄 Description

F = getframe captures the current axes as displayed on the screen as a movie frame. F is a structure containing the image data. The capture preserves the on-screen size of the axes but does not include tick labels or any content outside the axes boundaries.

F = getframe(ax) captures the specified axes ax instead of the current axes.

F = getframe(fig) captures the entire figure window specified by fig, including the axes title, labels, and tick marks. However, the captured frame does not include the figure’s menu or toolbars.

## 💡 Examples

```matlab
f = figure();
surf(peaks);
F = getframe(f);
figure('Color',[0.5 0.5 0.5]);
imshow(F.cdata)

```

```matlab
f = figure();
ax1 = subplot(2,1,1);
surf(peaks);
ax2 = subplot(2,1,2);
plot(rand(30))
F1 = getframe(ax1);
F2 = getframe(ax2);
figure('Color',[0.5 0.5 0.5]);
imshow(F1.cdata)
figure('Color',[0.5 0.5 0.5]);
imshow(F2.cdata)

```

## 🔗 See also

[image](https://nelson-9.gitbook.io/nelson/markdown/en/graphics/image), [imshow](https://nelson-9.gitbook.io/nelson/markdown/en/graphics/imshow), [imwrite](https://github.com/Nelson-numerical-software/nelson-gitbook/blob/master/markdown/en/graphics/imwrite.md).

## 🕔 History

| Version | 📄 Description  |
| ------- | --------------- |
| 1.13.0  | initial version |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nelson-9.gitbook.io/nelson/markdown/en/graphics/getframe.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
