4 Using MWArra y Classes
Example — Making a Shared Copy of a Character Array Object
Create a shared copy of MWCharArray object A:
char[] chArray = {'H', 'e', 'l', 'l', 'o'};
MWCharArray A = new MWCharArray(chArray);
Object S = A.sharedCopy();
System.out.print("Shared copy of matrix A is \"" +
S.toString() + "\"");
When run, the example displays this output:
Shared copy of matrix A is "Hello"
toString. MWCharArray inherits this method from the MWArray class.
Using MWStructArray
This section cov ers the following topics:
• “Constructing an MWStructArray” on page 4-118
• “Methods to Destroy an MWStructArray” on page 4-120
• “Methods to Return Information About an MWStructArray” on page 4-121
• “Methods to Get and Set Data in the M WStructArray” on page 4-124
• “Methods to Copy, Convert, and Compare MWStructArrays” on page 4 -132
Constructing an MWStructArray
Use the table s in this section to constru ct an MWStructArray from a particular
Java data type. See the e xamples at the end of this section for m ore help.
Constructing an Empty Structure Array. To construct an empty 0-by-0
MATLAB structure a rray, use
MWStructArray()
4-118
Komentarze do niniejszej Instrukcji