From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
05-22-2013 12:53 PM - edited 05-22-2013 12:53 PM
Is there a way to do this without converting to a string first to use the string length function? I feel this would be inefficient because type cast makes a data copy (but maybe I'm splitting hairs). I don't want to convert to boolean array and use array size either (inefficient). This is running in a tight loop on RT and that's why I'm concerned. I am trying to preinitialize an array with an index for each bit, and if for some reason I change my code from 16 to 32 bit integers, I don't want to have to go change everywhere I used a constant of 16.
05-22-2013 01:31 PM
I know it might start a flame war but whats wrong with a Global?
05-22-2013 01:43 PM - edited 05-22-2013 01:44 PM
@JÞB wrote:
I know it might start a flame war but whats wrong with a Global?
Actually, I considered this! No flames from me. The only drawback here is it still needs to be updated, not calculated programmatically. Although the update would only be in one place, it's still nice if it can be calculated in code, making a transition seemless. I'm not against it, I'm just looking for different possible solutions for my own knowledge more than anything. The chance of thi changing in this specific project is slim to none.
05-22-2013 01:47 PM
@JÞB wrote:
I know it might start a flame war but whats wrong with a Global?
Jeff is suggesting a global variable?
Actually, I'm in complete agreement. A global variable that is read only is a very simple, effective, efficient (even processing), and race condition free way to set constants that could change on you.
05-22-2013 01:50 PM
@for(imstuck) wrote:
This is running in a tight loop on RT and that's why I'm concerned.
Why is the "calculation" done inside of the loop? Can you do it before the loop starts? I don't know your code, so it could very well be that there is nothing outside of the loop loop that could tell you the data type.
05-22-2013 02:04 PM
@crossrulz wrote:
@for(imstuck) wrote:
This is running in a tight loop on RT and that's why I'm concerned.
Why is the "calculation" done inside of the loop? Can you do it before the loop starts? I don't know your code, so it could very well be that there is nothing outside of the loop loop that could tell you the data type.
It is in the loop because it can change based on how many milliseconds of data I'm reading. depending on the test I'm running. In standard operation I read 10 ms of 48 I16s of buffered data (480 elements) which results in an array of 7680 (480*16). Certain other tests I just grab a snippet of 2 ms of data, so now the array is 96*16.
I suppose I could make it loop invariant code by caculating the max possible array size for any situation outside the loop, then trim it down accordingly.
05-22-2013 02:50 PM
You can probably use this to set your Global
DRAT
I mean
05-22-2013 06:23 PM
@JÞB wrote:
You can probably use this to set your Global
DRAT
I mean
One problem with that option is that it uses scripting. Therefore it can only be used in the development environment.
05-22-2013 08:32 PM - edited 05-22-2013 08:46 PM
Tim,
Its read only in runtime. Reading is all thats needed
I assume Greg can create the case structure to convert rep to number of bits and write to a Global Variable. (without Rube-Goldberging it TOO much):smileyvery-happy:
05-23-2013 07:48 AM
@JÞB wrote:
Tim,
Its read only in runtime. Reading is all thats needed
I assume Greg can create the case structure to convert rep to number of bits and write to a Global Variable. (without Rube-Goldberging it TOO much):smileyvery-happy:
Ok. The blueish property node got to me. I see now that it is read-only during the run-time.