User`s manual
v
Java Methods That Affect MATLAB Commands . . . . . . . . . . . 5-26
How MATLAB Handles Undefined Methods . . . . . . . . . . . . . . 5-27
How MATLAB Handles Java Exceptions . . . . . . . . . . . . . . . . . 5-28
Working with Java Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-29
How MATLAB Represents the Java Array . . . . . . . . . . . . . . . 5-30
Creating an Array of Objects Within MATLAB . . . . . . . . . . . . 5-34
Accessing Elements of a Java Array . . . . . . . . . . . . . . . . . . . . . 5-36
Assigning to a Java Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-39
Concatenating Java Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-43
Creating a New Array Reference . . . . . . . . . . . . . . . . . . . . . . . 5-44
Creating a Copy of a Java Array . . . . . . . . . . . . . . . . . . . . . . . . 5-45
Passing Data to a Java Method . . . . . . . . . . . . . . . . . . . . . . . . 5-46
Conversion of MATLAB Argument Data . . . . . . . . . . . . . . . . . 5-46
Passing Built-In Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-48
Passing String Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-49
Passing Java Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-50
Other Data Conversion Topics . . . . . . . . . . . . . . . . . . . . . . . . . 5-53
Passing Data to Overloaded Methods . . . . . . . . . . . . . . . . . . . . 5-54
Handling Data Returned from a Java Method . . . . . . . . . . 5-56
Conversion of Java Return Data . . . . . . . . . . . . . . . . . . . . . . . . 5-56
Built-In Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-57
Java Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-57
Converting Objects to MATLAB Data Types . . . . . . . . . . . . . . 5-57
Introduction to Programming Examples . . . . . . . . . . . . . . . 5-62
Example – Reading a URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-63
Description of URLdemo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-63
Running the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-64
Example – Finding an Internet Protocol Address . . . . . . . . 5-66
Description of resolveip . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-66
Running the Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-67