
| Contents | Index |
• Desktop Tools and Development Environment
• Graphics
Basic 3-D Plotting: The plot3 function
Functions for Plotting Data Grids
Visualizing Functions of Two Variables
Surface Plots of Nonuniformly Sampled Data
Indexed Color Surfaces - Direct and Scaled Color Mapping
Example - Mapping Surface Curvature to Color
Move Camera Horizontally/Vertically
Move Camera Forward and Backward
Defining the Camera Path as a Stream Line
Moving In and Out on the Scene
Making the Scene Larger or Smaller
Rotation Without Resizing of Graphics Objects
Rotation About the Viewing Axis
Projection Types and Camera Location
Example - axis Command Options
Additional Commands for Setting Aspect Ratio
Default Aspect Ratio Selection
Effects of Setting Aspect Ratio Properties
Example - Displaying Cross-Sections of Surfaces
Example - Displaying Real Objects
Properties That Affect Lighting
Positioning Lights in Data Space
Example - A Transparent Isosurface
Mapping Alpha Data to the Alphamap
Example - Mapping Data to Color or Transparency
Example - Modifying the Alphamap
Behavior of the patch Function
Handling Mixed Data Specification
Coloring Edges with Shared Vertices
Interpolating in Indexed Color Versus Truecolor
Selecting Visualization Techniques
Steps to Create a Volume Visualization
Volume Visualization Functions
Example - Ways to Display MRI Data
Example - Adding Isocaps to an Isosurface
Using Scalar Techniques with Vector Data
Specifying Starting Points for Stream Plots
Accessing Subregions of Volume Data
1. Determine the Range of the Coordinates
2. Add Slice Planes for Visual Context
3. Add Contour Lines to the Slice Planes
4. Define the Starting Points for the Stream Lines
1. Select a Subset of Data to Plot
2. Calculate Curl Angular Velocity and Wind Speed
4. Define the View and Add Lighting
1. Load Data and Calculate Required Values
3. Add Contour Lines to Slice Planes
1. Specify Starting Points of the Data Range to Plot
2. Create Stream Lines to Indicate Particle Paths
4. Calculate the Stream Particle Vertices
2. Add Isocaps to the Isosurface
• Creating Graphical User Interfaces
• About the Simple GUIDE GUI Example
• Laying Out the Simple GUI in GUIDE
• Programming the Simple GUIDE GUI
• Using the Completed Simple GUIDE GUI
Creating the Simple Programmatic GUI Code File
• Laying Out the Simple Programmatic GUI
• Coding the Simple Programmatic GUI
• Using the Completed Simple Programmatic GUI
• Adding Components to the GUI
A Working GUI with Many Components
Adding Components to the GUIDE Layout Area
Defining User Interface Controls
Defining Panels and Button Groups
Working with Components in the Layout Area
• Creating Menus in a GUIDE GUI
• Designing for Cross-Platform Compatibility
• Component Callbacks in GUIDE
• Customizing Callbacks in GUIDE
• Examples: Programming GUIDE GUI Components
• Making Multiple GUIs Work Together
Example - Manipulating a Modal Dialog Box for User Input
Example - Individual GUIDE GUIs Cooperating as Icon Manipulation Tools
• GUI for Animating a 3-D View
• GUI to Interactively Explore Data in a Table
• Accessing Workspace Variables from a List Box
• A GUI to Set Simulink Model Parameters
About the Simulink Model Parameters Example
View and Run the Simulink Parameters GUI
How to Use the Simulink Parameters GUI
Programming the Slider and Edit Text Components
Running the Simulation from the GUI
About the Address Book Reader Example
View and Run the Address Book Reader GUI
Loading an Address Book Into the Reader
The Contact Phone Number Callback
Paging Through the Address Book - Prev/Next
• Using a Modal Dialog Box to Confirm an Operation
About the Modal Dialog Example
View and Run the Modal Dialog Box GUIs
Setting Up the Close Confirmation Dialog
Setting Up the GUI with the Close Button
• Creating and Running a Programmatic GUI
Creating Figures for Programmatic GUIs
• Adding Components to a Programmatic GUI
• Composing and Coding GUIs with Interactive Tools
Setting Positions of Components Interactively
Setting Font Characteristics Interactively
• Setting Tab Order in a Programmatic GUI
• Creating Menus for a Programmatic GUI
• Creating Toolbars for Programmatic GUIs
• Designing Programmatic GUIs for Cross-Platform Compatibility
• Initializing a Programmatic GUI
• Examples: Programming GUI Components
• Sharing Data Among a GUI's Callbacks
• GUI with Axes, Menu, and Toolbar
About the Axes, Menu, and Toolbar Example
Viewing and Running the AxesMenuToolbar Code
Generating the Graphing Commands and Data
• GUI that Displays and Graphs Tabular Data
Viewing and Running the tableplot Code
Setting Up and Interacting with the uitable
Handle Graphics Property Browser
Why Write Custom Applications?
Exchanging Data Files Between Platforms
Overview of matimport.c Example
Declare Variables for External Data
Read External Data into mxArray Data
Creating a MAT-File in Fortran
Building on Windows Operating Systems
Deploying MAT-File Applications
Limitations to Shared Library Support
Troubleshooting Shared Library Applications
Examples of Passing Data to Shared Libraries
Manually Converting Data Passed to Functions
Constructing a libpointer Object
Creating a Pointer to a Primitive Type
Creating a Pointer to a Structure
Passing a Pointer to the First Element of an Array
Putting a String into a Void Pointer
Memory Allocation for an External Library
Working with Structures Examples
Example of Passing a MATLAB Structure
Using the Structure as an Object
Introduction to Source MEX-Files
Overview of Creating a Binary MEX-File
Using Help Files with MEX-Files
Workspace for MEX-File Functions
Selecting a Compiler on Windows Platforms
Selecting a Compiler on UNIX Platforms
Overview of Building the timestwo MEX-File
Understanding MEX-File Problems
Compiler and Platform-Specific Issues
Custom Building on UNIX Systems
Custom Building on Windows Systems
Creating a MEX-File Using LAPACK and BLAS Functions
Preserving Input Values from Modification
Passing Arguments to Fortran Functions from C/C++ Programs
Passing Arguments to Fortran Functions from Fortran Programs
Handling Complex Numbers in LAPACK and BLAS Functions
Modifying the Function Name on UNIX Systems
MEX Uses 32-Bit API by Default
How to Upgrade MEX-Files to Use the 64-Bit API
Passing Two or More Inputs or Outputs
Passing Structures and Cell Arrays
Handling 8-, 16-, and 32-Bit Data
Manipulating Multidimensional Numerical Arrays
Calling Functions from C/C++ MEX-Files
Using C++ Features in MEX-Files
Debugging on the Microsoft Windows Platforms
Building Cross-Platform Applications
Specifying Constant Literal Values
Replacing fseek and ftell with 64-Bit Functions
Determining the Size of an Open File
Determining the Size of a Closed File
Using the Fortran %val Construct
Passing Two or More Inputs or Outputs
Calling Functions from Fortran MEX-Files
Debugging on Microsoft Windows Platforms
Building Cross-Platform Applications
What You Need to Build Engine Applications
Calling MATLAB Software from a C Application
Calling MATLAB Software from a C++ Application
Calling MATLAB Software from a Fortran Application
Attaching to an Existing MATLAB Session
Building and Running Engine Applications on Windows Operating Systems
Windows Engine Example engwindemo
Building and Running Engine Applications on UNIX Operating Systems
Files Required by Engine Applications
Debugging MATLAB Functions Used in Engine Applications
Benefits of the MATLAB Java Interface
Who Should Use the MATLAB Java Interface
To Learn More About Java Programming Language
Platform Support for JVM Software
Using a Different Version of JVM Software
Making Java Classes Available in MATLAB Workspace
Loading Java Class Definitions
Locating Native Method Libraries
Java Classes Contained in a JAR File
Saving and Loading Java Objects to MAT-Files
Finding the Public Data Fields of an Object
Accessing Private and Public Data
Determining the Class of an Object
Invoking Static Methods on Java Classes
Obtaining Information About Methods
Java Methods That Affect MATLAB Commands
How MATLAB Software Handles Undefined Methods
How MATLAB Software Handles Java Exceptions
Method Execution in MATLAB Software
How MATLAB Software Represents the Java Array
Creating an Array of Objects in MATLAB Software
Accessing Elements of a Java Array
Creating a New Array Reference
Creating a Copy of a Java Array
Conversion of MATLAB Argument Data
Passing Data to Overloaded Methods
Conversion of Java Return Types
Converting Objects to MATLAB Types
Description of Function phonebook
Description of Function pb_lookup
Description of Function pb_add
Description of Function pb_remove
Description of Function pb_change
Description of Function pb_listall
Description of Function pb_display
Description of Function pb_keyfilter
Benefits of the MATLAB .NET Interface
Why Use the MATLAB .NET Interface?
What's the Difference Between the MATLAB .NET Interface and MATLAB Builder NE?
Using a .NET assembly in MATLAB
To Learn More About the .NET Framework
Example - Using System Resources
Loading .NET Assemblies into MATLAB
.NET Properties in the MATLAB Workspace
.NET Methods in the MATLAB Workspace
.NET Events in the MATLAB Workspace
What Classes Are in a .NET Assembly?
Using the delete Function on a .NET Object
Handling Data Returned from a .NET Object
Creating .NET Arrays in MATLAB
Example - Passing Data To a .NET Assembly
Accessing .NET Array Elements in MATLAB
Example - Reading Data From a .NET Assembly
Limitations to Support of .NET Arrays
Creating a Delegate from a .NET Object Method
Creating a Delegate Instance Bound to a .NET Method
Using Delegates With out and ref Type Arguments
Combining and Removing Delegates
Calling a Method Asynchronously
Limitations to Support of .NET Delegates
How to Iterate Through An Enumeration
Using Enumerations to Test for Conditions
Example - Read Special System Folder Path
Using Bit Flags with Enumerations
Limitations to Support of .NET Enumerations
Working with Events in Microsoft Office 2007 Applications
Accessing Items in a Collection
Example - Creating a Collection
Example - Converting a Collection to a MATLAB Array
Displaying Generic Methods Using Reflection
The MATLAB COM Automation Server
Registering Controls and Servers
Overview of MATLAB COM Client Examples
Example - Using Internet Explorer Program in a MATLAB Figure
Example - Grid ActiveX Control in a Figure
Example - Reading Excel Spreadsheet Data
MATLAB Client and In-Process Server
MATLAB Client and Out-of-Process Server
COM Implementations Supported by MATLAB Software
Client Application and MATLAB Automation Server
Client Application and MATLAB Engine Server
Identifying Objects and Interfaces
Setting the Value of a Property
Using Enumerated Values for Properties
Properties That Take Arguments
Exceptions to Using Implicit Syntax
Specifying Enumerated Parameters
Returning Multiple Output Arguments
Argument Callouts in Error Messages
Functions for Working with Events
Responding to Events - an Overview
Responding to Events - Examples
Writing Event Handlers as MATLAB File Subfunctions
Releasing COM Interfaces and Objects
Handling Data from a COM Object
Passing MATLAB Data to ActiveX Objects
Passing MATLAB SAFEARRAY to COM Object
Reading SAFEARRAY from a COM Object in MATLAB Applications
Displaying MATLAB Syntax for COM Objects
Using a MATLAB Application as an Automation Client
Connecting to an Existing Excel Application
Running a Macro in an Excel Server Application
Using Microsoft Forms 2.0 Controls
Using MATLAB Application as a DCOM Client
MATLAB COM Support Limitations
Connecting to an Existing MATLAB Server
Executing Commands in the MATLAB Server
Exchanging Data with the Server
Terminating the Server Process
Specifying a Shared or Dedicated Server
Using MATLAB Application as a DCOM Server
Example - Viewing Methods from a Visual Basic .NET Client
Example - Calling MATLAB Software from a Web Application
Example - Calling MATLAB Software from a C# Client
What You Need to Use Web Services with MATLAB
Typical Applications Using Web Services with MATLAB
How MATLAB Accesses Web Services
Example - createClassFromWsdl Function
Tools for Creating Web Services
Supported Serial Port Interface Standards
Using the Examples with Your Device
The Serial Port Interface Standard
Connecting Two Devices with a Serial Cable
Serial Port Signals and Pin Assignments
Finding Serial Port Information for Your Platform
Using Virtual USB Serial Ports
Configuring and Returning Properties
Configuring Properties During Object Creation
The Serial Port Object Display
Creating an Array of Serial Port Objects
Example - Introduction to Writing and Reading Data
Controlling Access to the MATLAB Command Line
Example - Writing and Reading Text Data
Example - Parsing Input Data Using textscan
Example - Introduction to Events and Callbacks
Event Types and Callback Properties
Responding To Event Information
Creating and Executing Callback Functions
Enabling Callback Functions After They Error
Example - Using Events and Callbacks
Signaling the Presence of Connected Devices
Controlling the Flow of Data: Handshaking
Example: Introduction to Recording Information
Creating Multiple Record Files
Example: Recording Information to Disk
Using Serial Port Objects on Different Platforms
• Examples
| On this page… |
|---|
The figure Position property controls the size and location of the figure window on the screen. Monitor screen size is a property of the root Handle Graphics object. At startup, the MATLAB software determines the size of your computer screen and defines a default value for Position. This default creates figures about one-quarter of the screen's minimum extent and places them centered left to right, in the top half of the screen.
MATLAB defines the figure Position property as a vector.
[left bottom width height]
left and bottom define the position of the first addressable pixel in the lower left corner of the window, specified with respect to the lower left corner of the screen. width and height define the size of the interior of the window (i.e., exclusive of the window border).

MATLAB does not measure the window border when placing the figure; the Position property defines only the internal active area of the figure window.
Because figures are windows under the control of your computer's windowing system, you can move and resize figures as you would any other windows. MATLAB automatically updates the Position property to the new values.
Your computer's window manager controls the layout of windows on monitors and on virtual desktops. It might not honor a request to place a figure window that would cause the entire figure or its top border to be located off-screen. A window manager also might force windows to have a certain minimum or maximum width or height. Such actions can cause a figure's position to differ from what you specify, and results can vary across platforms and window managers.
When a figure is docked in the MATLAB desktop, the Position property is defined with respect to the figure group container within the desktop. See Docking Figures in the Desktop for more information.
The figure's Units property determines the units of the values with which you specify its position on the screen. Possible values for the Units property are
set(gcf,'Units')
[ inches | centimeters | normalized | points | {pixels} |
characters]
with pixels being the default. These choices allow you to specify the figure size and location in absolute units (such as inches) if you want the window always to be a certain size, or in units relative to the screen size (such as pixels).
Characters are units that enable you to define the location and size of the figure in units that are based on the size of the default system font. Ffor an example that uses character units, see Example — Using Figure Panels.
Whatever units you use, it is important to know the extent of the screen in those units. You can obtain this information from the root ScreenSize property. For example:
get(0,'ScreenSize')
ans =
1 1 1152 900
In this case, the screen is 1152 by 900 pixels. MATLAB returns the ScreenSize in the units determined by the root Units property. For example,
set(0,'Units','normalized')
normalizes the values returned by ScreenSize.
get(0,'ScreenSize')
ans =
0 0 1 1
MATLAB determines the screen size in absolute units (e.g., inches) by dividing the number of pixels in width and height by the screen DPI (see the ScreenPixelsPerInch property). This value is approximate and might not represent the actual size of the screen.
Defining the figure Position in terms of the ScreenSize in normalized units makes the specification independent of variations in screen size. This is useful if you are writing a MATLAB file to use on different computer systems. It does, however, result in differently-shaped figures on monitors having different aspect ratios.
The ScreenSize property is static. Its values are read only at MATLAB startup and not updated if system display settings change. Also, the values returned might not represent the usable screen size for application developers due to the presence of other GUIs, such as the Microsoft Windows taskbar.
Suppose you want to define two figure windows that occupy the upper third of the computer screen (e.g., one for uicontrols and the other for displaying data). To position the windows precisely, you must take into account the window borders (which can include a menu bar and toolbars) when calculating the size and offsets. For this purpose, use the windows' OuterPosition rather than their Position property.
Ensure root units are pixels and get the size of the screen and create a figure window:
set(0,'Units','pixels') scnsize = get(0,'ScreenSize'); fig1 = figure;
The figure Position property only includes the drawable extent of the window, exclusive of the window borders. Obtain the entire window's size from the OuterPosition property, and compare the two:
position = get(fig1,'Position')
outerpos = get(fig1,'OuterPosition')
borders = outerpos - position
position =
560 528 560 420
outerpos =
556 524 568 495
borders =
-4 -4 8 75The left, right, and bottom borders are each 4 pixels wide. The top border, which contains a menu bar and a figure toolbar is 75-4, or 71 pixels wide.
Create a second figure, which defaults to the same size as the first one:
fig2 = figure;
Define the desired size and location of the figures. Leave a space equal to their border width between them:
edge = -borders(1)/2;
pos1 = [edge,...
scnsize(4) * (2/3),...
scnsize(3)/2 - edge,...
scnsize(4)/3];
pos2 = [scnsize(3)/2 + edge,...
pos1(2),...
pos1(3),...
pos1(4)];Reposition the two figures by changing both of their OuterPosition properties:
set(fig1,'OuterPosition',pos1) set(fig2,'OuterPosition',pos2)
The two figures now occupy the top third of the screen.

![]() | Docking Figures in the Desktop | Figure Colormaps — The Colormap Property | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A; sessions led by MATLAB experts.
| © 1984-2011- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |
Store


