EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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  <20222023  2024  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  <20222023  2024 
<== Date ==> <== Thread ==>

Subject: Re: P4P usage for the pvget and pvput for the NTTable in Matlab
From: "Kim, Kuktae via Tech-talk" <tech-talk at aps.anl.gov>
To: Michael Davidsaver <mdavidsaver at gmail.com>
Cc: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Thu, 27 Oct 2022 23:41:24 +0000
Hi Michael,

Thank you for the advice.

Wow, so matlab can call into cpython now?
This is news to me.

Yes, MATLAB can directly call CPython functions. Please find the link:

MATLAB can also run the statement and script using pyrun and pyrunfile which are introduced in R2021b.


> 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.


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()


Thank you for the information. This is a good tip!

...
> */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?


I am studying a few web pages including the one you provided. There might be some way to send complex arguments from MATLAB to Python. I will update you later. 

Thank you for your help.
Best regards,
Kuktae


References:
P4P usage for the pvget and pvput for the NTTable in Matlab Kim, Kuktae via Tech-talk
Re: P4P usage for the pvget and pvput for the NTTable in Matlab Michael Davidsaver via Tech-talk

Navigate by Date:
Prev: Re: P4P usage for the pvget and pvput for the NTTable in Matlab Michael Davidsaver via Tech-talk
Next: Missing DLL entry points in PV utils on windows-x64-mingw? Eloise de Castelnau 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  <20222023  2024 
Navigate by Thread:
Prev: Re: P4P usage for the pvget and pvput for the NTTable in Matlab Michael Davidsaver via Tech-talk
Next: Newport controller ESP302 Jong Woo Kim 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  <20222023  2024 
ANJ, 28 Oct 2022 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·