# MATLAB FREQUENTLY-ASKED QUESTIONS

Frequently Asked Questions maintained by Michele Zavada (michelez@mathworks.com)

Table of Contents:

y

1.General Questions o 1.1.General Information 1.1.1.What is MATLAB? 1.1.2.What is SIMULINK? 1.1.3.On what machines is MATLAB available? 1.1.4.What was first: the company MathWorks or the product MATLAB? 1.1.5.What is the history of MATLAB? 1.1.6.What is the charter for the USENET Newsgroup comp.softsys.matlab? 1.1.7.Are there any software archives? 1.1.8.Are there any publications related to MATLAB? 1.1.9.What toolboxes are currently available from The MathWorks? 1.1.10.How do I contact The MathWorks about MATLAB via email? o 1.2.Product Information 1.2.1.What's new in MATLAB 4.2? 1.2.2.When will MATLAB 4.2 be released on the various platforms? 1.2.3.How does MATLAB perform on machine X? 1.2.4.What's new with SIMULINK? 1.2.5.What's new in Signal Processing Toolbox version 3.0? 1.2.6.What's new in Neural Network Toolbox version 2.0? 1.2.7.Can a C or FORTRAN subroutine be called directly from MATLAB? 1.2.8.Can I call MATLAB routines from my C or FORTRAN programs? 1.2.9.Is there going to be a 4.0 version of the Student Edition? 1.2.10.Is there a MATLAB compiler? o 1.3.User Questions 1.3.1.General MATLAB Questions 1.3.1.1.How do I import graphics into other applications? 1.3.1.2.How do I run MATLAB in the background under UNIX? MS Windows? 1.3.1.3.Why doesn't MATLAB run as fast as I expect it to?

1.3.1.4.How can I change the default window size, colors, etc., in MATLAB? 1.3.1.5.How do I manipulate colormaps? 1.3.1.6.Is there a topical help function, like 'apropos'? 1.3.1.7.How can I get information about undocumented functions (like comet) in MATLAB? 1.3.1.8.How does the Random generator work? 1.3.1.9.Is there a Pseudo-Random Binary Sequence (PRBS) generator in MATLAB? 1.3.1.10.What is the numeric precision of MATLAB? 1.3.1.11.How do I run MATLAB in batch mode? 1.3.2.Matrices 1.3.2.1.What is the largest matrix MATLAB can handle? 1.3.2.2.How does MATLAB index its matrices? 1.3.2.3.Can MATLAB handle multidimensional arrays? 1.3.2.4.How can I initialize a low rank matrix easily? 1.3.3.Functions 1.3.3.1.Why, when I edit a function file in MATLAB, is the change not seen by MATLAB until everything is cleared or MATLAB is restarted? 1.3.3.2.How can I get the parser to accept a dummy reference without an error? 1.3.3.3.Is there a GNU emacs editing mode for MATLAB? 1.3.3.4.Does MATLAB have a debugger? 1.3.4.eval Command 1.3.4.1.How does the eval command work? 1.3.4.2.How can I use a filename that is a variable as an input argument to the load, save, and print functions? 1.3.5.MATLAB Functions 1.3.5.1.Why was fsolve removed from MATLAB Version 4? 1.3.5.2.What is griddata? How do I use it to contour irregularly spaced data? 1.3.5.3.What is the sign convention used in MATLAB's fft routines? 1.3.5.4.How do I fit a curve in MATLAB? 1.3.6.File I/O 1.3.6.1.How do I use fread, fwrite, and fprintf? 1.3.6.2.How can I store the result of ls *.dat in a variable? 1.3.7.Differential Equations 1.3.7.1.Can MATLAB solve Ordinary Differential Equations (ODE)? 1.3.7.2.How do I pass in extra parameters to ode and quad? 1.3.7.3.How do I do double integration in MATLAB? 1.3.8.Memory 1.3.8.1.What can I do when MATLAB tells me I'm out of memory?

1.3.9.Student Edition 1.3.9.1.Why does my Student Edition hang my machine after the MATLAB banner is displayed? 1.3.9.2.How do I print using the Student Edition?

y

y

2.Graphics o 2.1.Using get and set 2.1.1.What is a handle? 2.1.2.How do I use get and set? 2.1.3.What properties can I control? 2.1.4.How do I change the default settings for an object's properties? 2.1.5.How do I change the default settings back to their original settings? o 2.2.Properties of the Figure and the Axes 2.2.1.Fonts 2.2.1.1.How do I change the font of text objects? 2.2.1.2.How do I change the font of tick labels? 2.2.1.3.How do I get Greek letters in my text objects? 2.2.1.4.Can I have multiple fonts in one text object? 2.2.2.Lines 2.2.2.1.How do I change the line width? 2.2.2.2.How do I change the line style order on printouts? 2.2.2.3.How do I cycle through the line color order? 2.2.3.Positions 2.2.3.1.How do I change the size and position of my figure window? 2.2.3.2.How do I define an invisible axis? 2.2.3.3.Which units should I use? o 2.3.Background Color 2.3.1.How do I invert the background on my printout? 2.3.2.How do I change my background for plots? o 2.4.Using MATLAB Graphs with Other Packages 2.4.1.Can graphics be saved as files to be imported back into MATLAB for viewing and alteration? 2.4.2.Can I edit MATLAB graphs in other applications? 2.4.3.How do I copy and paste MATLAB graphs to the clipboard? o 2.5.Graphical User Interface (GUI) 2.5.1.How do I make a dialog box? 2.5.2.How do CallBacks work? What is the best way to write a CallBack? 2.5.3.Where do CallBacks get executed? o 2.6.Miscellaneous 2.6.1.Why does waterfall return a blank screen? 2.6.2.How do you get perspective with 3-D plots? 2.6.3.Why does MATLAB sometimes draw patches out of order? 2.6.4.How do I use multiple colormaps? 2.6.5.What is the difference between pcolor and image? 3.Printing o 3.1.General

3.How do I print a SIMULINK block diagram? o 3.Printing to a File 3.2.1.3.1.3.1. after a long session of MATLAB under MS Windows where many figures printed.5.3.1.How do I print to a file? 3. does my graph look "blocky" when the graph looked fine on the screen? 3.5.3.4.1.2.5.1.Environment Variable of lm_license_file Not Defined
.4.Installing MATLAB 4.6.1.3.2.2.3.Common Error Messages: 4.2.4.2.Why.Why don't my axis labels print correctly? 3.2.7.XXX Feature is not Currently Licensed 4.How do you use GhostScript to display PostScript files to the screen from DOS? o 3.When should I run lmdebug? 4.3.2.2.How do I run two versions of MATLAB on a VAX? o 4.Why would I print with a GhostScript device? 3.4.1. when I use interpolated shading or print surfaces.On a UNIX network.5.How do I know what option to use? 3.4.1.2.2.5.What do I do if my printer isn't listed among the GhostScript devices? 3. how do I run a back-up server configuration? 4.3.5.1.What do I do if my PC beeps and hangs when I try to print? 4.2.2.GhostScript 3.3.Why can't I print broken lines? 3.3.Why can't I print UI controls? 3.Why does my printer hang when I try to print from the pulldown menu? 3.1.1. do I start to have a problem printing? 3.Why.5.2.How do I change fonts in SIMULINK? 3.License Configurations 4.Common Problems 3.3.1.SIMULINK Printing 3.dat files if I am running another vendor that uses FlexLM? 4.How do I set up the license manager so that it runs on a heterogeneous network? 4.How do I combine license.What do I do if I am getting SIMULINK blocks and no text? 3.5.4.5.4.Cannot Connect to License Server 4.y
3.2.4.3.How do I print out an HPGL format file? o 3.2.Where can I get documentation for GhostScript? 3.When do I have to run the license manager? o 4.How do I print in MATLAB? 3.2.5.4.License Manager o 4.How do I print my SIMULINK diagram on more than one page? 3.Are there step by step instructions for installation? 4.2.How do I print a SIMULINK model from within an M-file? o 3.1.What is GhostScript? How do I use it? 3.2.3.3.

1.Why doesn't linmod return the correct results? 5.MEX-File function examples 5.Are there any engine examples? 5.4.2.1.3.What is the difference between the MATLAB Function block and the function block? 5.Unable to Read License File 5.2.2.License Server Does Not Support This Feature 4.3.1.How do I display values numerically.4.Are there any FORTRAN MEX-file examples? 5.3.2.3.How do I write a C++ MEX-file function? 5.2." written to provide easy access to matrix software developed by the LINPACK and EISPACK projects.General Questions 5.3.3.1.Where can I get C MEX-file function examples? 5.2.MEX-Files and Engine 5.2.2.1.3.2.What is the flag ordering for S-functions? 5. General Information
1.2.1. General Questions
1.1.1.1.6.1.2.Common Problems 5.2.No TCP License Server Exists 4.2.1. rather than graphically (with the scope)? 5.2.3.Can SIMULINK handle complex signals? 5.Why an I getting a segmentation violation error?
1.3.Why doesn't the text on my SIMULINK diagram print out? 5.How do I use the set_param and get_param functions? 5.SIMULINK/MEX-Files/Engine o 5.2.4.1.4.1.1.MATLAB Function block 5.3.2.4.1. What is MATLAB?
MATLAB was originally developed to be a "matrix laboratory.1.1. the software has evolved into an interactive system and programming language for general scientific and
.1.S-functions 5.1.1.How do I mask SIMULINK blocks? 5.Are there any examples of S-functions in C? FORTRAN? o 5.Printing SIMULINK models 5.y
4.2.7.Invalid Returned Data From License Server 4.1.3.Compilers we support 5.3.3.2.2.Why can't I call any MATLAB function from the MATLAB Function block? 5.2.1.2.1. Since then.1.4.2.1.1.1.4.SIMULINK 5.How do I print my SIMULINK model? 5.3.1.1.5.

LINPACK is a collection of FORTRAN subroutines for solving linear equations. Send an email to info@mathworks. It is a graphical. nonlinear. LINPACK and EISPACK represent the state of the art software for matrix computation. MATLAB commands are expressed in a form very similar to that used in mathematics and engineering.1. and the student edition. HP.technical computation and visualization. including pull-down windows and mouse interactions. forms a complete control system design and analysis environment.
. DEC.1. There are hundreds of built-in functions that come with the basic MATLAB and there are optional "toolboxes" of functions for specific purposes such as Controls. The list includes PC. Sun. and NEC personal computers. b = A x. Cleve.
1. Macintosh. and x are matrices. Together. Most of the functions in MATLAB and the Toolboxes are written in the MATLAB language and the source code is readable. What was first: the company MathWorks or the product MATLAB?
MATLAB was first. was founded in 1984 to develop and market MATLAB. generally much quicker than programming in a high-level language such as C or FORTRAN. VAX minicomputers. under Microsoft Windows on the PC. who was then chairman of the computer science department at the University of New Mexico.1. the professional version is distributed by The MathWorks. together with MATLAB and the Control System Toolbox.3. and SGI workstations. Inc.
1. There is no need to program matrix operations explicitly like multiplication or inversion. is written b = A * x . To solve for x in terms of A and b. b. What is SIMULINK?
SIMULINK is an interactive system for the nonlinear simulation of dynamic systems. multivariable.
1.4. The MathWorks. Signal Processing. continuous-time. mouse-driven program that allows systems to be modeled by drawing a block diagram on the screen. For instance. the professional version. There are two basic versions of the software. The basic MATLAB data element is a matrix.5. and multirate systems. where A. Inc. IBM. Cleve Moler and several colleagues developed the FORTRAN subroutine libraries called LINPACK and EISPACK under a grant from the National Science Foundation. and. SIMULINK is fully integrated with MATLAB. discrete-time. and Convex and Cray supercomputers.1. What is the history of MATLAB
In the mid-1970s. It can handle linear. and Optimization. Solving problems in MATLAB is. It takes full advantage of windowing technology. The student edition is distributed by Prentice-Hall. therefore. write x = A\b . On what machines is MATLAB available?
MATLAB is available on machines ranging from the PC to the Cray.
1. In the late 1970s. while EISPACK contains subroutines for solving eigenvalue problems. SIMULINK runs on workstations using X-Windows.2. and on the Macintosh.com or call 508-65-pi (508-653-1415) for more information.

MATLAB started to catch on by word of mouth within the applied math community as a "cult" phenomena.8. the scientific calculation and visualization package from The MathWorks Inc. signal processing. get the file /README.com (Be sure to include your address adn your site identification/license number. Within a year or two. because this wasn't the purpose of the course.1. the MATLAB user group. type "ver" at the MATLAB prompt.
1. frequency domain). What is the USENET Newsgroup comp. Image Processing Toolbox : The Image Processing Toolbox builds on MATLAB's numeric.10]. and discussions comparing MATLAB to other systems. he didn't want them to have to program in FORTRAN. and LQR optimal control are also included.
1.com [144. What toolboxes are currently available from The MathWorks?
Control System Toolbox : This is a toolbox for control system design and analysis.
1. toolboxes). as well as functions for step. Appropriate discussion in the group will include both general MATLAB issues and platformspecific questions.7. design with root-locus. send email to subscribe@mathworks.mathworks.1. etc.).
. It supports transfer function and state-space forms (continuous/discrete time. he would end up by leaving a copy of his MATLAB on the university machines. He named his program MATLAB.soft-sys. Are there any software archives?
The MathWorks maintains an archive on the anonymous ftp server ftp.matlab is a forum for discussing issues related to the use of MATLAB. Nyquist.
1. or just type subscribe at your MATLAB prompt. publishes a quarterly newsletter that gives information on products (new versions. and visualization capabilities to provide a comprehensive system for image processing and algorithm development. or as a visiting professor. Functions for Bode. However. The MathWorks Inc.6. related texts etc. To subscribe to the newsletter.com. MATLAB short courses.100. Nichols plots. pole-placement. Over the next several years. This site contains a "best of" copy of the NETLIB archive as well as other user-contributed.wanted to be able to teach students in his linear algebra courses using the LINPACK and EISPACK software.1. when Cleve would visit another university to give a talk.soft-sys.incoming on the ftp site or send email to: drea@mathworks. and arbitrary input responses. as a "hobby" on his own time. So.212.9. and MathWorks-contributed software and documentation. news about our Internet services. Q &A requests from users. There is also a monthly email digest that contains annoncements. impulse. If you are interested in submitting software to the archive. Are there any publications related to MATLAB?
Yes.1. releases. To find out your site id. for MATrix LABoratory.matlab ?
The newsgroup comp. he started to write a program that would provide simple interactive access to LINPACK and EISPACK.

semi-infinite optimization. minimax. and hypertangent sigmoid. solution of function equations. You can view the progress of an optimization while it is running. H2. It also includes some two-dimensional signal processing capabilities. linear programming. Transfer functions included are hard limit. linear control systems. and functional approximation. Robust Control Toolbox : This is a toolbox for robust control system design and supports LQG/loop transfer recovery. singular value frequency response. Spline Toolbox : This is a toolbox for working with splines and is typically used for curve fitting. It supports unconstrained and constrained minimization. Optimization Toolbox : This is a toolbox for linear and nonlinear optimization.control synthesis. logistic. and for FFT analysis (power spectrum estimation). Mu-Analysis and Synthesis Toolbox : The Mu-Analysis and Synthesis Toolbox contains specialized tools for the analysis and design of robust. and Parks-McClellan. Nonlinear Control Design : This toolbox provides a Graphical User Interface to assist in timedomain-based control design. modeling. Signal Processing Toolbox : This is a toolbox for digital signal processing (time series analysis). It includes functions for the design and analysis of digital filters.MMLE3 Identification Toolbox : The MMLE3 Identification Toolbox is a specialized toolbox for use with MATLAB and the Control System Toolbox for the estimation of continuous-time state-space models from observed input-output data. but includes modeling and tuning options that simplify the design procedure. like Butterworth. and 3) GUI tools for exploring fundamental concepts in statistics and probability. and the solution of nonlinear equations. the Widrow-Hoff rule. and mu. and Monte Carlo simulation 2) building blocks for creating your own special-purpose statistical tools. quadratic programming. linear. you can tune parameters within a nonlinear SIMULINK model to meet time-domain performance requirements. nonlinear least squares. Model Predictive Control Toolbox : The Model Predictive Control Toolbox is especially useful for applications involving constraints on the manipulated and/or controlled variables. For unconstrained problems.
. extending MATLAB to provide additional application-specific capabilities. Statistics Toolbox : The Statistics Toolbox builds on the computational and graphics capabilities of MATLAB to provide: 1) statistical data analysis. and model reduction. Optimization routines have been taken from the Optimization Toolbox. Elliptic. H0. multi-objective. With this toolbox. and several variations of the backpropagation rule. model predictive control is closely related to linear quadratic optimal control. Neural Network Toolbox : This is a toolbox for designing and simulating neural networks and supports implementation of the perceptron learning rule.

Higher-order spectrum estimation either by conventional or parametric approaches Magnitude and phase retrieval Adaptive linear prediction Harmonic retrieval and quadratic phase coupling Time-delay estimation and array signal processing
Toolkits are also available from The Mathworks. graphical presentation of results. and Ananthram Swami. Parks.mathworks. There are also useful functions for plotting data. James H. an approach to unifying continuous and discrete systems theory without use of the z transform.Symbolic Math Toolbox : The Symbolic Math Toolbox contains functions for symbolic algebra. and Hans Schuessler. Thomas W. (Max) Nikias. Inc. 1994. These are available from the publisher or from ftp. Oppenheim. Delta Toolkit : This is a toolkit for analysis using the delta transform. ARMA models or Box-Jenkins models). Sidney Burrus. Toolkits are colections of M-files associated with books. and model verification. The Hi-Spec Toolbox is a collection of MATLAB routines whose primary features are functions for: 1. Ronald W. Control of Spacecraft and Aircraft Toolkit : This is a package of MATLAB programs to demonstrate the concepts discussed in the text "Control of Spacecraft and Aircraft. factor based methods. was created by Jerry Mendel. Frequency Domain System Identification Toolbox : This toolbox contains specialized tools for identifying linear dynamic systems from measurements of the system's excitation and response. Signal Processing Examples Toolkit : This is a package of MATLAB programs to demonstrate the concepts discussed in the text "Computer-Based Exercises for Signal Processing Using MATLAB. variable precision arithmetic. Chemometrics Toolbox : This toolbox contains a library of functions that allows you to analyze data based on chemometrics methods including multiple linear regression. Identified models are in transfer function form (either z transform or Laplace transform) and state-space form (e.g. equation solving.com in /pub/books . 2. exact linear algebra. McClellan. parameter estimation. and special mathematical functions.. The Extended Symbolic Math Toolbox augments the functionality to include Maple programming features and specialized libraries." by Arthur E. principle component regression. C. Schafe. (1994) Princeton University Press." by C. 3. Alan V. System Identification Toolbox : This is a toolbox for parametric modeling. inverse least squares. 5. Its underlying computational engine is the kernel of Maple. Bryson. (1994) Prentice Hall. Q-matrix. Some of the identification procedures include excitation signal design. classical least squares. a Partner Series Toolbox.L. Hi-Spec [tm] Toolbox : The Hi-Spec [tm ] Toolbox. It is available free to
. 4. and partial least squares in latent variables.

" by Graham Goodwin and Rick Middleton.1.com Bug reports * doc@mathworks. Matthews." by Gilbert Strang.1.. The toolbox is coordinated with the text: "Introduction to Linear Algebra.2. Charles Romine.com Technical support * suggest@mathworks. Introduction to Linear Algebra Toolkit : This is a package of MATLAB programs to use with MATLAB in learning and experimenting with linear algebra.purchasers of "Digital Control and Estimation: A Unified Approach.2?
. Jack Dongarra. Science and Engineering Toolkit : This is a toolkit for which demonstrates the concepts discussed in the text "Numerical Methods for Mathematics.What's new in MATLAB 4. (1994) Prentice Hall. It is available free to purchasers of this text. Templates Toolkit." by John H.com Documentation error reports * subscribe@mathworks. Second Edition.
1. 1994). Tony Chan.com Subscribing user registration * service@mathworks. How do I contact The MathWorks about MATLAB via email?
Here you go . It is available free to purchasers of this text.com Sales.com Submission and questions for the digest
1.2. Michael Berry. Numerical Methods for Mathematics. James Demmel. Numerical Methods for Physics Toolkit : This is a toolkit for which demonstrates the concepts discussed in the text "Numerical Methods for Physics Using MATLAB. * support@mathworks.com Product enhancement suggestions * bugs@mathworks. * digest@mathworks.." by Alejandro Garcia. (1994) Prentice Hall. (1993) Wellesley-Cambridge Press Box 812060 Wellesley MA 02181. June Donato.com Order status.10. The M-files were created to supplement "Templates for the Solution of Linear Systems: Building Blocks for Iterative Methods. passcodes * info@mathworks. and Henk van der Vorst (SIAM. Science and Engineering. Victor Eijkhout.Product Information
1. renewals. pricing. general info." by Richard Barrett. Roldan Pozo.

faster graphics * DDE capability for the PC * Online documentation for UNIX systems * International Character Support (limited) * Many memory leak fixes
1. the Mac version came out.Here's a summary of the major additions and changes: * Ability to produce hpgl format files * Ability to import graphs into Adobe Illustrator '88 * Ability to save a figure and load it back into MATLAB * Better. How does MATLAB perform on machine X?
One way to measure the speed of MATLAB is by looking at the LINPACK benchmarks: One way to measure the speed of MATLAB is by looking at the LINPACK benchmarks: PC performance range: LINPACK (KFLOPS) VAXstation 3100 (VMS/D_floating) 365 HP 9000/400 (68030) 500 80486-based PC (33M Hz) 1300 HP 9000/425 (68040 chip) 1400 Macintosh Quadra 700 1500 Sun SPARCstation 1 1500 DECstation 3100 1600
. In late May.3 and HP700 versions were released in late April 1994. SunOS. Solaris 2.3.2. Other UNIX platforms and the VMS version will follow shortly. When will MATLAB 4.
1. The version for Power PC for the Mac will be released in late 1994.2 and 2.2.2.2 be released on the various platforms?
The PC.

2.6.2. minimum order estimation for FIR filters designed with remez .
1.What's new with SIMULINK?
SIMULINK has added the following features in version 1.0?
The toolbox now offers enhanced filter design tools for digital and analog filters.3: * Vectorization of blocks * Scalar expansion of inputs * Automatic routing of block connections * Wide vector lines * Sample time coloration of model * Enhanced S-functions * Many bew blocks!
1. support for cascade filter implementation (second order sections decomposition).4.5. Capabilities include the design of optimal least-square filters.What's new in Signal Processing Toolbox version 3.2.What's new in Neural Network Toolbox version 2. there are now graphical demonstrations to provide easy exploration of filter parameters.SGI Indigo 2400 Sun SPARCstation 2 3600 Sun SPARCstation 10 9500 Convex C1 3700 IBM RS/6000 7000 HP 9000/700 7400 Cray X-MP 71000 Cray X-MP on a 500-by-500 matrix 135000
1. In addition.0?
. The toolbox has new functions to compute parametric models of signals and linear systems. and analog Bessel filters.

7.How do I import graphics into other applications? The MATLAB (version 4) print command provides a -deps argument which provides an Encapsulated PostScript file of your plot.
1. The MEX-file facility dynamically links your C or FORTRAN subroutine to the MATLAB program at run time.
1.2.
1. and terminate MATLAB.0 is currently in development. get data back. you can then call any MATLAB function. The release date is to be determined.
1. Your program is then in control and can access any MATLAB function.General MATLAB Questions
1.1.2.9.
. This new version will be released in the early Fall of 1994. you start MATLAB. and the recurrent Elman network.8." MATLAB's MEX-file facility allows any C or FORTRAN subroutine to be called directly from MATLAB. then call your program." MATLAB's MEX-file facility allows any C or FORTRAN subroutine to be called directly from MATLAB. Some suggestions: Removing the last line %%EOF from the eps-file.3. The MEX facility dynamically links your C or FORTRAN subroutine to the MATLAB program at runtime.3.2. To call a MATLAB function from your program.Can a C or FORTRAN subroutine be called directly from MATLAB?
Yes.1. The second way to call MATLAB routines from your program is to use MATLAB as a computational engine.3. radial basis functions for the efficient design of supervised feedforward networks. Some people have reported various problems getting this to work. send data and commands to it. there are two ways. A set of subroutines is provided that allows you to start MATLAB.
1. From inside your C or FORTRAN subroutine.Is there going to be a 4.2. the Levenberg-Marquardt training algorithm.Some significant improvements include the addition of trainlm .0 version of the Student Edition?
A Student Edition of MATLAB 4.User Questions
1. This way you can call any MATLAB routine from your FORTRAN or C function.Is there a MATLAB compiler?
A MATLAB compiler is currently in development.10.Can I call MATLAB routines from my C or FORTRAN programs?
Yes. The first is using "MEX-files. using "MEX-files.1. which allows you to create networks that can both recognize and generate temporal patterns.

2. there is a technical note written on this topic available on our anonymous ftp server. bbps. Functions are compiled into pseudo-code
. To set this up as a C shell script. or have your for loops run in MEX-files. If you are using scripts rather than functions.Why doesn't MATLAB run as fast as I expect it to? There are several things that can make MATLAB run slowly.edu ).gov . issue the command as:
matbat infile outfile
In MS Windows: You need to set the ratio for applications running in the foreground as opposed to running in the background.nasa. FOR loops take a long time to run in MATLAB (relatively).3. go into 386 Enhanced in your Windows Control Panel.1.txt .3. It can be found in pub/tech-support/tech-notes/mat4.purdue. You'll need to get GhostScript from your nearest GNU ftp site.1. write a file called matbat as:
#!/bin/csh set OLDDISPLAY=$DISPLAY unsetenv DISPLAY nohup matlab < $1 > $2 & setenv DISPLAY $OLDDISPLAY
To run this file.3. Try the following:
set OLDDISPLAY=$DISPLAY unsetenv DISPLAY nohup matlab < filein > fileout & setenv DISPLAY $OLDDISPLAY
where filein is the M-file you want to run and fileout is the file you want the output to go to. Use bbps and GhostScript. To set this ratio. This ratio will determine how well you can run MATLAB in the background. 1.Use the pstoepsi filter from Doug Crabill ( dgc@cs. You should avoid using them if at all possible.How do I run MATLAB in the background under UNIX? MS Windows? In UNIX: The nohup command and unsetting the display will allow you to run MATLAB in the background successfully even when you logout.shar is available via anonymous ftp on csi. Also. then MATLAB loads your script into memory one line at a time. every time you call it. You can change your ratio here. 1.jpl.

something like the following should appear in your startup. [ 10 10 610 610])
1.[5.. If you're running MATLAB 4. Make sure that you don't have any other large applications running in the background and that there aren't a lot of other people logged onto your machine. which allows you to set your colormap to 10 different sets of colors. etc. in MATLAB ? From gray@SCR.1.'DefaultTextFontName'.
.'Position'.1.3..'DefaultAxesFontSize'. There is a colormap command in MATLAB. How do I manipulate colormaps? When you use a function that calls a colormap.0]) %%N.x..'DefaultAxesFontName'.B this has side %%effects.'times') set(0. These things can also cause MATLAB to run slowly. the function assigns values in the matrix to certain values in the default colormap.505.12)
or from Brian Fitzgerald < fitzgb@mml0. Subsequent calls to the function are executed more quickly.
figure(1) set(1..405]) set(0.3. 1..slb. colors.com .5.edu > .meche. How can I change the default window size.and are loaded into memory the first time they are called.'DefaultFigurePosition'.rpi. set(0.[0.12) set(0.4.'DefaultFigureColor'.'times') set(0.0.m file:
set(0. The lowest value in your matrix is assigned to the first color in your colormap. For example.
colormap cool
gives you shades of cyan and magenta while
colormap jet
gives you shades of blue.5.'DefaultTextFontSize'.

3.
1.9.
>> lookfor fourier FFT FFT2 IFFT IFFT2 Discrete Fourier transform. 1988. These functions let you define the range of colors you will be using.You can set a limit on your colors using the functions caxis. How does the Random generator work? The algorithm for the rand function can be found in S. 10.8.1. The formula used for the seed is:
seed=(7^5*seed)mod(2^31-1)
If you want to set the initial seed to an random value. pg 1192-1201. 1.
FOURIER Graphics demo of Fourier series expansion. like 'apropos'? Yes.3.3. 32.6.fix(100*sum(clock)))
This will use the clock to set the seed. How can I get information about undocumented functions (like comet) in MATLAB? Most things in the /demos directory are not described in the MATLAB User's Guide." Comm. the demos are the best place to see examples of Handle Graphics. and cmax. ACM. 1. vol. Two-dimensional inverse discrete Fourier transform. Inverse discrete Fourier transform. There are other undocumented functions in directories other than /demos. 1.7. were written after the MATLAB User's Guide was sent to the printer. Is there a topical help function. A few. n.1. DFTMTX Discrete Fourier transform matrix. W. they are simply called by other functions. Some of them are "worker" functions that are unlikely to be used directly. The function you're looking for is lookfor (in MATLAB 4). K.1.0. type the following at the MATLAB prompt:
rand('SEED'. "Random Number Generators : Good ones are hard to find. In 4. cmin. Two-dimensional Fast Fourier Transform. Is there a Pseudo-Random Binary Sequence (PRBS) generator in MATLAB ?
. Oct. Miller.1. like comet and comet3. There are lots of goodies there. Park and K.3.

There is a PRBS generating M-file in the new Frequency Domain System Identification Toolbox, for lengths 2^2-1 to 2^30-1. Its name is mlbs (for Maximum Length Binary Sequence). 1.3.1.10. What is the numeric precision of MATLAB? In MATLAB, numeric quantities are represented as double precision floating point numbers. On most computers, such numbers have 53 significant binary bits, which is about 15 or 16 decimal digits. 1.3.1.11. How do I run MATLAB in batch mode? Here is an example of how to run MATLAB in batch mode from your UNIX prompt: Bourne shell example: (file called atfile.sh )

TERM=; export TERM matlab > inline.out << EOF a = [1 2] quit EOF

**Sample at command on Sun: (-s says use the Bourne shell)
**

% at -s now + 1 min atfile.sh

**C shell example: (file called atfile.csh )
**

setenv TERM matlab >! inline.out << EOF a = [1 2] quit EOF

**Sample at command on Sun:
**

% setenv SHELL '/bin/csh -f' % at now + 1 min atfile.csh % setenv SHELL /bin/csh

In summary, Define TERM in the script before you call MATLAB and make it part of the environment. Be sure that the right shell is used to execute the script. If your script is a C shell, you must do the SHELL change in order not to get any extra mail messages from the job. Remember that -f means that your .cshrc file will not be executed before you run the script. So, you cannot use any of the parameters set in the script.

1.3.2. Matrices

1.3.2.1. What is the largest matrix MATLAB can handle ? MATLAB itself has no limits on matrix or vector sizes. There are no fixed-size arrays dimensioned within the MATLAB program. MATLAB uses the dynamic memory allocation and virtual memory facilities provided by most operating systems to obtain its memory. Any limits on memory and hence matrix size are those imposed by the operating system or the hardware. On most computers, these limits can be set arbitrarily large by the user or the system manager. The Student Edition version is limited to variables of size 32 by 32. 1.3.2.2. How does MATLAB index its matrices ? MATLAB began as a FORTRAN program and we have kept the convention of beginning our indices at one instead of at zero. You also cannot have negative indices to vectors of matrices. 1.3.2.3. Can MATLAB handle multidimensional arrays ? Many MATLAB users commonly ask the question, "Can I use multidimensional arrays in MATLAB?" The anwser is both yes and no. No, in that multidimensional arrays are not built into MATLAB. MATLAB's internal data stucture is limited to a two-dimensional matrix. But you can create your own functions in the MATLAB language to handle multidimensional arrays. The following is an example that maps a three-dimensional matrix to a single vector. The indices are passed to a function as if it were a three-dimensional matrix. Then the indices are translated to a single vector with corresponding offsets. The exact implementation will be specific to what you want to accomplish.

%INDEX3 POSITION = INDEX3(d,i,j,k) index a 3-D array % d is a vector that specifies the dimensions on the array function position = index3(d,i,j,k) position = (i+(j-1)*d(2)+(k-1)*d(2)*d(3));

**The following is an example of how you might use this function.
**

D = [9 9 9]; A = 1:(9*9*9); A(index(D,5,4,4)) = 77; B = A(index(D,5,4,4)); % % % % D give the dimensions as 9x9x9 A is where your 3D data is Write to it Read from it % stored

You can create N-dimensional arrays with different limits on each dimension. The main difference is that you would change how the offset is indexed through your matrix. Each additional dimension would require a corresponding offset. You can add error checking for the indices to make sure you do not go out of bounds.

1.3.2.4. How can I initialize a low rank matrix easily ? Here's "Tony's trick," attributed to Tony Booer of Schlumberger: To initialize a matrix with values "a" in the first row and values "b" in the second row, do the following:

[a(1,ones(1,m)) ; b(1,ones(1,m))]

1.3.3. Functions

1.3.3.1. Why, when I edit a function file in MATLAB, is the change not seen by MATLAB until everything is cleared or MATLAB is restarted? When you write an M-file in MATLAB, you can either write a script or a function. The difference is that a script is read from the disk and parsed line by line each time it is called. A function is loaded into RAM for execution. Because it is loaded into RAM, when you edit a function, that change is not loaded into RAM until a call to the new function is made. To get MATLAB to recognize your edited function, type

clear functions

**to clear all functions, or
**

clear <function name>

to clear just your function out of RAM. 1.3.3.2. How can I get the parser to accept a dummy reference without an error? MATLAB parses code to look for syntax errors. When the parser encounters a name with two or less arguments, it lets them pass since they might be a variable with indices. If it encounters a name with three or more arguments, MATLAB knows it cannot be a variable, so the error message is returned. If you don't want the parser to snag the function, specify one with twp or less arguments. 1.3.3.3. Is there a GNU emacs editing mode for MATLAB? A GNU emacs 'matlab-mode' is available via anonymous ftp from csi.jpl.nasa.gov as pub/matlab/util/matlab-mode.el or, ftp.mathworks.com as

/pub/contrib/tools/matlab-mode.el.

1.3.3.4. Does MATLAB have a debugger? Yes, MATLAB does have a debugger. To find out more, type

3.txt. eval(['save '. eval(['print '. yi=ymin:0. ymin=min(y).y.
1. If your site doesn't have the Optimization Toolbox. xmax=max(x).3.y.4.yi.4.mat'.02*(xmax-xmin):xmax. contour(xi.5. What is griddata? How do I use it to contour irregularly spaced data?
griddatais a function that interpolates your data to generate evenly spaced data for plotting.1. name]).name]).5.3.3. MATLAB Functions
1. ymax=max(y).
1. save.yi).3.5.3.02*(ymax-ymin):ymax.mathworks.com in /pub/contrib/optim/fsolve35.2.5.help debug
at the MATLAB prompt.z.2. What is the sign convention used in MATLAB's fft routines?
. name = 'myfigure. you can get the old version of fsolvefrom
ftp.1. MathWorks did not feel that these algorithms met the standards required for approved software.
Example: x. How can I use a filename that is a variable as an input argument to the load.
1. eval(['load '. eval Command
1.z => irregularly spaced data
xmin=min(x). We recommend the version of fsolve in the Optimization Toolbox .3. zi=griddata(x.zi)
1.ps'. name]). xi=xmin:0.4.3. How does the eval command work? The eval command evaluates any expression given as its input. Why was fsolve removed from MATLAB Version 4? The algorithms used by fsolve were not numerically well behaved.
1.xi'. and print functions?
name = 'xyz. This is described in detail in a technical note which can be found on the ftp server in pub/tech-support/technotes/mat3.

3.2.3.3.1. The first version is traditionally used by engineers.
quad uses an adaptive recursive Simpson's rule.6.7.
1.x).
1.'r-') % plot the results
% polynomial
There is a technical note on fitting a function to data using leastsq which can be found on the ftp server under pub/tech-support/tech-notes/math4. and fprintf are all similar to their C counterparts and are used to read and
write data to a file.y. 1.File I/O
1. the second version by mathematicians. 1.9). In addition to ode23 . % create exponential data to be fitted c = polyfit(x. Also.1.5.'yo'.6. 1. Here is an example of how to use polyfit to fit data:
x = 1:10.list] = unix('ls *. quad . fwrite . fwrite. How do I fit a curve in MATLAB? There are many ways to fit a curve in MATLAB.2. and fprintf?
fread . quad8 .dat in a variable?
[tmp. The most common is to use polyfit to fit your data to a polynomial. quad8 uses an adaptive recursive Newton Cotes 8 panel rule. % evaluate the polynomial at x plot(x.4. there is an ode45 function.How can I store the result of ls *.7.dat'). How do I pass in extra parameters to ode and quad?
. y = exp(x).x.How do I use fread.y. Differential Equations
1.6.3. % generate coefficients for a fitted of degree 9 yfit = polyval(c.7.3.3. ode23. there is a technical note describing how to load and save data in MATLAB which can be found on the ftp server under pub/tech-support/tech-notes/io1. Can MATLAB solve Ordinary Differential Equations (ODE)? MATLAB has four basic functions to solve ODE's. To find out more. take a look at the online help available for these functions.yfit. Each of these requires the use of a file identifier. These functions allow you to specify the format in which you would like your data read or written.txt.3. and ode45 .txt.The fft in MATLAB is defined as sum(x(i)*exp(-j*i*k/N)) and not sum(x(i)*exp(j*i*k/N)). and ode23 uses the Runge-Kutta method. which uses a 4th and 5th order Runge-Kutta as opposed to ode23 's 2nd and
3rd order.

.. It can be found on the ftp site in pub/tech-support/tech-notes/math1.b) G = F(X.TRACE)
However. The call to quad and quad8 is as follows:
Q = quad8(F.If nonzero.A. Tfinal.. Y0)
where the inputs to the function are: F . T0. yprime . do as follows:
Q = quad8('F'.P2. trace . y0 . t0 .3.A.7. (Default: trace = 0 ). y .Final value of t..Returned derivative column-vector. P2.y) where F = 'fun' ..Time (scalar).Solution column-vector. take a look at the technical note on this topic.
To use default values for tol or trace .ode23 and ode45 are called as follows: = ode45('yprime'.)
This allows coefficients P1. you can pass in the empty matrix.e-6 ).TOL.P2. yprime(i) = dy(i)/dt... (Default: tol = 1. .The desired accuracy.3.txt.B.How do I do double integration in MATLAB?
. each step is printed. For more information.Initial value column-vector.P1. tfinal. to be passed directly to function F:
function g=f(a.B..TOL. t . tol . if you want to pass extra parameters to the function.TRACE.P1.Initial value of t. 1.).String containing name of user-supplied problem description. Call: yprime = fun(t.

and pressing the Virtual Memory button. pack compresses the data in memory.
OPTION 2: Go to the MATLAB bin directory (cd matlab/bin) Copy PCMATLAB. there is no more room in memory for new variables...Student Edition
1.9. install more memory. so it will look like this: set NO87=1 (there are no spaces on either side of the =. VAX/VMS: Ask your system manager to increase your working set.1.EXE to PACMATLAB. UNIX: Ask your system manager to increase your swap space.ORG.. because the binary codes for MATLAB are different from machine to machine.3. There is only one version of Student Edition for PC's.9.3. Macintosh: Under Multi-Finder. It can be found on the ftp site in pub/tech-support/tech-notes/math2.txt.) pcmatlab .
.3. and that is a letter O not the number 0.1. One way to free up space is to delete some variables (see clear ).
1.Memory
1. Here are some additional system specific tips: MS-Windows: Increase the swap space by opening the Control Panel.8.What can I do when MATLAB tells me I'm out of memory? If the OUT OF MEMORY error message is encountered. double-clicking on the 386 Enhanced icon. depending on your machine.bat file. Another is to issue the command pack (see pack ). add the following line above the pcmatlab line. Here are two fixes for the problem: OPTION 1: Edit the matlab. change the application memory size by using Get Info on the program icon. You must free up some space before you can proceed.A technical note has been written on how to do double integration in MATLAB. and open up larger contiguous blocks.
1.8.Why does my Student Edition hang my machine after the MATLAB banner is displayed? This happens from time to time. set
N087=1 ..3. Under Single-Finder.

At the colon prompt. You will be at the left margin with a minus sign.1.
. At the minus prompt. type rcs and it will return CS xyyy where x and y are numbers. You will be back at the DOS prompt. .
2. You will be back at the minus prompt. type 3F followed by a space. 1.9.2. This should return 3C. enter e zyyy:11 where z=x+3. on the same line. on the same line.EXE (using the DOS ren command). Immediately following zyyy:0011 25 . patches. Graphics
2. type D followed by a space. Immediately following FF. At the minus. Enter q and press return. type debug pcmatlab.3. This should return FF. you can have a handle to each object in a plot that contains many objects such as lines.DAT (using the DOS ren command) At the DOS prompt.dat and press enter.How do I print using the Student Edition? Directions on how to print using the Student Edition of MATLAB can be found in the Student Edition manual on pages 27-28.1. and surfaces.EXE to PCMATLAB. Using get and set
2. type 0 (zero) and press return. You will then be at the colon prompt. You should get back zyyy:0011 25 . What is a handle?
A handle is a number assigned by MATLAB to a graphics object.1. The text Writing 51F92 bytes will be displayed and you will be back at the minus prompt.DAT to PCMATLAB. Immediately following 3C. Rename PCMATLAB. then press return. For example. hit return and you'll get back the minus prompt. Enter w and press return.Rename PCMATLAB.

txt.'PropertyValue')
Don't put any spaces in the DefaultObjectPropertyName expression.1.Once you know the handle to an object.y)
2. figure . you first need to know the ancestor of the object whose property you wish to set. look at the MATLAB technical note written on this topic.1. patch .How do I change the default settings for an object's properties?
To set the default setting for an object. you would do the following:
handle=plot(x. For more information.'Parent')
To set the default.
2.'DefaultObjectPropertyName'.'DefaultLineLineWidth'. type the following:
set(handle)
This returns a list of all the properties associated with that object as well as each property's optional settings. To find out what properties are associated with each object. and image .
2. If you wanted to get the handle to a line when you plot it. you will be able to change the properties of the current figure or current axes without previously defining their handles. type the following:
h=get(object's_handle.What properties can I control?
To find out about an object's properties.'PropertyName') set(handle.1. you can alter its properties.'PropertyName'. It can be found on the ftp site in pub/tech-support/tech-notes/gr12. see axis . To find the parent of an object.2. surf . type the following:
set(h. The settings in { } are the default settings.4.10)
.'PropertyValue')
Two common handles are gca and gcf which stand for 'get current axes' and 'get current figure'. line . If you use gca or gcf as the handle in your get or set statement. A good example of how to do this is the following:
set(gca. How do I use get and set?
You can either get or set a property of an object in the following manner:
get(handle.3. respectively. root .

ylabel.2. TEXT.'factory')
2. TITLE.
h = get(gca. Inc. ZLABEL.Properties of the Figure and the Axes
2. and title to recognize changes to the default FontName and FontSize. the factory settings will still be used when drawing the title and lables on the screen. ht = get(text. Below are the revised programs:
<------XLABEL.
%
Copyright (c) 1984-92 by The MathWorks. if isempty(h)
.'DefaultLineLineWidth'. you would type:
set(gca.'fontsize').How do I change the default settings back to their original settings?
Set the default settings just as explained above.5. Fonts
How do I change the font of labels? When you change the default font name and font size.1. it would be just as easy to have it recognize changes to all the default text font properties. For example.
2. Following is a modified xlabel. however.M ------->
function xlabel(string) % XLABEL X-axis labels for 2-D and 3-D plots.Any line you plot after this statement will have a line width of 10. hs = get(text.2.'xlabel'). but use factory for the property value. zlabel. if you changed the default line width to 10 as above and then you wanted to set it back to the original setting. % % See also YLABEL. % XLABEL('text') adds text below the X-axis on the current % axis.'fontname').1.

<-------
ZLABEL.ht. set(gca. % % See also XLABEL. % YLABEL('text') adds text beside the Y-axis on the current % axis.'string'.'fontsize'. end set(h. hs = get(text. ZLABEL.'fontsize'.M ------->
function zlabel(string) % ZLABEL Z-axis labels for 3-D plots.'ylabel'.'string'. end set(h.'xlabel'. set(gca.string.'fontsize').
%
Copyright (c) 1984-92 by The MathWorks.hs). TITLE. Inc. ht = get(text.'fontname'. TEXT.'center').'ylabel'). if isempty(h) h = text.h).'fontname'.M ------->
function ylabel(string) % YLABEL Y-axis labels for 2-D and 3-D plots.h = text('HorizontalAlignment'.hs).h).
.'fontname').string.
<-------
YLABEL.ht.
h = get(gca.

set(gca.
% TITLE('text') adds text at the top of the current axis. end set(h. TEXT.'fontname'). ht = get(text.
h = get(gca.'title'). TEXT. % % See also XLABEL.
<-------
TITLE. Inc.
%
Copyright (c) 1984-92 by The MathWorks.M ------->
function title(string) % TITLE Titles for 2-D and 3-D plots.'fontsize'.
%
Copyright (c) 1984-92 by The MathWorks.'zlabel'.'string'.% ZLABEL('text') adds text above the Z-axis on the current % axis. YLABEL. YLABEL. Inc. if isempty(h) h = text.'fontsize').string. ht = get(text.
h = get(gca. % % See also XLABEL.
.'fontname'.'fontname').'zlabel').h).ht.hs). hs = get(text. ZLABEL. TITLE.

and FontItalic are also properties of axes.'font')
where his the handle to the text object. 2.'string'.
For more information. see the MATLAB technical note written on this topic.txt.y. do the following:
h=get(gca.
.1. For example. see the MATLAB technical note written on this topic.'fontsize'. if isempty(h) h = text('horiz'.2. 2. To implement:
h=text(x.1.'FontStyle'. 2.'courier')
will change the font of x and y tick labels before they are created.'FontName'.3.'FontName'.2. FontBold.1.2. It is located on the ftp site in pub/tech-support/tech-notes/gr6. and font is the name of the font you wish to use.'fontsize'). set(h.ht.font).string.'Xlabel'). typing:
set(gca. all the standard text object font properties such as FontName. see the MATLAB technical note written on this topic. end set(h.'center').hs = get(text.txt. It is located on the ftp site in pub/tech-support/tech-notes/gr2.
For more information.1. It is located on the ftp site in pub/tech-support/tech-notes/gr10.h). set(gca.'title'.'fontname'. To change the font of existing labels.'string') set(h. How do I get Greek letters in my text objects? You can obtain Greek characters from the symbol font. For more information.hs).'courier').txt.2. do the following
set(h.'FontName'. How do I change the font of text objects? To change the font name or font size of a text object.How do I change the font of tick labels? Although undocumented.

25 Jan 93 This is an unsupported. text(x.
where x and yare the coordinates on the graph where you want to place the Greek symbols.'symbol'). you can use the following M-file called chart.or
set(gca. Mfile.y. and num is the value from the list of 0-255 characters from the symbol font. Close figure when done. The Mathworks.. WHERE VALUE=( (16*XCOORD)+YCOORD) % % % make a new figure and axis
.m. purely for example.
function chart( fontname ) % CHART Show ANSI-chart like display of characters MATLAB %can produce. % % % % % % CHART( 'fontname' ) will put up a figure window with all 255 characters of the named font in a 16x16 grid.setstr(num)). You may want that memory back!
% % % % %
Chuck Packard.'FontName'. Inc. To display a table of the symbol font. it creates 256 text objects.
% TO USE THIS CHART: % USE SETSTR( VALUE).

'YDir'. 'Center') set(ax. 'YTick'. 'Bottom') % %not vectorized like all 'good' MATLAB M-files. 16. 'DefaultTextFontName'. for h=1:16 for v=1:16 gcf. %See manual for more info. written out in %full. fontname ) % %some other Handle Graphics settings. 'Box'. axis([-1 16 -1 16]) ax = gca. 'on') set(ax. % %set font to be used % set(ax. 'DefaultTextVerticalAlignment'.% (I'm assuming you want to keep the current graph in the % % figure. 'XTick'. 0:15. but %easier to understand! % x = reshape( 0:255.)
. 16 ). 'DefaultTextHorizontalAlignment'. 0:15) set(ax. 'Reverse'. % set(ax.

or font sizes within a text object.a4.h))).2. % % PRTLINES is used in the same manner as PRINT.2. % % The default line styles are: % %'. you cannot mix fonts.5.2.a3.1.a5) % PRTLINES is a front-end to PRINT which converts % solid lines to various line styles for graphical % output.setstr(x(v. end end
2. font styles.2.
% Non-solid lines are not affected.1. How do I change the line width? To change the line width.'LineWidth'.size)
where h is the handle to a line and size is the width you want.
2. The change is transparent to the user.v-1.text(h-1.2.2. Can I have multiple fonts in one text object? No. How do I change the line style order on printouts ? The following is an M-file that allows you to cycle through the line styles in the order you want when you print:
function prtlines(a1. 2.4. do the following:
set(h.2.2.a2. The default line width is 0. '
. Lines
2.

styles = [ '.' %'* ' %': ' %'-. % Create the array of line styles. or myself.%'o ' %'x ' %'+ ' %'.' %'--' % % The line style can be changed by editing the file % and changing the 'styles' array. % % SEE ALSO: PRINT.. Galenski III % All Rights Reserved % LDM101493jlg 10/14/93
%% PRTLINES is an M-file developed by me for my own %% personal use. Properties of LINE % Written by John L.com. Please direct
%% any questions or comments to johng@mathworks. ' 'o ' 'x '
. it is not supported %% by The MathWorks. Inc. and therefore.

'type' )) if strcmp(get(l(i). a = get(gcf.'linestyle').
if SI == 0 Add = 1. % Get the Children of the Figure.' '* ' ': ' '-.l(i)].'+ ' '. X = 0.length(styles)). for j = 1:length(a) l = sort(get(a(j).
. % Check the Children of 'a'. for i = 1:length(l) if strcmp( 'line'. If they are
% solid lines.'children')). then change their LineStyle % property.'-') X = X + 1.'linestyle'. LINE = [LINE.' '--' ]. styles(SI+Add.'children'). Add = 0. end set(l(i). SI = rem(X.:)). get(l(i).

PRTCMD = 'print'. How do I cycle through the line color order? You can set the default color order for the axes by doing the following:
set(gca. end
% Discard the changes so that the Figure is not % updated.' '.int2str(x)])].eval(['a'. drawnow discard
2. drawnow discard eval(PRTCMD)
% RESET THE LINESTYLES set(LINE.end end end end % Construct the PRTCMD.A)
.2.'ColorOrder'.'linestyle'. for x = 1:nargin PRTCMD = [PRTCMD.'-')
% Discard the changes so that the Figure is not % updated.3.2.

'on')
2. we recommend using normalized units.2. centimeters. Which units should I use? There are five different types of units you can use: inches.'Position'.'Color'.2.3.'Visible'.1. width.3.
2. do the following:
pos=[x_position. set(gcf. rather than with respect to the axes. place the following line in your startup.
2. and height are stored.2. height].'off')
This is very useful if you want to place text in the figure window with respect to the borders of the figure. y-position. 2.3.1.2. points. To change this. type cinvert at the MATLAB prompt. To make sure what you get out of your printer looks like what you have on your screen. width.where A is an RGB vector of any length. and pixels. How do I define an invisible axis? There is a property of the axis called Visible.3.'red')
. How do I change my background for plots?
To change the background color of your plot from black to white. Positions
2.3. type the following:
set(gcf. How do I change the size and position of my figure window? There is a property of the figure window called Position where the x-position.m file
whitebg
To change the color of your figure window to something other than black or white. y_position.pos)
2.3. You can set Visible to off as follows:
set(gca. normalized.2. To make the default setting white.3.3. How do I invert the background on my printout?
set(gcf.'InvertHardCopy'.2. Background Color
2.

Then select Copy. When the button or menu item is selected. the expression contained within the CallBack string is executed. Graphical User Interface (GUI)
2.'title'. To paste.2.
. Can graphics be saved as files to be imported back into MATLAB for viewing and alteration?
Yes.1.1. the function is stored in RAM and will execute more quickly if you are going to be using the button often.2. The most efficient way to write a CallBack is to make the CallBack a function. The command
print -dmfile <filename>
creates two files.
2. Using MATLAB Graphs with Other Packages
2. simply choose Paste from the Edit menu in your application. Handle values are not maintained. graphs are produced in such a way that.3. That way. filename. select Edit from the menu at the top of the Figure window.Can I edit MATLAB graphs in other applications?
In MATLAB version 4. 'CallBack'.2. you can edit it.'String'.
2.5. if your application allows you to view the imported figure.2. For example:
h=uicontrol('Style'.. How do I make a dialog box?
MATLAB version 4. The M-file contains the necessary object creation and set commands to reproduce the figure.4. Your figure now exists in the clipboard.. See help on dialog for more information. How do I copy and paste MATLAB graphs to the clipboard?
To copy and paste MATLAB figures to the clipboard.5. The generated MAT-file also contains the figure data.'PushButton'. hello will be displayed in the MATLAB workspace.'disp(''hello'')')'
When you push on the button.2 has some functions that will help you do this.2. How do CallBacks work? What is the best way to write a CallBack?
A CallBack is the specified action that MATLAB performs when the user selects the menu item to which the CallBack has been assigned. A new print command device driver option allows you to save and reload a figure. in MATLAB version 4.5.4.m and filename.mat..4.
2.
2.4.

set(gca.'xform').'w')
This will make the edgecolor for the whole waterfall a constant color and allow printing as well as display. Where do CallBacks get executed?
CallBacks get executed in MATLAB's main workspace.
2.
2.6. Why does waterfall return a blank screen?
There is a bug in the waterfall routine which prevents the edgecolor from being accurately represented. To work around this.
2.2. If a few patches have overlapping vertices.6.6.2. The following M-file will do the trick.4.6.'edgecolor'. the viewer. How do you get perspective with 3-D plots?
To change the ratio of the axis in a 3-D plot.3.
clf hold off
. How do I use multiple colormaps?
Here is an example:
% % Place a gray PCOLOR of PEAKS and hsv SURF of PEAKS in the same plot. d = diag([x y z 1]).y. Sometimes it chooses incorrectly. It determines which patch to draw first by determining which vertices of each patch are closest to you.6. The property transforms the 3-D data to be plotted on the 2-D screen. set(h.Miscellaneous
2.z) v = get(gca. issue the following two commands:
h=waterfall(peaks).
function aspect3(x.3. then MATLAB must choose which patch to draw first.5.
2.v*d).1. Why does MATLAB sometimes draw patches out of order?
MATLAB determines the order in which patches are drawn by using the Painter's Algorithm.'xform'. you will need to change the xform property of the current axis.

cd1 = z + abs(min(min(z))). shading interp
% Change the location so that it will be visible when % the SURFACE is drawn set(P.
. -30*ones(size(get(P.
% Place the PCOLOR P = pcolor(cd1).cd2). This will guarantee that they use
% different regions of the colormap.% Set the colormap colormap([gray(30).1:30.'zdata')))) hold on
% Place the SURFACE plot S = surf(1:30.
% Create the Cdata for the PCOLOR and SURFACE plot. cd2 = cd1 + max(max(cd1)) + 1. and % not overlap.'zdata'.hsv(30)])
% Generate the data = peaks(30).z. % The Cdata for each plot should be contiguous.

What is the difference between pcolor and image?
Each element in the image's CData is used to color a rectilinear patch. % %2) The range between the minimum and maximum
%values in Cdata should be the same for each %plot.5.
2.% Change the location so that it does not overlap the % PCOLOR %set(S.6. max(max(cd2))])
% Make sure that the VIEW and AXES limits are correct view(3) axis([1 30 1 30 -30 30])
% Rules that you need to follow when doing this. The data contains the row of the colormap used to color the patch.
%smallest and largest values of the 2 Cdatas.[min(min(cd1)).
.'zdata')) % Change the Clim used by AXES set(gca. % %3) % %4) Set Clim for AXES to range from the The Cdatas must be contiguous.'clim'.15+get(S.'zdata'. % %1) The Cdata values for each plot should
%not overlap.

How do I print in MATLAB?
To print a figure window from the command line. Each element of the CData corresponds to a vertex in the plot.1.2. you can print from the File pulldown menu. If you are working on a Macintosh or a PC. You would use this if you wanted to print to a printer that does not accept PostScript.1. How do I print a SIMULINK block diagram?
To print a SIMULINK block diagram. You can use the options found in help print when printing a SIMULINK diagram. General
3.GhostScript
3. it uses the default printer file format of your system.
3. Printing
3. you can also print from the File pulldown menu on the Figure window (for Macintoshes. the number of rectangles in pcolor is always one row and column smaller than the actual data. type print. just as you would print a figure.pcolor
is a surface plot and its CData is scaled into the colormap.
3. type print -f<systemname> at the MATLAB command line. If you would like to use any of the options.1. For a complete listing
. make sure the Figure window is the selected window). type
print -<option>
For more information. Therefore. If you are working on a Macintosh or a PC.What is GhostScript? How do I use it?
GhostScript is a shareware product that converts PostScript to other file formats.
3.2. If you just use print without any device.1. type
help print
at the MATLAB prompt.1.2.

2. and $MATLAB\GHOSTSCR\FONTS to C:\GS (where $MATLAB represents the MATLAB root directory) Copy the PostScript file to C:\GS CD to C:\GS
Execute the command GS386 <postscriptfilename>
where <postscriptfilename> is the whole name.doc. $MATLAB\GHOSTSCR\PS_FILES.2. including the .
3.Where can I get documentation for GhostScript?
To obtain a copy of use.2. If you do not have access to FTP.2. just use the print command and MATLAB will choose your system's default printer.How do you use GhostScript to display PostScript files to the screen from DOS?
There are three ways: Quickest way: Create a directory called C:\GS Copy all files in the directory $MATLAB\GHOSTSCR\BIN .ai.2.4. you get better quality printouts if you use a device that is specific to your printer. If there isn't a device that is compatible with your printer. Sometimes.edu
3. please contact Technical Support.ps extension. look to see if your printer is compatible with one of them.5. type help print at the MATLAB command line.What do I do if my printer isn't listed among the GhostScript devices?
If your printer is not listed among the GhostScript devices. try
.of GhostScript devices supported by MATLAB. If for some reason this doesn't work. you should specify the type of printer driver you will be using so as not to invoke the default.
3. you can download the file from the MathWorks FTP server in /pub/doc/ghostscrip.
3.3. Also. rather than using the default device (which is -dps ). if you are printing to a nonPostScript printer. The makers of GhostScript can be contacted at the following: Phone: 617-876-3296 Email:
gnu@prep.mit.Why would I print with a GhostScript device?
Users print with GhostScript devices if they want to generate a file on one system and print on another.

How do I know what option to use?
If you type
help print
at the MATLAB command line..
Clean but somewhat cumbersome: CD to the $MATLAB\GHOSTSCR\BIN directory Execute the command
GS386 -I. In the AUTOEXEC. you will see a list of options. How do I print out an HPGL format file?
.\PS_FILES -I.
3.3.BAT file.1.3.) Now to use GhostScript you can type gs386 <postscriptfilename> from any directory. Clean and easy but more permanent: Add $MATLAB\GHOSTSCR\BIN to your DOS path. specify the printer to use.$MATLAB\GHOSTSCR\FONTS
(where $MATLAB is replaced by the MATLAB root directory. Windows printing options and miscellaneous options. and print a SIMULINK diagram.
3.3. How do I print to a file?
To print to a file. type the following at the MATLAB prompt:
print -<device> <filename>
3. set an environment variable called GS_LIB as follows:
set GS_LIB = $MATLAB\GHOSTSCR\PS_FILES.3. append your graph to a file. There are two types of options.epsi file (which is an encapsulated PostScript file which can be previewed). Printing to a File
3.3.2.. The miscellaneous options allow you to create an .\FONTS <postscriptfilename>
where here <postscriptfilename> represents the full path name to the postscript file.DOS4GW GS386 <postscriptfilename> .

ur is upper right.4.0.
3. however. SIMULINK Printing
3.4. You will then be prompted for an output filename.
. find the instance in the . The diagram should then appear in the printout. 4.2 / SIMULINK 1. (search on bbox ) These numbers represent llx lly ulx ury.4. the text will not be centered well. In the lower left-hand corner of the Print box is an option to print to a file. The only way to generate an HPGL format file is on the Windows version where you must specify an HPGL printer driver as your default printer.
function printsys(sys) open_system(sys). How do I print my SIMULINK diagram on more than one page?
It is not possible to spread your SIMULINK diagram out over more than one page. -s). How do I print a SIMULINK model from within an M-file?
This only works for UNIX (because of the print switch. You cannot change this from inside MATLAB/SIMULINK.4. If it is off center (which it probably will be). This bug has been fixed in MATLAB 4. You can edit the PostScript file by hand. under the File pulldown menu.3. You can look near the top of the drawing commands to find the lines:
/Times-Roman findfont dpi2point mul 0 0 10 dpi2point mul neg 0 0]
The /Times-Roman is the font name you can change.4.ps file which has four numbers. the figure is mapped to landscape. where ll is lower left. Select this option and then select OK.3. Then. Remember. To move the position of a SIMULINK block diagram on the paper. etc.
3.What do I do if I am getting SIMULINK blocks and no text?
The workaround is to search the PostScript file for a sequence: 0 0 0 0 MR c np and comment out the line using a %.1 or 4. It has been added to the PC for MATLAB 4. How do I change fonts in SIMULINK?
SIMULINK models will always print with Times-Roman of point size 10. there is another place in the .
3.
3. then the words: bbox landscape csm .2. this option does not exist. so it gets rotated 90 degrees It may be necessary to play with these numbers to get good figure placement.1. Be warned. SIMULINK scales your diagram to fit on one page.2 there is a GhostScript device for HPGL. If you are using MATLAB 4.In MATLAB version 4.2.ps file to edit the position on the page.1. select Print.1. The occurance of 10 on the second line is the point size.4.

You may only see the top or bottom half of the text in question depending on where it is in the figure. This can be reproduced both from MATLAB and from MS EXCEL . This will print a blank piece of paper. the resources are not reallocated.:)) print('-s') end end close_system(sys)
3.5. do I start to have a problem printing?
When printing several plots.'blocks'). This happens to the point where either you can not print anymore or the machine you are working on crashes.1. = size(blocks). there is a depletion of the system resources under Windows.5. One way we have found to work around the problem is to print a blank Figure window before printing anything else to the LaserJet.'/'.2.:)]. Why does my printer hang when I try to print from the pulldown menu?
This appears to be a problem with the LaserJet IV driver initialization. you should be able to print without any problems.2. Windows will not reallocate system resources even after you have exited the application.5. though. Note that this blank Figure window only needs to be printed once per Windows session. after a long session of MATLAB under MS Windows where many figures printed. This has been fixed in 4.3.5. and also has the side effect of properly initializing the driver. Microsoft anticipates that Windows 4. There is no clean solution to this problem other than printing to a file first and then sending the file to the printer. Why don't my axis labels print correctly?
Sometimes.'/'.blocks=get_param(sys.
. If you quit and restart Windows for some reason.:)]) %disp(blocks(i. the output title and axis labels are not printed correctly. After this. you will need to reprint the blank figure.0 will do a better job in handling system resources.blocks(i.
3.'blocks')~=[] ) open_system([sys. You have to exit Windows and then restart Windows in order to get all of the system resources back.blocks(i. for i=1:r if( get_param([sys. This is more of a problem with Windows than MATLAB. Why.
3. and even after exiting MATLAB.Common Problems
3. when you set the paper position in order to generate a small figure.

the axis is very close in absolute coordinates (i. Why can't I print broken lines?
You are probably using the Windows driver or the actual printer driver that came with the printer.2. The same thing can be seen by making the window really small. 2. the PaperPosition. UNIX Workaround: Use the command capture . they are always some absolute distance from the axis line. which captures the current figure into a matrix. Since this method involves printing a bitmap image of the screen.5. When you've got a really small figure or have set the PaperPosition.3.[. Levels 4.5. Most other software packages break the lines before presenting them to the printer--we do not.5.Why can't I print UI controls?
You can't print UI controls because they are Motif/ Window widgets.'pos'.e. The new image can then be printed normally (but the uicontrols in the image don't work. and Motif/Windows only draws into an X Window/Window.2 . A possible work around:
set(gca.
.So that axis labels and tick mark labels do not overwrite each other. This is a trade off because you get really good fonts from the windows drivers but thin lines and you get less than perfect fonts from the GhostScript drivers but thicker lines. it's only 1/2" away rather than 3/4" from the edge of the window or the clipping edge of PaperPosition). you have the option of using the Windows/printer drivers to get broken lines but the lines will be thinner. when rendering to paper.2 .
3. and 1 of PCL do not support broken line types..'units'. PCL level 5 supports broken line types. You need to use the GhostScript drivers or use PCL 5.
3. and then displays it in another figure window using the image command. the printout may not have as high a print resolution as the hardcopy results of the print command.'norm')
Then adjust your output size to accommodate. The one caveat is that axis position is relative to the size of the figure and. not hardcopy devices.3 PCL 3---Laser jet 4.2 Release Notes. obviously).1 In version 4. which supports LaserJet 4's and up. PCL 5---Laser jet 4 PCL 4---Laser jet 4.3.2 of MATLAB.4. See page 84 of the 4.2 PCL 2---Laser jet 4. 3.7 .7].

but when you try to print this. each surface face is broken into 4x4 blocks and assigned a specific color to each of the blocks. These sections of the image can be "cut" using Windows PaintBrush program.0:.7.0:.zi] = griddata(x. This image can be pasted into another application for printing.1:10 and 0:. yi . In both cases.1. We have found that using the latest versions of these drivers will solve the problem. you should download the entire directory on to your PC and follow the instructions in the README file.5. and zi in your surface command. To increase the number of surface faces.z. use griddata :
[xi.
4.License Manager
4.Why.yi. and z are your original data. A copy of the current window will be placed on the clipboard.PC Workaround: There is no capture command for the PC version. when I use interpolated shading or print surfaces. If you find that this doesn't solve the problem. The latest DeskJet driver is also available on the ftp site in pub/tech-support/drivers/desk_drv . One undesirable attribute of this workaround is that the Windows window titles and menus are included in the image.y. To work around this problem. It is located on the ftp site in pub/tech-support/tech-notes/gr1.1:100 are your new and increased ranges for x and y . Select the figure that you want to print and press Alt-PrintScreen.txt.
3.1:100)
where x .1:10. use shading flat . One workaround is to use Windows handling of PRINTSCREEN.5. see the MATLAB technical note written on this topic. The latest LaserJet 4 driver is available on the ftp site in pub/tech-support/drivers/laser4_drv . y.What do I do if my PC beeps and hangs when I try to print?
This problem has been known to occur witth the LaserJet 4 and the DeskJet printer drivers. does my graph look "blocky" when the graph looked fine on the screen?
The reason for this is that when you use shading interp .Installing MATLAB
. 0:. Then use xi . simply increase the number of faces on your surface and don't use shading interp . each pixel can have a different RGB value.
3. please contact Technical Support.6. For more information.

both a SUN and a DEC using one license server. these instructions can be found in the README.
4. SUN MATLAB client machines should have their matlab command access $MATLAB/bin/matlab on the SUN platform. it is important for you to read your Installation Guide first.1.
4.License Configurations
4.When do I have to run the license manager?
You need to run the license manager in all but the following two cases: You have demo passcodes ( DEMO is located at the end of your encryption codes in your license.
. but we recommend against this since it involves a custom installation. See page 9 of your Installation Guide if you are running on a VAX or page 1-14 if you are running on a UNIX system. In this example we will consider the DEC machine to be the license server. This should describe the problem that is keeping you from running MATLAB. You can combine both installations of SUN and DEC MATLAB onto one machine.1. say.2. make sure the MATLAB client DEC machines have their matlab command access $MATLAB/bin/matlab on the DEC platform. using the install option for STANDALONE/SERVER machines.
4. In addition.1. a complete guide to the license manager can be found in README. For any client machines of the DEC and SUN. take a look at what is in the Output of lmstat -a section.1. Install MATLAB from the tape onto each machine.3. Decide which machine is the license server. However.2.Are there step by step instructions for installation?
Yes.dat file and you have more than key).license file which is located in your $MATLAB/etc directory. Once you have run the lmdebug script. Likewise.When should I run lmdebug?
You should run the script lmdebug if you are unable to start MATLAB.install file.2.dat file) You have a CPU locked Multi-User License (your hostid is located at the end of your encryption codes in your license. This description assumes that you have a separate DEC area where you will install DEC MATLAB and a separate SUN area where you will install SUN MATLAB.4.1.How do I set up the license manager so that it runs on a heterogeneous network?
A heterogeneous network means you're running a floating license on.

create a link for the license. cd /usr/local/matlab/etc .dat . Become root. It will not be able to run properly. how do I run a back-up server configuration?
This configuration is only allowable for floating network licenses. you cannot combine it with V4. cd /usr/local/matlab/etc . Become root. Login to piglet.5j on the SUN. the SUN MATLAB will call lmgrd on the DEC and place it in an incompatible state.dat file to point to the DEC $MATLAB/etc/license. Run lmstart . Run lmstart . cd /usr/local/matlab/etc . the DEC lm_matlab vendor daemon and passcodes based on the DEC lmhostid.2. Login to pooh.
. Become root.1 for the DEC since they contain incompatible versions of the license manager.2. In the SUN $MATLAB/etc directory.p>#License file for use
with FLEXlm version 2. follow the directions in the Installation Guide to place the Bourne shell code fragment into the appropriate boot script.On a UNIX network.4c. if you have V3. do the following after installation. Run lmstart. To have the license manager daemons started at boot time. they must be using compatible versions of the license manager. For example. Keep in mind that for different platforms to work together. SERVER pooh 55419ab7 1705 SERVER piglet 554251b8 1705 SERVER rabbit 52006ac1 1705 DAEMON MLM /usr/local/matlab/etc/lm_matlab FEATURE MATLAB MLM 1 01-jun-2012 99 6B283ACADCE90BE190B7 "" FEATURE SIMULINK MLM 1 01-jun-2012 99 EB689A7AE885CDB2E0A3 ""
---------------------------------------------------------------------------To bring up the three license managers interactively. Consider the following license file using a Sun-4 based license manager: ---------------------------------------------------------------------------.The DEC license file should contain the DEC lmhostid. More specifically. Login to rabbit.
4. Start the license manager from the DEC license server machine.

The first server will be the primary server and if this machine fails.p>#License file for use
with FLEXlm version 2. as root. If only one of the three machines is running. no licenses will be available until a second server regains a running status. The order of the servers is also important. This is so that the temporary license file in /usr/tmp can be created correctly. the primary server will be designated as the next server listed in the license file. you could not combine two counted licenses of the same FEATURE names in the license.dat file. Consider having both MATLAB and another vendor's daemons started by MATLAB's license manager daemon with the following license file: ---------------------------------------------------------------------------.4c of the license manager offered the option to enable multiple FEATURE lines of the same name into one license. This example demonstrates what needs to be done.3.The /etc/lmboot link must exist on each of the servers. it is necessary to place all the floating license FEATURE lines before all the node-locked FEATURE lines. To start other vendors' daemons you must create: A merged license. Please note that at least two of the machines must always be running in order to create a network quorum. After installation the lmboot script needs to be modifed to know about each additional vendor daemon in the license file. For this to work. You must submit all three servers' hostids in order for the passcodes to be be properly generated for this configuration.
4.dat file.2. To create this link on a given server.dat file with all the DAEMON and FEATURE lines associated with each vendor daemon. SERVER radical 52201985 1700
. first login to the server and then. V2.4c. this was not possible.dat files if I am running another vendor that uses FlexLM?
In V2. run:
# $MATLAB/etc/lmboot -s
where $MATLAB is the location of the MATLAB root directory. A modified $MATLAB/etc/lmboot script.How do I combine license.21 (or older) of the license manager.

then three more lines for each daemon must be added.vd$ndaemon .. In order for the process command names given by the ps command to look the same across platforms. Below is a Bourne shell code section from lmboot .. the symbolic link created in the three-line script section above should refer to a binary daemon program. For PVI it would be
PVI) ln -s $daemonPath /usr/tmp/$marker. not a script.
Note that these lines for PVI are already shipped in the script. except the lines are commented out.100 01-aug-1995 1CBB4ACD78C0C77ABE123 ""
---------------------------------------------------------------------------You need to remember the DAEMON names when making the code changes. It must be the name of the DAEMON.
The only thing that should change is NAME . To activate them simply remove the # or comment character from the beginning of the lines as indicated below. For each DAEMON you must add three lines such as:
NAME) ln -s $daemonPath /usr/tmp/$marker. If there are additional daemons.# DAEMON MLM /usr/local/matlab/etc/lm_matlab FEATURE MATLAB MLM 1 01-aug-1995 3 6B486F9FDB9F99083820 "" FEATURE SIMULINK MLM 1 01-aug-1995 3 8B38FF3F695F028F93A8 "" FEATURE Control_Toolbox MLM 1 01-aug-1995 3 2B18BFEF0BB457E414B5 "" # DAEMON XXX /usr/local/XXX/license/bin/XXX FEATURE XXX XXX 3. This means the daemon path given by the third field of the DAEMON
. In this case the only additional DAEMON name is XXX . The part between the "======" lines must be modifed.vd$ndaemon .

# #Create temporary license.vd* > /dev/null 2>&1 ndaemon=0.dat file by copying and modifying the original file # rm -f /usr/tmp/$marker.line (referred to as $daemonPath in the script) should be a path to a binary program. # PVI) # Use the daemonPath . PV-WAVE.vd$ndaemon . #============================================================ # ADD OTHER DAEMONS HERE. Note that for MATLAB this is not true. Example. # Add other case statments for additional daemons.. (while read line do field1=`echo $line | awk '{print $1}'` if [ "$field1" = "DAEMON" ].arch binary already
. So a special value for the daemon path which refers directly to the binary is used. Uncomment lines. then daemonName=`echo $line | awk '{print $2}'` # field 2 daemonPath=`echo $line | awk '{print $3}'` # field 3 ndaemon=`expr $ndaemon + 1` case "$daemonName" in # Always assume $MATLAB/etc/$Arch/lm_matlab # Must use the binary .NO SCRIPTS ln -s $MATLAB/etc/$Arch/lm_matlab /usr/tmp/$marker.dat > /dev/null 2>&1 rm -f /usr/tmp/$marker.

vd$ndaemon ..How do I run two versions of MATLAB on a VAX?
The MATLAB environment. Fix $MATLAB/etc/lmboot script.dat else echo "$line" >> /usr/tmp/$marker. consists of two logical names.1` #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ echo '' echo 'Sorry! Skipped following DAEMON line.' echo '' echo "$line" echo '' #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ continue .vd$ndaemon%" >> /usr/tmp/$marker. esac echo "$line" | sed "s%$daemonPath%/usr/tmp/$marker..4. which needs to be modified to run different versions of MATLAB.
MATLAB TOOLBOX
.ln -s $daemonPath /usr/tmp/$marker. #============================================================ *) # daemons you forgot ndaemon=`expr $ndaemon .2.dat fi done) < $licensefile
4.

COM and exit. With a CPU-locked MultiUser license.COM .COM from SYS$MANAGER:SYSTARTUP_V5. the license daemons do not need to be run.COM at login time.3.COM from SYS$MANAGER:SYLOGIN. The lines in MATLAB_SYSTARTUP.TOOLBOX.Common Error Messages:
4. so you should try starting MATLAB and let us know if you're getting any errors.When installed as described by the installation document. omit steps 8 and 9 of the installation procedure. From these lines remove the "/SYSTEM" qualifier.1. so they look like this:
$ DEFINE/EXEC/TRANS=CONCEALED MATLAB DISK$USER:[MATLAB.3. Instead.COM which define the logical names MATLAB and TOOLBOX to MATLAB_SYLOGIN.Cannot Connect to License Server
Possible Solutions: Check whether the license daemons are running.x simply type:
@DISK$USER:[MATLAB. (Do not save MATLAB_SYSTARTUP.5 environment and have the ability to run MATLAB v4.x.]
Place these lines so they are the first commands to executed by the file. such as CMEX. following completion of the installation procedure.]
Save MATLAB_SYLOGIN.] $ DEFINE/SYSTEM/EXEC/TRANS=CONCEALED TOOLBOX DISK$USER:[MATLAB.TOOLBOX.
. (See installation guide steps 8) Symbols used to invoke MATLAB and its utilities. are defined on a per-process basis through the execution of MATLAB:[ETC]MATLAB_SYLOGIN.] $ DEFINE/EXEC/TRANS=CONCEALED TOOLBOX DISK$USER:[MATLAB. (See Installation Guide step 9) If you want to maintain a MATLAB v3.COM look like this:
$ DEFINE/SYSTEM/EXEC/TRANS=CONCEALED MATLAB DISK$USER:[MATLAB.COM . perform the following steps using the editor of your choice: Copy the lines from MATLAB_SYSTARTUP. If the license daemons are not running.COM .ETC]MATLAB_SYLOGIN
4. the logical names are defined on a system-wide basis at boot time through the execution of MATLAB:[ETC]MATLAB_SYSTARTUP.) Now to setup the environment to run V4. you should execute lstmart . however. Do a ps as indicated in the troubleshooting section of the Installation Guide.

Make sure the host name on the SERVER line in the license. this error will occur if Signal_Toolbox is entered as signal_toolbox . Make sure the FEATURE line matches the passcodes as generated by The MathWorks. therefore.3. <hostname> is not responding .3. Inc.
4. then there is a problem with your network configuration such that connection to that machine will fail.
4. ping <hostname> where hostname is the name of the machine from which you're trying to run MATLAB.3.5. To check. Connection to the license daemons will. If the ping command returns the error.XXX Feature is not Currently Licensed
Possible Solution: It may be a typographical error in the feature line indicated by the error.3. For example. You probably do not have 1700 at the end of the SERVER line in the license. $MATLAB/bin/sun4.dat file.
4. Note that sun4 can be replaced with any architecture we support.Invalid Returned Data From License Server
. the license manager requires TCPIP. say. Check the error message for typographical errors and case sensitivity in the name of the feature.No TCP License Server Exists
Possible Solutions: You do not have TCPIP software on your machine. Make sure the the UNIX ping <hostname> command returns <hostname> is alive where hostname is the name of the MATLAB server machine. Make sure that the network software TCPIP is running on your machine. rather than the matlab script in $MATLAB/bin. e.. If ping is successful. Even for stand-alone machines. like RS/6000.dat file is pointing to the correct location for lm_matlab .g.4.2. You may have the wrong matlab on the UNIX path or you may need to rerun install_matlab to set up the correct paths.Environment Variable of lm_license_file Not Defined
Possible Solution: The user is running the matlab executable in.dat file is correct.
4. see (2) below. also fail.3. execute the UNIX ping command.Check that the DAEMON line in the license.

4c) without shutting the old (v2. You can also try doing an lmreread .dat file.3.1.
4.
5. The VAX C runtime library access routine explicitly does not support access to a file through DECNET. You need to execute lmstart in V4.How do I print my SIMULINK model? To print a SIMULINK block diagram. Make sure you do not have a typographical error in the FEATURE line spelling. You can use the options found in help print when printing a SIMULINK diagram.1.21) license daemons.3.
4.1.1.1 of MATLAB which executes the lmgrd and lm_matlab license daemons which ship with MATLAB 4.1.SIMULINK/MEX-Files/Engine
5. This license.
.dat can be a VAX CLUSTER file.Possible Solution: You probably installed the latest version of MATLAB (which uses FLEX 2.7.SIMULINK
5.1.Printing SIMULINK models
5. MATLAB compiled with the VAX C compiler does not support accessing a license file through DECNET. This is because access to the license file is checked with a C standard runtime library routine called access. LM_LICENSE_FILE must point to a local license.1. This error indicates that you are running a version of FLEXlm older than 2. type print -f<systemname> at the MATLAB command line.License Server Does Not Support This Feature
Possible Solutions: You probably received new codes and did not restart the license manager. which is the equivalent of NFS mounting under UNIX.Unable to Read License File
Possible Solution: The problem occurs with the logical LM_LICENSE_FILE set to NODE:FILE_SPEC.6.4c.

General Questions
5.1.3.MATLAB Function block
5.Why doesn't the text on my SIMULINK diagram print out? This was a bug in SIMULINK version 1. The real and imaginary parts must be separated and handled independently.3. just as you would print a figure.If you are working on a Macintosh or a PC.1.Can SIMULINK handle complex signals? No.What is the difference between the MATLAB Function block and the function block? The MATLAB Function block can perform any function in MATLAB. 5.2 and MATLAB versions 4.Why can't I call any MATLAB function from the MATLAB Function block? The MATLAB Function block can take any number of inputs.1.
5.1. This block uses C routines to perform the calculations and is therefore very fast.txt. which can be found in pub/techsupport/tech-notes/sim3.
5.3.txt.1.3.1. 5.2. The current releases through 1.2.1. It has been fixed in SIMULINK version 1.3 are not designed to handle complex data. but it must return a vector as an output.2.1.txt.
. 5. The Function block can use only a limited number of functions (the list of these functions can be found by clicking on Help in the function block).
5. 5.1. whether it is a function you have written or one that comes with MATLAB.1.2.2.1.3.How do I use the set_param and get_param functions? There is a technical note which explains how to use these two functions which can be found on the ftp server in pub/tech-support/tech-notes/sim6. you can print from the File menu.How do I mask SIMULINK blocks? There is a technical note on masking SIMULINK blocks.1.4.2.2.3.0 thru 4.1.Why doesn't linmod return the correct results? There is a technical note which explains the uses and limitations of linmod which can be found in pub/tech-support/tech-notes/sim2.3 and MATLAB version 4.1.

u. sys= x(1). set(hs2.How do I display values numerically. . Are there any examples of S-functions in C? FORTRAN? Aside from the examples.'DIG_SCOPE')...1.5.tempstr ). To find out more about these. 'string' ). end set( x(1) . 5.'normal'. contact support@mathworks.'string'.8 . else sys=[].1. sys=[0 1 0 1 0 0]. 3.
5.1.'style'.2.1..'pos'.2.100).3. elseif abs(flag)==2. hs2=uicontrol(hs1. whether or not some flags have been skipped.x0]=show(t. hs1=figure('units'. which can be found in the directory /simulink/blocks .2.flag) if abs(flag)==0. x0= hs2. % Keep the last 50 values [m n]=size(newstr). which was written by one of the Technical Support Engineers:
function[sys. 2. our engineers are starting to build a library of examples.4. MEX-Files and Engine
5. but flag calls are always made in this order. if m>50. newstr). It might not call all of these flags..What is the flag ordering for S-functions? SIMULINK makes calls with flags in the following order: 4. 'string'.1.0.8 . Compilers we support
.1 .x.S-functions
5.4.com .'units'.'min'. tempstr=get( x(1) . end
5. 1.1.:).[0 0 1 1].4. newstr=newstr(1:50.'pos'.'normal'.. rather than graphically (with the scope)? The following is an S-function example. 'edit'.[. newstr=str2mat( num2str(u).4.'max'.2]).

for (i=0.userdata. buffer=mxCalloc(201.i+1). and
pub/tech-support/tech-notes/mxeng4.Where can I get C MEX-file function examples? Aside from the many C MEX-file examples. char * buffer. int i.Are there any engine examples? The following is an example of a program that uses the MATLAB Engine to find the Hankel matrix:
#include <stdio.There is a technical note.i++) { printf("Enter element #%d: ". double userdata[3]. engOutputBuffer(ep.2."Error opening MATLAB"). How do I write a C++ MEX-file function? A descripton of how to create C++ MEX-file functions is in a technical note which can be found on the ftp server in pub/tech-support/tech-notes/mxeng5. which contains a list of compilers along with many addresses and phone numbers for compiler companies.buffer. } ep=engOpen("setenv DISPLAY puff:0."Error entering data into MATLAB").2.i<3.MEX-File function examples
5.2."mystuff".1. exit(-1). } if engPutFull(ep.2.NULL) fprintf(stderr. which can be found in the $MATLAB/exter/src directory.txt. other examples can be found in pub/tech-support/tech-notes/mxeng3.1. 5. if(ep==NULL) { fprintf(stderr. This technical note can be found in pub/techsupport/tech-notes/mxeng1.txt.2.3. 5. scanf("%lf".4.2.2.sizeof(char)).h" int main( void ) { Engine * ep.&userdata[i]).2.2.
5.Are there any FORTRAN MEX-file examples? There are many FORTRAN MEX-file examples which can be found in the $MATLAB/exter/src directory.2.h> #include "engine. matlab").txt.
5.3.
.txt.2.200).

2.buffer). Common Problems
5. else printf("Hankel Matrix was \n%s\n".2.1.3. Why an I getting a segmentation violation error? Segmentation violation errors occur when MATLAB tries to write to an area of memory that is not allowed.if(engEvalString("hankel(mystuff)")) fprintf(stderr.
. mxFree(buffer). use of pointers which contain incorrect values. You should check your MEX-file function to see if any of these possibilities are occurring."Error using hankel"). engClose(ep). Some possible causes of this are improper dereferencing of pointers.3. and writing past the end of a dimensioned array. }
5.