Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions matlab/mdstest.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
% mdstest() % tests current bridge
% mdstest(0) % tests java bridge
% mdstest(1) % tests python bridge
% mdstest(1,1) % tests mdsthin bridge
Copy link
Contributor Author

@mwinkel-dev mwinkel-dev Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this mdstest(1,1) comment line be deleted or retained?

Note that this MATLAB script tests connection to the Java and Python languages; it does not establish a bridge connection via mdsip to a remote MDSplus archive server.


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]);
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]);
Expand All @@ -28,8 +28,19 @@
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 info.usePython
if ismac || ispc
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
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)
Expand All @@ -50,6 +61,9 @@
result = 0;
return
end
if strcmp(class(x), 'py.str')
x = string(x);
end
y = mdsvalue('$', x);
if isa(x, 'cell')
try
Expand Down
4 changes: 3 additions & 1 deletion matlab/mdsvalue.m
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 2 additions & 0 deletions matlab/private/pythonFromMatlab.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
switch dtype
case 'char'
result = value;
case 'string'
result = value;
otherwise
switch dtype
case 'single'
Expand Down