Hi Kuktae,
On 10/25/22 19:29, Kim, Kuktae via Tech-talk wrote:
Hi all,
I am trying to use the P4P python module (https://mdavidsaver.github.io/p4p/index.html# <https://mdavidsaver.github.io/p4p/index.html#>) in Matlab for EPICS NTTable PVs.
Versions that I use:
*/Python: 3.8.13/*
*/P4P: 4.1.3/*
*/Matlab: 2020a/*
Wow, so matlab can call into cpython now?
This is news to me.
First, I tested pvget and pvput in linux terminal, then moved to python and Matlab for each step. It works without problem for the NTScalar and NTScalarArray types. But I don't know how to implement for NTTable type. I will put more information below.
You have found the NTTable helper, which doesn't actually
do that much wrt. the Type definition.
https://github.com/mdavidsaver/p4p/blob/5717342c2c1ddd74217298decab7ce52faa60006/src/p4p/nt/__init__.py#L157-L164
You can also use the NTTable wrapper when setting up the
client Context. Which may or may not be helpful in your
application.
ctxt = p4p.client.thread.Context(nt={"epics:nt/NTTable:1.0": p4p.nt.NTTable})
With this, ctx.get() will implicitly call NTTable.unwrap()
...
*/In the Python command line, work fine; but pvget doesn't show a whole table./*
...
from p4p.client.thread import Context
MatP4P = Context('pva')
MatP4P.get('TEST:TBL')
Value(id:epics:nt/NTTable:1.0, Value(['device_1', 'device_2'])) # <== P4P doesn't show whole information such as in linux terminal
To avoid excessive console output, the repr() implementation for Value does not recurse.
You might investigate Value.tolist(), .todict(), or .tostr()
https://mdavidsaver.github.io/p4p/values.html#p4p.Value.tolist
...
*/In Matlab command line, pvput shows error message. Due to the colon operator.
...
MatP4P.put('TEST:TBL', {'value.name': ['test1', 'test2'], 'value.number': [10, 20]})
Warning: Colon operands must be real scalars.
Error using :
For colon operator with char operands, first and last operands must be char.
This looks like a matlab syntax error. Maybe this link is relevant?
https://www.mathworks.com/help/matlab/matlab_external/python-dict-variables.html
- Replies:
- Re: P4P usage for the pvget and pvput for the NTTable in Matlab Kim, Kuktae via Tech-talk
- References:
- P4P usage for the pvget and pvput for the NTTable in Matlab Kim, Kuktae via Tech-talk
- Navigate by Date:
- Prev:
RE: ADPlugin for average of images Mark Rivers via Tech-talk
- Next:
Re: P4P usage for the pvget and pvput for the NTTable in Matlab Kim, Kuktae via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
<2022>
2023
2024
- Navigate by Thread:
- Prev:
P4P usage for the pvget and pvput for the NTTable in Matlab Kim, Kuktae via Tech-talk
- Next:
Re: P4P usage for the pvget and pvput for the NTTable in Matlab Kim, Kuktae via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
<2022>
2023
2024
|