From MdsWiki
(Difference between revisions)
Revision as of 15:44, 10 February 2020 (edit) Zack-vii (Talk | contribs) (→Setting the Matlab Search Path) ← Previous diff |
Revision as of 15:47, 10 February 2020 (edit) Zack-vii (Talk | contribs) (setup) Next diff → |
||
Line 2: | Line 2: | ||
|- valign="top" | |- valign="top" | ||
| | | | ||
- | __NOTOC__ | ||
- | == Setting the Matlab Search Path == | + | = Reading and Writing = |
- | Once you have installed the MDSplus software on your desktop computer you can read and write data to and from MDSplus trees using Matlab. The m-file functions for MDSplus operations will be in your MDSplus directory. You should add this folder to your Matlab search path using the Set Path... option from the File menu or via: | + | |
- | + | ||
- | + | ||
- | %% add $MDSPLUS_DIR/matlab to path | + | |
- | addpath(fullfile(getenv('MDSPLUS_DIR'), 'matlab')) | + | |
- | savepath() | + | |
- | + | ||
- | Additional configuration may be needed to use MDSplus from Matlab depending on the preferred API (java or python). | + | |
- | + | ||
- | =Setting up access via java mdsobjects.jar= | + | |
- | By default the Matlab API is bridging thru mdsobjects.jar. For this you need to add the jar to your javaclasspath.txt. Further you have to add the folder of the libraries to javalibrarypath.txt. | + | |
- | This script may help you doing that | + | |
- | + | ||
- | addpath(fullfile(getenv('MDSPLUS_DIR'),'matlab')); | + | |
- | savepath; | + | |
- | + | ||
- | %system(sprintf('echo %s> %s',[regexprep(getenv('MDSPLUS_DIR'),'\\','/'), '/bin64'],fullfile(prefdir,'librarypath.txt')));%old versions | + | |
- | system(sprintf('echo %s> %s',fullfile(getenv('MDSPLUS_DIR'),'bin64'),fullfile(prefdir,'javalibrarypath.txt')));%new versions | + | |
- | system(sprintf('echo %s> %s',fullfile(getenv('MDSPLUS_DIR'),'java','classes','mdsobjects.jar'),fullfile(prefdir,'javaclasspath.txt'))); | + | |
- | + | ||
- | + | ||
- | =Setting up access via pyhton API= | + | |
- | To activate the pyhton API make sure the python MDSplus package can be found in your PYTHONPATH. | + | |
- | Then once e.g. in startup.m execute "mdsUsePython(1)". | + | |
- | + | ||
- | See: [[Documentation:Tutorial:MdsObjects#MATLAB_Specific_Issues | MATLAB Specific Issues]] | + | |
- | + | ||
- | == Reading and Writing == | + | |
If there is an MDSplus server on your Local Area Network at address 123.456.7.89 and a tree on the server named mytree then you connect and read data like this: | If there is an MDSplus server on your Local Area Network at address 123.456.7.89 and a tree on the server named mytree then you connect and read data like this: | ||
Line 64: | Line 35: | ||
mdsvalue('current_shot("mytree")') | mdsvalue('current_shot("mytree")') | ||
+ | |||
+ | =Setup= | ||
+ | == Setting the Matlab Search Path == | ||
+ | Once you have installed the MDSplus software on your desktop computer you can read and write data to and from MDSplus trees using Matlab. The m-file functions for MDSplus operations will be in your MDSplus directory. You should add this folder to your Matlab search path using the Set Path... option from the File menu or via: | ||
+ | |||
+ | %% add $MDSPLUS_DIR/matlab to path | ||
+ | addpath(fullfile(getenv('MDSPLUS_DIR'), 'matlab')) | ||
+ | savepath() | ||
+ | |||
+ | Additional configuration may be needed to use MDSplus from Matlab depending on the preferred API (java or python). | ||
+ | |||
+ | ==Setting up access via java mdsobjects.jar== | ||
+ | By default the Matlab API is bridging thru mdsobjects.jar. For this you need to add the jar to your javaclasspath.txt. Further you have to add the folder of the libraries to javalibrarypath.txt. | ||
+ | This script may help you doing that | ||
+ | |||
+ | addpath(fullfile(getenv('MDSPLUS_DIR'),'matlab')); | ||
+ | savepath; | ||
+ | |||
+ | %system(sprintf('echo %s> %s',[regexprep(getenv('MDSPLUS_DIR'),'\\','/'), '/bin64'],fullfile(prefdir,'librarypath.txt')));%old versions | ||
+ | system(sprintf('echo %s> %s',fullfile(getenv('MDSPLUS_DIR'),'bin64'),fullfile(prefdir,'javalibrarypath.txt')));%new versions | ||
+ | system(sprintf('echo %s> %s',fullfile(getenv('MDSPLUS_DIR'),'java','classes','mdsobjects.jar'),fullfile(prefdir,'javaclasspath.txt'))); | ||
+ | |||
+ | ==Setting up access via pyhton API== | ||
+ | To activate the pyhton API make sure the python MDSplus package can be found in your PYTHONPATH. | ||
+ | Then once e.g. in startup.m execute "mdsUsePython(1)". | ||
+ | |||
+ | =Troubleshooting= | ||
+ | See: [[Documentation:Tutorial:MdsObjects#MATLAB_Specific_Issues | MATLAB Specific Issues]] |