SKILL: Is this the simplest way to extract the x-axis of a w

S

Svenn Are Bjerkem

Guest
Hi,
looking at some of the code examples posted here I came up with the
following code to get the x-axis of a waveform returned as a list. My
question is just: Is this really the simplest/best way to do this
task?

xvec = drGetWaveformXVec( waveform )
(let (i alist) for(i 0 sub1(drVectorLength(xvec)) alist=tconc(alist
drGetElem(xvec i))) car(alist))

it works as expected, that is not the problem, but if there is already
a dr* or awv* function that I don't know about it would probably be
better.

--
Svenn
 
On Mon, 12 Nov 2007 10:28:10 -0000, Svenn Are Bjerkem
<svenn.bjerkem@googlemail.com> wrote:

Hi,
looking at some of the code examples posted here I came up with the
following code to get the x-axis of a waveform returned as a list. My
question is just: Is this really the simplest/best way to do this
task?

xvec = drGetWaveformXVec( waveform )
(let (i alist) for(i 0 sub1(drVectorLength(xvec)) alist=tconc(alist
drGetElem(xvec i))) car(alist))

it works as expected, that is not the problem, but if there is already
a dr* or awv* function that I don't know about it would probably be
better.
Hi Svenn,

That's pretty similar to my code below (I just have an additional
option to allow the data to be transposed, and also I'm outputing
the x and y values):

/* abWaveToList.il

Author A.D.Beckett
Group Custom IC (UK), Cadence Design Systems Ltd.
Language SKILL
Date Nov 17, 2003
Modified
By

Convert a waveform to a list

***************************************************

SCCS Info: @(#) abWaveToList.il 11/17/03.15:08:15 1.1

*/

/************************************************************************
* *
* (abWaveToList wave @key transpose) *
* *
* Take a waveform object, and return it as a list of xy pairs. Or *
* if transpose is set, it returns a list of x values followed by a list *
* of y values. *
* *
************************************************************************/

(procedure (abWaveToList wave @key transpose)
(let (xList yList xyList len
(xVec (drGetWaveformXVec wave))
(yVec (drGetWaveformYVec wave))
)
(setq len (drVectorLength xVec))
;-----------------------------------------------------------------
; Return value of this if is the list
;-----------------------------------------------------------------
(if transpose
(progn
(for i 0 (sub1 len)
(setq xList (tconc xList (drGetElem xVec i)))
(setq yList (tconc yList (drGetElem yVec i)))
)
(list (car xList) (car yList))
)
; else
(progn
(for i 0 (sub1 len)
(setq xyList (tconc xyList (list (drGetElem xVec i)
(drGetElem yVec i))))
)
(car xyList)
)
) ; if
) ; let
) ; procedure

Regards,

Andrew.
--
Andrew Beckett
Senior Solution Architect
Cadence Design Systems, UK.
 
On Nov 15, 9:47 am, Andrew Beckett <andr...@DcEaLdEeTnEcTe.HcIoSm>
wrote:
On Mon, 12 Nov 2007 10:28:10 -0000, Svenn Are Bjerkem

svenn.bjer...@googlemail.com> wrote:
Hi,
looking at some of the code examples posted here I came up with the
following code to get the x-axis of a waveform returned as a list. My
question is just: Is this really the simplest/best way to do this
task?

xvec = drGetWaveformXVec( waveform )
(let (i alist) for(i 0 sub1(drVectorLength(xvec)) alist=tconc(alist
drGetElem(xvec i))) car(alist))

it works as expected, that is not the problem, but if there is already
a dr* or awv* function that I don't know about it would probably be
better.

Hi Svenn,

That's pretty similar to my code below (I just have an additional
option to allow the data to be transposed, and also I'm outputing
the x and y values):
*Blush* It very much your code *Blush*

I just found it extremely strange that there is no dr* API function
that solves this.
--
Svenn
 

Welcome to EDABoard.com

Sponsor

Back
Top