MATLAB Function Reference
  Go to function:
    Search    Help Desk 
frameedit    Examples
Create and edit printframes for Simulink block diagrams

Syntax

Description

frameedit invokes the printframe editor, a graphical user interface you use to create printframes for Simulink block diagrams. Printframes are borders containing information relevant to the Simulink block diagram, such as the name of the block diagram. After creating a printframe, you can use Simulink to print a block diagram with a printframe. See the sample below.

frameedit opens the PrintFrame Editor window with a new file.

frameedit filename opens the PrintFrame Editor window with the specified filename, where filename is a .fig file you previously created and saved using frameedit.


Remarks

Printframe Editor Interface

Type frameedit at the MATLAB prompt. The PrintFrame Editor window appears. Below is an illustration of the PrintFrame Editor window including the default printframe that the window opens with


.

The default printframe has two rows. The top row consists of one cell and the bottom row has two cells. Default information (entries) appears in the cells, as shown below. You can keep this information, or remove the default entries and add your own. You can also add new rows and cells and then add information in them.


Summary of the Printframe Process

Below are the basic steps to create and use printframes. Subsequent sections provide details for performing each step.

Where to Start - Designing Printframes

Before you begin creating a printframe using the printframe editor, determine the type of information you want to include in it and how you want the information to appear.

In a printframe, you can include variable information that is automatically supplied at the time of printing, such as the date the Simulink block diagram is being printed, or fixed information, such as the name and address of your organization.

You can design a printframe you intend to use for one particular Simulink block diagram, or you can design a more generic printframe for printing with different Simulink block diagrams.

Specifying the Printframe Page Setup

After you have an idea of the design of your printframe, specify the page setup for the printframe. In the PrintFrame Editor window, select Page Setup from the File menu.

The PrintFrame Page Setup dialog box appears. In the dialog box, specify:

Click Apply to see the effects of the changes you made. Then click OK to close the dialog box.


Note:
Always begin creating a new printframe with PrintFrame Page Setup. If instead you begin by creating borders and adding information, and then later change the page setup, you might have to correct the borders and placement of the information. For example, if you add information to cells and then change the page setup paper orientation from landscape to portrait, the information you added might not fit in the cells, given the new orientation.

Creating Borders (Rows and Cells)

After setting up the page, specify borders (cells) in which the Simulink block diagram and information will be placed. In the printframe editor, you create borders using rows, and then create cells within the rows.

You can add and remove rows in a printframe. First, click within an existing row to select it. If a row consists of multiple cells, click in any of the cells in the row to select that row.

When a row is selected, handles appear on all four corners. If handles appear on only two corners, you clicked on and only selected the line, not the row.


After selecting a row, click the add row button to create a new row. The new row appears above the row you selected. To remove a row, select the row and click the delete row button.

To create multiple cells within a row, select the row. Then click the split cell button. The row is split into two cells. If the row already consists of more than one cell, you can split any of the cells into two cells. First select the cell by clicking within in it. Then click the split cell button - the cell splits. To remove a cell, first select the cell and then click the delete cell button.

Resizing Rows and Cells

To change the dimensions of a row or cell, drag one side of the row or cell. More specifically, click on the line you want to move - a handle appears on both ends of the line and the cursor becomes a double-arrow cursor. Then drag the line to the new location. For example, to make a row taller, click on the top line that forms the row. Then drag the line up and the height of the row increases.

Note that the overall size of the printframe is fixed so that when you change the dimensions of one element, the dimensions of the element next to it change in an inverse direction. For example, if you drag the top line of a row to make it taller, the row above it becomes shorter by the same amount.

Adding Information to Cells

First select the cell where you want to add the information. Then, from the Fill list box, select the type of information you want to add. Finally, click the Add button - an edit box containing that information appears in the cell. (The edit box for your platform might look slightly different from those in the figure below.)


Note:
If you click the Add button and nothing happens, it might be because you did not select a cell first.

For Text, type the text you want to include in that cell, for example, the name of your organization. Press the Enter key (or Return key on a Macintosh) if you want to type additional text on a new line. Note that you can type special characters, for example, Greek symbols, using embedded TeX sequences - see the Text command String property for a list of allowable sequences.

All of the items in the Fill list box, except for the Text item, are for adding variable information, which is supplied at the time of printing. When you print a Simulink block diagram with a printframe that contains variable information, the information for that particular Simulink block diagram prints in those fields.

The variable entries you can include are:

Note:
Adding the system name or filename does not mean that you can specify a Simulink system or filename in the printframe editor. It means that when you print a block diagram from Simulink and specify that it print with a printframe, the system name or filename of that Simulink block diagram prints in the specified cell of the printframe.

When you add a variable entry, a percent sign, %, is automatically included to identify the entry as variable information rather than a text string, and the type of entry, for example, page, appears in angle brackets, < >. The entry consists of the entire string, for example, %<page>, for Page Number.

You can include multiple entries in one cell. Select the cell and then add another item from the list box. The new entry is added after the last entry in that cell. You can also type descriptive text to any of the variable entries without using the Text item in the Fill list box - type text in the edit box before or after an entry and the text prints with the block diagram.

Note:
You cannot include multiple entries or text in the cell that contains the block diagram entry - %<blockdiagram> must be the only information in that cell. If there is any other information in that cell, you cannot save the printframe and therefore cannot print it with a Simulink block diagram.

Zooming

While using the printframe editor, you might need to zoom in on an area to better see the information you added. Click in the cell you want to zoom in on and then click the zoom in button. The area is magnified. Click the zoom in button repeatedly to continue zooming in.


To zoom out, which reduces the magnification in an area, click the zoom out button. Click the zoom out button repeatedly to continue zooming out.

Aligning the Information in a Cell

To align the information within a cell, click within the cell to select it and then click on one of the Align buttons. L aligns the information with the left edge of the cell, C centers the information within the cell, and R aligns the information with the right edge of the cell. Alignment does not apply to the cell that contains the %<blockdiagram> entry - the Simulink block diagram is automatically scaled and centered to fit in that cell at the time of printing.

Editing Text Strings

You can change text you typed in a cell:

   1.
Double-click on the information you want to edit.
An edit box appears around all of the information in that cell.
   2.
Click at the start of the text you want to change and drag to the end of the text to be changed. This highlights the text.
   3.
Type the replacement text. It automatically replaces the highlighted text.
Be careful not to edit the text of a variable entry, because then the variable information will not print. For example, if you accidentally remove the % from the %<page> entry, the text <page> will print instead of the actual page number.
   4.
Click somewhere outside of the edit box to end editing mode.
Removing and Copying Entries

You can cut, copy, paste, and delete an entry:

   1.
Double-click the cursor on the information you want to remove or copy.
An edit box appears around all of the information in that cell.
   2.
Click at the start of the entry you want to edit and drag to the end of that entry. This highlights the entry.
For variable information, be sure to include the entire string, for example, %<page>.
Note that for Windows, you can select all of the entries in a cell by right-clicking on the information and choosing Select All from the pop-up menu.
   3.
Use the standard editing techniques for your platform to cut, copy or delete the highlighted information.
If you make a mistake, use your platform's standard undo technique. For example for Windows, right-click in the edit box and select Undo from the pop-up menu.
   4.
If you cut or copied the information to the clipboard and want to paste it, double-click on the entry where you want to paste it and position the cursor at the new location in that edit box. Then use the standard paste technique for your platform.
   5.
Click somewhere outside of the edit box to end editing mode.
Changing the Font Characteristics

You can change the font characteristics for the information in any cell. Specifically, you can specify the font size, style, color, and family.

   1.
Right-click on the information in the cell.
The information in the cell is selected and the pop-up menu for changing font characteristics appears.


If this pop-up menu does not appear it is because you were in edit mode. To get the font pop-up menu, click somewhere outside of the edit box surrounding the information and then right-click.
   2.
Select an item from the pop-up menu. Choose Properties if you want to change the font family or if you want to change multiple characteristics at once.
Note that you can also select String from the pop-up menu, which allows you to edit the text string.
   3.
Select the new font characteristic(s) for that cell. For example, for Font Size, select the new size from its pop-up menu.
Note that changing the font characteristics for the %<blockdiagram> entry is not relevant and does nothing.
Saving and Opening Printframes

You must save a printframe in order to print a Simulink block diagram with that printframe. To save a printframe, select Save As from the File menu. Type a name for the printframe in the File name edit box. Click the Save button and the printframe is saved as a .fig file. A .fig file is a binary file used for printframes.

You can open a saved printframe in the printframe editor, make changes to it, and save it under the same or a different name. To open an existing printframe, select Open from the File menu and then select the printframe you want to open. All printframes are .fig files. Alternatively, you can open a printframe from the MATLAB prompt: type frameedit <filename> and the printframe editor opens with the printframe file you specified.

Closing the Printframe Editor

To close the PrintFrame Editor window, click the close box in the upper right corner, or select Close from the File menu.

Printing Simulink Block Diagrams with Printframes

When using Simulink, you can print a block diagram with the printframe. Select Print from the Simulink File menu.


In the Print Model dialog box:

   1.
Check the Frame box.
   2.
Supply the filename for the printframe you want to use. Either type the path and filename directly in the edit box, or click the ... button and select the printframe file you saved using the printframe editor.
Note that the default printframe filename, sldefaultframe.fig, appears in the filename edit box until you specify a different filename.
   3.
Specify other printing options in the Print dialog box. For example, for Windows, specify options under Properties.
Note:
Specify the paper orientation for printing the way you normally would. The paper orientation you specified in the printframe editor's PrintFrame Page Setup dialog box is not the same as the paper orientation used for printing. For example, assume you specified a landscape-oriented printframe in the printframe editor. If you want the printed page to have a landscape orientation, you must specify that at the time of printing. For example, for Windows, click the Properties button in the Simulink Print Model dialog box, and for Page Setup, specify the Orientation as Landscape.

   4.
Click OK in the Print dialog box.
The Simulink block diagram prints with the printframe you specified.

Examples

This example uses a Simulink demo engine model. It involves two parts - first creating a printframe, and then printing the engine model with that printframe. The final result is:


Create the Printframe

   1.
At the MATLAB prompt, type frameedit.
The PrintFrame Editor window appears.
   2.
Set up the page:
  1. Select Page Setup from the File menu.

    The PrintFrame Page Setup dialog box opens.

  2. For Paper Type, select a size that is appropriate for your printer.
  3. For this example, keep the Paper Orientation as Landscape and the Margins set to .75 inches.
  4. Click the OK button.

    The dialog box closes. If you changed the Paper Type, the printframe you see in the PrintFrame Editor window will reflect your change.

   3.
Add a row at the top.
  1. Click within the upper row in the printframe - this is the row that contains the %<blockdiagram> entry.

    Be sure that handles appear on all four corners of the row.

  2. Click the add row button.

    A new row appears at the top, above the row you selected.

   4.
Make the new row shorter.
  1. Click on the horizontal line that separates the top row (the row you just added) from the row beneath it (the row containing the %<blockdiagram> entry).

    Be sure that only two handles appear, one at each end of the line. If you see four handles in either row, click directly on the horizontal line and the other two handles disappear.

  2. Drag the line up until the top row is about the same height as the row at the bottom of the printframe.
   5.
Add information in the top row.
  1. Click within the top row (the row you just added).
  2. Select Text from the Fill drop-down menu.
  3. Click the Add button.

    An edit box appears in the cell.

  4. Type Engine Division, press the Enter key to advance the cursor to the next line, and then type Advanced Design Group.

    Click the zoom in button if you need to magnify the entry.

  5. Click outside of the edit box to end editing mode.
   6.
In the left cell of the bottom row, align the information on the left.
  1. Click the zoom out button if you need to.
  2. Click within the left cell of the bottom row to select it.
  3. Click the L button.
The entry moves to the left.
   7.
Make the information in the left cell of the bottom row appear in bold.
  1. Right-click on the entry in the cell.
  2. Select Font Style from the pop-up menu.

    If the pop-up menu for font properties does not appear, you are in editing mode. Click outside of the edit box to end editing mode and then right-click on the text to access the pop-up menu.

  3. From the Font Style pop-up menu, select bold.
The entry in the cell appears in bold and the information will appear in bold when the printframe is printed with a Simulink diagram.
   8.
Add the total number of pages to the right cell in the bottom row.
  1. Click within the cell to select it.
  2. Add the total pages entry: select Total Pages from the Fill drop-down menu and click the Add button.

    The %<npages> entry appears after the %<page> entry. If you need to, zoom in to see the entry.

  3. Add the text of after the page number entry: click the cursor after the %<page> entry, and then type of (type a space before and after the word).
The information in the cell now is: %<page> of %<npages>.
   9.
Optional - you can experiment and make changes on your own.
   10.
Save the printframe - select Save As from the File menu. In the Save Frame dialog box, type engdivl for the File name. Click the Save button.
The printframe is saved as a .fig file.
   11.
You can close the PrintFrame Editor window if you want to - click the close box.
Print the Simulink Block Diagram with the Printframe

   1.
To view the Simulink engine model, type engine at the MATLAB prompt.
The engine model appears in a Simulink window.
   2.
Double-click on the Throttle & Manifold block.


The Throttle & Manifold subsystem opens in a new window.
   3.
In the Throttle & Manifold window, select Print from the File menu.
The Print Model dialog box opens.


   4.
In the Print Model dialog box, set the page orientation to landscape. This example uses the techniques for the Windows platform. Use the methods for your own platform to change the page orientation for printing.
  1. Click the Properties button.

    The Document Properties dialog box opens.

  2. Go to the Page Setup tab.
  3. For Orientation, select Landscape.
  4. Click OK.

    The Document Properties dialog box closes.

   5.
In the Print Model dialog box, under Options, select Current system and below.
This specifies that the Throttle & Manifold block diagram and its subsystems will print.
   6.
Check the Frame check box.
   7.
Specify the printframe to use.
  1. Click the ... button
  2. In the Frame File Selection dialog box, find the filename of the printframe you just created, engdivl.fig, and select it.
  3. Click the Open button.

    The path and filename appear in the Frame edit box.

   8.
Click the OK button in the Print Model dialog box.
The Throttle & Manifold block diagram prints with the printframe; it should look similar to the figure shown at the start of this example.
In addition, the Throttle block diagram prints on page 2, and the Intake Manifold block diagram on page 3. These block diagrams also print with the engdivl printframe, but note that their variable information in the printframe is different.



[ Previous | Help Desk | Next ]