Affiliation
MIT PSFC
Version(s) Affected
Various -- see the attached files
Platform(s)
All
Installation Method(s)
Developer builds
Describe the bug
MATLAB can access data in MDSplus trees using three "bridges": Java, Python and mdsthin. However, the three bridges are inconsistent when returning text to MATLAB. Depending on the platform, software stack and versions, MATLAB will receive the text in different object types: string, py.str or char.
As shown in the attached files . . .
- Java always returns text as
string
- Python returns text as
char or string (apparently depending on the NumPy version)
- MDSplus errors are always returned as
char
Note that MATLAB introduced the string class in R2016b. All MDSplus customers are surely using newer versions of MATLAB, thus string is the preferred class for text.
Configuring MATLAB to work with the three bridges can be a bit of a challenge, especially if a computer has multiple versions of Java, Python and NumPy installed. Furthermore prior to R2025a, MATLAB used Java for its user interface so shipped a version of Java bundled with MATLAB. From a support standpoint, it can thus be difficult to determine exactly which versions of the software stack are being used by a MDSplus customer.
To Reproduce
Examine the attached files and run similar commands.
Expected behavior
- All text nodes in MDSplus trees should be returned as MATLAB
string objects.
- MDSplus error messages are now consistently being returned as MATLAB
char objects. Perhaps, these also should be returned as string objects.
Screenshots
n/a
Additional context
PR #2990 fixed a symptom but overlooked the root cause, namely that the bridges don't use consistent MATLAB classes for MDSplus text nodes. When this issue is fixed, the mdstest.m code added in PR #2990 can be simplified.
One possible fix for this issue is to modify the mdsvalue.m script to detect results returned as py.str or char objects and then use MATLAB's string() function to convert them to string objects.
These files show output of the three bridges for different platforms and software stacks.
matlab_macos.txt
matlab_ubuntu24_a.txt
matlab_ubuntu24_b.txt
matlab_win11.txt
Affiliation
MIT PSFC
Version(s) Affected
Various -- see the attached files
Platform(s)
All
Installation Method(s)
Developer builds
Describe the bug
MATLAB can access data in MDSplus trees using three "bridges": Java, Python and mdsthin. However, the three bridges are inconsistent when returning text to MATLAB. Depending on the platform, software stack and versions, MATLAB will receive the text in different object types:
string,py.strorchar.As shown in the attached files . . .
stringcharorstring(apparently depending on the NumPy version)charNote that MATLAB introduced the
stringclass in R2016b. All MDSplus customers are surely using newer versions of MATLAB, thusstringis the preferred class for text.Configuring MATLAB to work with the three bridges can be a bit of a challenge, especially if a computer has multiple versions of Java, Python and NumPy installed. Furthermore prior to R2025a, MATLAB used Java for its user interface so shipped a version of Java bundled with MATLAB. From a support standpoint, it can thus be difficult to determine exactly which versions of the software stack are being used by a MDSplus customer.
To Reproduce
Examine the attached files and run similar commands.
Expected behavior
stringobjects.charobjects. Perhaps, these also should be returned asstringobjects.Screenshots
n/a
Additional context
PR #2990 fixed a symptom but overlooked the root cause, namely that the bridges don't use consistent MATLAB classes for MDSplus text nodes. When this issue is fixed, the
mdstest.mcode added in PR #2990 can be simplified.One possible fix for this issue is to modify the
mdsvalue.mscript to detect results returned aspy.strorcharobjects and then use MATLAB'sstring()function to convert them tostringobjects.These files show output of the three bridges for different platforms and software stacks.
matlab_macos.txt
matlab_ubuntu24_a.txt
matlab_ubuntu24_b.txt
matlab_win11.txt