09-07-2017 06:45 AM
Solved! Go to Solution.
09-07-2017 06:59 AM
Time to acquire X samples = sample rate * X
That is the heart of the question. The Elapsed Time is just being used as a stop condition. The purpose of this question is to understand now many times the loop will iterate based on how much time it takes to read that 5 samples at 1Hz (hint: 5 seconds). So I would expect this loop to iterate 2 times (elapsed times will be 0 and 5).
09-07-2017 11:03 PM
09-19-2017 01:52 AM
I am new to labview. And also confused by the question. Can you explain more detail why the loop will iterate 2 times ?
why Elapsed Time is 0 and 5?
09-19-2017 04:06 AM
YOUKAIYK wrote:why Elapsed Time is 0 and 5?
Data Flow. The checking the time and the reading of the DAQ data have no data dependency. Therefore they will happen in parallel. It can be safe to then assume the Elapsed Time will run as soon as the loop iterates.
12-04-2017 04:44 AM
For the same question asked by De_V , I changed elapsed time to 5 and got the array size as 3 rows and 5 columns which is wrong as per your explanation....Please help me with this
07-20-2018 05:01 AM
An alternate situation popped in my mind.
What if my TASK in this question had 3 channels to be read ?
1) In the second Iteration of the while loop will the Read DAQmx vi read the next channel ?
If yes then I expect the loop to Stop after the second channel has been read and thus will still have 2 rows 5 columns in Data indicator but this time the 2 rows belong to 2 different channels.
Is this reasoning right or am I doing something wrong here ?
Thanks in advance.
07-20-2018 05:25 AM
@DeXteR_INIT wrote:
What if my TASK in this question had 3 channels to be read ?
1) In the second Iteration of the while loop will the Read DAQmx vi read the next channel ?
No. In fact, you will get an error (-200523 Read cannot be performed because this version of DAQmx Read only returns data from a single channel, and there are multiple channels in the task.). So you have to change the DAQmx Read to be Multiple Channels-Multiple Samples. And this will actually give you a 3D array as an output if you leave the output tunnel as indexing. You will keep the 2D array if you change the tunnel type to be Concatenating.
07-20-2018 05:36 AM
@VinuY wrote:
For the same question asked by De_V , I changed elapsed time to 5 and got the array size as 3 rows and 5 columns which is wrong as per your explanation....Please help me with this
Don't remember seeing this post before, but I feel like I need to answer it anyways.
This is not surprising to me. The task is started before the loop even starts. So it is not unreasonable to think that a sample has been taken before that loop even begins. So that first 5 seconds has started before we even start the timer. If you look at your actual Elapsed Times, you will likely see something like 0, 4.99089, 9.9577 (actual values from a test I just ran).
07-20-2018 10:06 AM
Yes, I totally overlooked I would have to configure the DAQmx Read to be able to read Multiple Ch and Samples. Thanks.
So provided I do that, and have the output tunnel indexed, the 3D array I obtain will have have a dimension of (3(R),5(C),2(P)) where each Page of my array has data from each iteration, 1 row for each channel and 5 samples.
Instead if I keep the terminal as Concatenated the 2D array would have a dimension of (6(R),5(C)).
Sorry, I know I can verify this in Labview but I am taking CLAD next week so trying to think my way through it.
Thanks