Documentation:Tutorial:APIs:MATLAB - MdsWiki
Navigation
Personal tools

From MdsWiki

Jump to: navigation, search

Setup

Troubleshooting

Reading and writing data in MDSplus trees in Matlab

The following commands read the Y and X axis of node :SIGNAL1 into Matlab variables y and x.

mdsopen('my_tree', -1)
[y,status] = mdsvalue(':SIGNAL1')
[x,status] = mdsvalue('DIM_OF(:SIGNAL1)')

Note that the function returns both the result of the evaluation of the passed TDI expression and an integer variable containing the status for the operation (assumed to be successful if odd).

In the following example an array is written into node :NUM1

a=sin((0:100)/10.);
mdsput(':NUM2', '$1', a)

And finally, let's write a sinusoidal waveform in :SIGNAL1

x = (0:1000)/50;
y = sin(x);
mdsput(':signal1','BUILD_SIGNAL($1,,$2)',y,x)