Using the C++ Math Library |
 |
MATLAB C++ Math Library Documentation
The complete documentation set for the MATLAB C++ Math Library consists of printed and online publications:
- MATLAB C++ Math Library User's Guide--This manual provides tutorial information about the library. This manual is also available in PDF format, accessible through the Help Desk.
- MATLAB C++ Math Library Reference--The reference pages for all the MATLAB C++ Math library routines are available in HTML and PDF versions, accessible through the Help Desk.
How This Book Is Organized
This chapter provides an introduction to the MATLAB C++ Math Library and tells how to install it. In addition, it includes information about building applications. The remainder of the book is organized as follows:
- Chapter 2, Fundamentals. This chapter describes the basic concepts, assumptions, and data structures of MATLAB and the MATLAB C++ Math Library. It also provides an introduction to C++ for MATLAB users and an overview of MATLAB for C++ programmers. If you are new to MATLAB or C++, you should read this chapter.
- Chapter 3, Working with MATLAB Arrays. Arrays are the fundamental MATLAB data type. This chapter describes how to create MATLAB arrays in your C++ program.
- Chapter 4, Indexing into Arrays. This chapter describes how to access individual elements, or groups of elements, in an array. Using indexing you can access, modify, or delete elements in an array.
- Chapter 5, Calling Library Functions. This chapter describes the MATLAB C++ Math Library interface to the MATLAB functions. This chapter describes how to call MATLAB functions that accept any number of input and output arguments.
- Chapter 6, Using the Mathematical Operators. This chapter describes the difference between array and matrix operators and documents where the library overloads C++ operators and where you must call functions that are equivalent to a MATLAB operator.
- Chapter 7, Printing, Exceptions, and Memory Management. This chapter describes how to use the MATLAB C++ Math Library routines in a C++ program. The chapter includes specific information about handling errors and writing your own print handler.
- Chapter 8, Array Input and Output. This chapter describes the library's three input/output mechanisms: input and output streams,
fprintf()
and fscanf()
, and load()
and save()
.
- Chapter 9, Translating from MATLAB to C++. This chapter compares the MATLAB language to C++.
- Chapter 10, mwArray Class Interface. This chapter documents the public interface of the
mwArray
class.
- Chapter 11, Library Routines. This chapter groups the more than 400 library functions into functional categories and provides a short description of each function.
- Appendix A: Directory Organization. Installing the MATLAB C++ Math Library creates several new directories on your computer. This appendix provides a road map to the directories and their contents for PC systems running Microsoft Windows and UNIX workstations.
- Appendix B: Exception Classes. This appendix describes the hierarchy of exception classes defined by the library.
- Appendix C: Error Messages. This appendix provides a reference to the error messages issued by the library.
Accessing Online Reference Documentation
To access the MATLAB online documentation, select the Help option from the MATLAB menu bar. MATLAB C Math Library documentation is available in in HTML and PDF formats.
To look up the syntax and behavior for a C Math Library function, refer to the MATLAB C Math Library Reference. This reference gives you access to a reference page for each function. Each page presents the function's C syntax and links you to the online MATLAB Function Reference page for the corresponding MATLAB function.
If you are a stand-alone Math Library user:
- Open the HTML file
<matlab>/help/mathlib.html
with your Web browser, where <matlab>
is the top-level directory where you installed the MATLAB C++ Math Library.
- Select MATLAB C++ Math Library Reference.
Additional Sources
- Release notes for the MATLAB C++ Math Library
- MATLAB C Math Library User's Guide
- MATLAB C Math Library Reference
MATLAB Application Program Interface Guide
- MATLAB Application Program Interface Reference
- MATLAB Function Reference
- Installation Guide for UNIX
- Installation Guide for PC
For general information about C++ programming language, see:
C++ Primer 2nd Ed., Lippman, Stanley, Addison Wesley, 1993
Getting Started Quickly
Depending on your experience with other MathWorks products, your knowledge of C++, and your goals, you may not need to read this book in its entirety. If you are eager to get started, the following sections give you a solid understanding of programming with the MATLAB C++ Math Library.
- Example Program: Handling Exceptions (ex5.cpp) in Chapter 7 demonstrates most of the features of the library: creating matrices, writing and calling your own functions, printing matrices, and handling errors.
- Building C++ Applications explains how to build and run the example programs with the
mbuild
script. This is highly recommended reading.
- Differences Between C++ and MATLAB in Chapter 9 details the differences between MATLAB and C++, and provides information about the MATLAB C++ Math Library.
- "Working with MATLAB Arrays in Chapter 3," explains how to create an array and why some ways are more efficient than others. MATLAB C++ Math Library arrays are considerably different from C++ two-dimensional arrays. Study this section with care.
- "Indexing into Arrays in Chapter 4," explains how to apply subscripts to arrays. The indexing facility, which is a fundamental part of the MATLAB C++ Math Library, is quite powerful, but may occasionally give you unexpected results if you do not understand how and why it works the way it does.
Reading only these sections means you omit a lot of detail and risk stumbling through parts of the library that you don't understand. However, if you read and understand these six sections, you can do useful work with this library.
| New MATLAB C++ Math Library Features | | Installing the C++ Math Library |  |