MWArray: Non-conventional-Matlab terminology for data types and arrays?

1 次查看(过去 30 天)
As far as I know, and based on the thread "scalar vs matrix vs vector vs array??", a double array in Matlab is an array of type double. A scalar is a single-element array, so the number of dimensions is irrelevant. An array can have any number of dimensions, some of which may have zero size.
The above meanings of double and scalar seem to differ from the "MWNumericArray" documentation:
MWNumericArray(boolean rVal, boolean iVal, MWClassID classid)
Constructs a complex numeric double array that represents the
primitive boolean arguments.
MWNumericArray(boolean rVal, MWClassID classid)
Constructs a real scalar numeric array that represents the
primitive boolean argument.
MWNumericArray(byte rVal)
Constructs a real scalar numeric array of type MWClassID.INT8
that represents the primitive byte argument.
MWNumericArray(byte rVal, byte iVal)
Constructs a complex scalar numeric array of type
MWClassID.INT8 that represents the primitive byte arguments.
In the first function call, what is meant by "complex numeric double array"? Is it a single-element array, with the 1 element using a double for the real part and a double for the imaginary part? Shouldn't the precision be determined by the "classid" argument?
Unlike the first call, the second function call returns a "real scalar numeric". Why is the word "scalar" used here but not in the first call? Is "scalar" being used differently from Matlab to mean non-complex?
If that is the case, then why is the 4th function call also described as returning "complex scalar numeric array)?
AFTERNOTE: Finding even more undefined terminology as I try to reference the information more. For example, the `getDouble` method sometimes returns a "1-based index-array as a double". The internet doesn't seem to return a meaning for "index-array" in the context of Java. (After much mulling & digging: "Index" probably refers to the purpose of the array rather than how the array is realized. Such an array of length "n" contains the coordinates of a single element in an n-dimensional array)

采纳的回答

Todd Flanagan
Todd Flanagan 2020-10-29
编辑:Todd Flanagan 2020-10-29
MWNumericArray(boolean rVal, boolean iVal, MWClassID classid)
This signature will take Java booleans and convert them to classid in MATLAB. There are Java signatures for all of the supported Java types like boolean, int8, double, etc.
boolean r = false;
boolean i = true;
MWNumericArray a = new MWNumericArray(r, i, MWClassID.LOGICAL);
In this case, if classid is "logical", there will be no conversion.
If classid is double, you will get a double array in MATLAB.
boolean r = false;
boolean i = true;
MWNumericArray a = new MWNumericArray(r, i, MWClassID.DOUBLE);
  2 个评论
FM
FM 2020-10-29
编辑:FM 2020-10-29
It sounds like the description is incorrect, then.
The description says "double", but as I described, the actual type (for real and imaginary parts) seems like it is determined by the "MWClassID classid" argument. Except for the case where that argument is specified as "logical" (it's unclear what happens then, but I suspect it defaults to "double").
There's also the inconsistent use of "scalar" across the examples. Wondering if that's just an editorial error, or whether there is in fact something nonscalar in the first prototype.
Todd Flanagan
Todd Flanagan 2020-10-29
Hi,
I see what you are saying now.
Constructs a complex numeric double array that represents the primitive boolean arguments.
Should read somthing like:
Constructs a complex scaler numeric array that represents the primitive boolean arguments.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Java Package Integration 的更多信息

产品


版本

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by