Programming for Chemical Engineers Using C, C++, and MATLAB

Chapter 9: Interfacing MATLAB With C

OVERVIEW

Having appreciated the power of C/C++ and the convenience of MATLAB, this chapter will teach us how to take advantage of these programming languages. Based on the fact that MATLAB was developed using C, and C++, interfacing between the languages is quite feasible.

This chapter will teach us how to call C routines from MATLAB and use MATLAB's existing libraries from the C program through the following:

Introduction to MEX-files

  • Components of MEX-files

  • MATLAB Supported C Compilers

Handling Scalars

  • One Scalar Input and One Scalar Output

  • Two Scalar Inputs and One Scalar Output

Handling Vectors

  • One Vector Input and One Scalar Output

Handling Matrices

  • Multiple Matrix Inputs and One Vector Output

Previous Evaporation Problems Revisited

  • Single-Effect Evaporator Problem

  • Triple-Effect Evaporator Problem

Introduction to MATLAB Engine

  • Components of MATLAB Engine

  • Example on Plotting

  • Compiling Engine Programs

Modified Distillation Program

All program listings discussed in this chapter can be found on the CD-ROM.

\Program Listings\Chapter 9\CtoF.c        Program Listing 9.2\Program Listings\Chapter 9\dewpoint.c    Program Listing 9.3\Program Listings\Chapter 9\muller.c      Program Listing 9.4\Program Listings\Chapter 9\simplex.c     Program Listing 9.5\Program Listings\Chapter 9\enthalpy_l.c  Program Listing 9.6\Program Listings\Chapter 9\enthalpy_v.c  Program Listing 9.7\Program Listings\Chapter 9\PL9_8.m       Program Listing 9.8\Program Listings\Chapter 9\PL9_9.c       Program Listing 9.9\Program Listings\Chapter 9\PL9_10.c      Program Listing 9.10

INTRODUCTION TO MEX-FILES

Throughout the book we have been discussing the benefits and features...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Robot Software
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.