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 | 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 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: subArray behavior reading just 1 element |
From: | Lucas Russo via Tech-talk <tech-talk at aps.anl.gov> |
To: | "Johnson, Andrew N." <anj at anl.gov> |
Cc: | EPICS tech-talk <tech-talk at aps.anl.gov> |
Date: | Wed, 1 Sep 2021 19:02:37 -0300 |
Hi Lucas,
On Sep 1, 2021, at 4:16 PM, Lucas Russo <lerwys at gmail.com> wrote:
lerwys@lerwysPC:~$ caget wavewave 5 1 2 3 4 5
lerwys@lerwysPC:~$ caget subarr
subarr 5 2 0 0 0 0
subarr always returns an array of 5 elements, but I was trying to achieve a subArray of only 1 element. Something like:
lerwys@lerwysPC:~$ caget subarr
subarr 2
Is that possible?
Try using caget -c subarr instead — unfortunately caget without a -c option will always print the maximum number of elements that the array can hold (zero-filled after the number received), but using -c it uses a CA get_callback() API which asks the IOC how many elements the array currently holds and shows that instead. That will be 1 so you should get what you’re asking for.
- Andrew
--Complexity comes for free, simplicity you have to work for.