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

2 ビュー (過去 30 日間)
FM 2020 年 10 月 23 日
コメント済み: Todd Flanagan 2020 年 10 月 29 日
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 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 件のコメント表示非表示 1 件の古いコメント
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.
Constructs a complex scaler numeric array that represents the primitive boolean arguments.

サインインしてコメントする。

R2019a

### Community Treasure Hunt

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

Start Hunting!

Translated by