From ccabec1028d3070ef2085a7437bcc5eab5b2aebf Mon Sep 17 00:00:00 2001 From: mwinkel-dev Date: Thu, 20 Nov 2025 17:12:50 -0700 Subject: [PATCH 1/3] Fix: mdstest now supports strings returned by the Java bridge --- matlab/mdstest.m | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/matlab/mdstest.m b/matlab/mdstest.m index 673d56a10c..08c61d5813 100644 --- a/matlab/mdstest.m +++ b/matlab/mdstest.m @@ -6,6 +6,7 @@ % mdstest(0) % tests java bridge % mdstest(1) % tests python bridge + global MDSINFO; mdsInfo(varargin{:}); % update MDSINFO result = mdscheck('1BU', 'uint8', [1, 1]); result = result && mdscheck('1WU', 'uint16', [1, 1]); @@ -13,7 +14,6 @@ result = result && mdscheck('100000000000QU', 'uint64', [1, 1]); result = result && mdscheck('1.', 'single', [1, 1]); result = result && mdscheck('1D0', 'double', [1, 1]); - result = result && mdscheck('"string test"', 'char', [1, 11]); result = result && mdscheck('BYTE_UNSIGNED(1:100)', 'uint8', [100, 1]); result = result && mdscheck('WORD_UNSIGNED(1:100)', 'uint16', [100, 1]); result = result && mdscheck('LONG_UNSIGNED(1:100)', 'uint32', [100, 1]); @@ -28,8 +28,15 @@ result = result && mdscheck('$ : $', 'int32', [100, 1], int32(1), int32(100)); result = result && mdscheck('$ == $', 'uint8', [1, 1], 1, 2); result = result && mdscheck('QUADWORD_UNSIGNED(1:100)', 'uint64', [100, 1]); - result = result && mdscheck('["a","b","c","d"]', 'cell', [4, 1]); - result = result && mdscheck('set_range(2,3,["a","b","c long string","d","e","f"])', 'cell', [2, 3]); + if MDSINFO.usePython + result = result && mdscheck('"string test"', 'char', [1, 11]); + result = result && mdscheck('["a","b","c","d"]', 'cell', [4, 1]); + result = result && mdscheck('set_range(2,3,["a","b","c long string","d","e","f"])', 'cell', [2, 3]); + else + result = result && mdscheck('"string test"', 'string', [1, 1]); + result = result && mdscheck('["a","b","c","d"]', 'string', [4, 1]); + result = result && mdscheck('set_range(2,3,["a","b","c long string","d","e","f"])', 'string', [2, 3]); + end end function result = mdscheck(exp, result_class, result_size, varargin) From 7bac4aab62a5b45c6c363e1eede0c12f1725e792 Mon Sep 17 00:00:00 2001 From: mwinkel-dev <122583770+mwinkel-dev@users.noreply.github.com> Date: Fri, 21 Nov 2025 17:24:35 -0700 Subject: [PATCH 2/3] Fix: mdstest now works on macOS --- matlab/mdstest.m | 14 ++++++++++---- matlab/mdsvalue.m | 4 +++- matlab/private/pythonFromMatlab.m | 2 ++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/matlab/mdstest.m b/matlab/mdstest.m index 08c61d5813..f690d61c71 100644 --- a/matlab/mdstest.m +++ b/matlab/mdstest.m @@ -6,8 +6,7 @@ % mdstest(0) % tests java bridge % mdstest(1) % tests python bridge - global MDSINFO; - mdsInfo(varargin{:}); % update MDSINFO + info = mdsInfo(varargin{:}); % update MDSINFO result = mdscheck('1BU', 'uint8', [1, 1]); result = result && mdscheck('1WU', 'uint16', [1, 1]); result = result && mdscheck('1LU', 'uint32', [1, 1]); @@ -28,8 +27,12 @@ result = result && mdscheck('$ : $', 'int32', [100, 1], int32(1), int32(100)); result = result && mdscheck('$ == $', 'uint8', [1, 1], 1, 2); result = result && mdscheck('QUADWORD_UNSIGNED(1:100)', 'uint64', [100, 1]); - if MDSINFO.usePython - result = result && mdscheck('"string test"', 'char', [1, 11]); + if info.usePython + if ismac + result = result && mdscheck('"string test"', 'py.str', [1, 11]); + else + result = result && mdscheck('"string test"', 'char', [1, 11]); + end result = result && mdscheck('["a","b","c","d"]', 'cell', [4, 1]); result = result && mdscheck('set_range(2,3,["a","b","c long string","d","e","f"])', 'cell', [2, 3]); else @@ -57,6 +60,9 @@ result = 0; return end + if strcmp(class(x), 'py.str') + x = string(x); + end y = mdsvalue('$', x); if isa(x, 'cell') try diff --git a/matlab/mdsvalue.m b/matlab/mdsvalue.m index d8f5ca3dbb..19a5ab9180 100755 --- a/matlab/mdsvalue.m +++ b/matlab/mdsvalue.m @@ -15,7 +15,9 @@ end for k = 1 : n argin = varargin(k); - if iscell(argin{1}) + if iscell(argin) && isa(argin{1}, 'string') + argout = mdsFromMatlab(argin{1}); + elseif iscell(argin{1}) argout = mdsFromMatlab(argin{1}); else argout = mdsFromMatlab(cell2mat(argin)); diff --git a/matlab/private/pythonFromMatlab.m b/matlab/private/pythonFromMatlab.m index 630dfec249..845911b260 100644 --- a/matlab/private/pythonFromMatlab.m +++ b/matlab/private/pythonFromMatlab.m @@ -3,6 +3,8 @@ switch dtype case 'char' result = value; + case 'string' + result = value; otherwise switch dtype case 'single' From 66f769fb27962eb8b2cd87a000d676ab5196bf38 Mon Sep 17 00:00:00 2001 From: mwinkel-dev <122583770+mwinkel-dev@users.noreply.github.com> Date: Mon, 24 Nov 2025 16:54:47 -0700 Subject: [PATCH 3/3] Fix: mdstest now works on Windows --- matlab/mdstest.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/matlab/mdstest.m b/matlab/mdstest.m index f690d61c71..83933014b5 100644 --- a/matlab/mdstest.m +++ b/matlab/mdstest.m @@ -5,6 +5,7 @@ % mdstest() % tests current bridge % mdstest(0) % tests java bridge % mdstest(1) % tests python bridge +% mdstest(1,1) % tests mdsthin bridge info = mdsInfo(varargin{:}); % update MDSINFO result = mdscheck('1BU', 'uint8', [1, 1]); @@ -28,7 +29,7 @@ result = result && mdscheck('$ == $', 'uint8', [1, 1], 1, 2); result = result && mdscheck('QUADWORD_UNSIGNED(1:100)', 'uint64', [100, 1]); if info.usePython - if ismac + if ismac || ispc result = result && mdscheck('"string test"', 'py.str', [1, 11]); else result = result && mdscheck('"string test"', 'char', [1, 11]);