I'm running fourier 123 v(out) in a loop and calculating THD from fourier11 vector. But because I do it in the loop, the second call will store the output in fourier21, third call in fourier31 and so on. I don't know how to change the code to read from different variable each time the loop runs. The variable that is increasing in the name of the vector is "static int callstof = 1;" in fourier.c:
intfourier(wordlist*wl,structplot*current_plot){...staticintcallstof=1;.../* create and assign a new vector n *//* with size 3 * nfreqs in current plot *//* generate name for new vector, using vec->name */n=dvec_alloc(tprintf("fourier%d%d",callstof,newveccount),SV_NOTYPE,VF_REAL|VF_PERMANENT,3*nfreqs,NULL);...callstof++;
Is it possible to reset this variable or to somehow get to the generated vector or something like that:
let i = 0
dowhile i < 10
let i = i + 1
fourier 123 v(out)
let f = getVariableFromName("fourier"+i+"1")
Or maybe some special option not to increment callstof
if(!some_special_option) {
callstof++;
}
I only need fouriermn to calculate thd and put it in a variable, if there is a way to get thd from last fourier call that would help too, something like
fourier 123 v(out)
let thd = fourier_last_thd
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm running fourier 123 v(out) in a loop and calculating THD from fourier11 vector. But because I do it in the loop, the second call will store the output in fourier21, third call in fourier31 and so on. I don't know how to change the code to read from different variable each time the loop runs. The variable that is increasing in the name of the vector is "static int callstof = 1;" in fourier.c:
Is it possible to reset this variable or to somehow get to the generated vector or something like that:
Or maybe some special option not to increment callstof
I only need fouriermn to calculate thd and put it in a variable, if there is a way to get thd from last fourier call that would help too, something like
Try using 'destroy fourier11' at the end of the loop. The new 'fourier' command from the loop then will create a new fourier11.
It doesn't work like that, even if I destroy fourier11 the fourier21 will be used:
ok it works
ok it works