How do I store output from evalrasmolscript as workspace variables?

Hi
I have a script that loads a pdb molecule file into molviewer and I would like to import information obtained using the evalrasmolscript function into the MATLAB Workspace. Is this possible, and how?
For example, I want to import the (x,y,z) coordinates of an atom selected in molviewer:
% Load pdb from online database (takes a few seconds)
h = molviewer('4INS');
% Set selection mode in viewer to single atoms:
evalrasmolscript(h,'select none; set picking SELECT ATOM; selectionHalos ON')
% Wait while a selection is made
pause
% Print x, y, and z coordinates of selected atom:
evalrasmolscript(h,'print {selected}.atomX; print {selected}.atomY; print {selected}.atomZ')
This prints the desired information of the selected atom (i.e. x, y and z coordinates) to the jmol script console and the MATLAB command window. However, I want to store the information directly in a workspace variable xyz = [x y z]. Is that somehow possible?
Thanks,
Søren

3 件のコメント

Soren Preus
Soren Preus 2012 年 9 月 6 日
A dirty solution that seems to work is to save the command window text in a cell array of strings and then use cell2mat. I.e. last line in above code replaced by:
clc
evalrasmolscript(handles.mv,'print {selected}.xyz')
c = command_window_text(1); % File exchange function
xyz = cell2mat(eval(c{1}));
(I tried using evalc instead of command_window_text, but for some reason the information sent by jmol to the command window is not read by neither evalc nor diary)
Soren Preus
Soren Preus 2012 年 9 月 7 日
In the end I would like a standalone executable of the program in which case I cannot use the 'save command window text'-strategy.
So any other suggestions are still very welcome.
Søren
Dean Strotz
Dean Strotz 2012 年 12 月 22 日
編集済み: Dean Strotz 2012 年 12 月 22 日
Søren,
Did you find a proper solution by now?
Maybe there is a way to get the required variables directly ? I have been trying to find out if I could retrieve and assign to a variable through appdata or findobj etc. No success so far.
Dean

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeData Import and Export についてさらに検索

質問済み:

2012 年 9 月 6 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by