05-26-2009 05:00 AM
how do you define this case 'defaut', or can i just build a constant to Fe?
05-26-2009 05:20 AM
05-26-2009 06:17 AM
oh yes, but i don't know how to do with another cas, and in the case it isn't to build un constant?
05-26-2009 06:30 AM
You have to include a value in every case. Just do as you have done in the "11025" loop. Also remember that that you can not have the upper frequency higher than Fs/2.
Tip
Delete the defualt case, then "right click" on the case structure and slect "Add Case for every value"
05-26-2009 06:34 AM - edited 05-26-2009 06:35 AM
05-26-2009 06:55 AM
Thoric wrote:Don't use a case structure, use format into string, then string to decimal:
This will adapt to whatever elements exist in the enum, and return them exactly as they are typed.
I would not have used your method inside a loop because it is very inefficient. Besides if new values are added to the enum, an error will be generated until the case structure and the enum have matching values
05-26-2009 07:07 AM
Coq rouge wrote:
I would not have used your method inside a loop because it is very inefficient. Besides if new values are added to the enum, an error will be generated until the case structure and the enum have matching values
It's outside the while loop.
Coq rouge wrote:I would not have used your method inside a loop because it is very inefficient. Besides if new values are added to the enum, an error will be generated until the case structure and the enum have matching values
Why is this a good thing? With an enum to string to decimal you no longer have to worry about what the enum contains, it will always return the numeric conversion no matter what. It's very versatile.
05-26-2009 07:14 AM
thanks for your helps, both of your ways work well, The Thoric's is good for me because i will build sound format into a constant, but Coq rouge's is better for every case. thanks again.
Please forgive my ignorance, i add this filter for avoiding noises, but now it is wors, i would like to acquir
05-26-2009 07:15 AM
Coq rouge wrote:I would not have used your method inside a loop because it is very inefficient. Besides if new values are added to the enum, an error will be generated until the case structure and the enum have matching values
Very inefficient?
Comparing a loop of 1E7 iterations containing a case structure with a 1E7 iterations loop containing an enum to string to decimal, I get times of 49 and 66 ms each. That's 10 million conversions in 66 milliseconds for my method on a basic laptop. Hardly worth worrying about, and only a small percentage slower than the case structure. Not a candidate for very inefficient.
05-26-2009 08:07 AM
Hi xiuming,
Looking at your vi, the Delete button (Bouton Annuler?) will only delete the sound file if it is already depressed when the vi is launched. This is because the boolean control is read immediatelythe program starts, and not anytime after. You might want to consider creating an event case for the boolean value change and deleting the file from within there instead.
On another note, why do you delete the same file that you write your sound data to immediately after writing to it?