Webcast Wednesday Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

Webcast Wednesday Contest # 1

Question 1) What is the result in Array after the following code has executed ?

question 1.png

Answer

1-D array of {1, 4, 3, 2, 1, 0, 8, 6, 2}

Question 2) Mention all the different ways of creating an array in LabVIEW ?

Answer

  • Place an array shell on the front panel and then place an element, such as a numeric, Boolean, string control or indicator etc inside the array shell to create

       an array of   that datatype.

  • Place an array constant on the block diagram. Insert either a numeric, Boolean or string constant to have an array constant of that data type.
  • When you wire a value as the output of a for loop, enabling Auto-Indexing outputs an array. (If you enable Auto-Indexing, each iteration of the for loop passes 

     an element thereby forming an array outside the loop.)  The array is equal in size to the number of iterations executed by the for loop and contains the output values of the for loop.

  •   Using Build Array Function
  •   Using initialize array function


Question 3) What is the purpose(s) of using the Wait function in while loop ?

Answer

  • Provide delay between loop iteration
  • Give processor time to perform other tasks


Rules & Guidelines

  • Post your answers as comments on this thread.
  • The participant answering all the questions correctly and in the shortest time will be the winner.
  • In case of a participant submitting multiple comments (answers), the first entry will be considered.
  • The deadline for answer submission is next Monday. Entries made after Monday will not be accepted.
  • Entries made after the deadline will not be accepted.
  • The winner will be announced in the next session of Webcast Wednesday and on this thread, with further information & next steps.
Comments
SuhailSallam
Member
Member
on

Q: please include in your coming webinars an explanation and examples for MyDAQ

Zafer.Depe
Active Participant
Active Participant
on

1 4 3 2 1 0 8 6 2

gopinath89
Member
Member
on

3.to introuduce delay

Zafer.Depe
Active Participant
Active Participant
on

Answer 1) 1 4 3 2 1 0 8 6 2

Answer 2) Auto indexing on Loops , Initializing Arrays, Using Array Constants, Inserting Elements into Empty Arrays, Building Arrays

Answer 3) Limit loop execution time (That prevents unnecessary iterations and give the processor to run other tasks). Also sometimes synchronize the loop with a timer.

Ajay_MV
Active Participant
Active Participant
on

Answer 1) Array with following elements [1,4,3,2,1,0,8,6,2]

Answer 2)

  • Using Controls Pallet (Right click->Array Matrix & Cluster->Array),
  • Using Function Pallet(Right click->Programming->Array->Array Constant),
  • Creating contants/controls/indicators from a wire (Right click on an array wire->Create->Click Constant/Control/Indicator)

Answer 3)  In order to reduce the processing time (or processing load) consumed by the while loop.

Thanks,

Ajay

--
Ajay MV


keer
Member
Member
on

1. result in array after the code has been executed : 1 4 3 2 1 0 8 6 2

2. An array  can be created in many ways

a. using the "Initialize array " function

b. indexing an element at the end of a for loop.

c. indexing an element at the end of a while loop by enabling the indexing option.

3. wait function in the while loop is added to free up the processor. it lets the processor to do other tasks for the time mentioned in the wait function. if it is not use , the processor shall never leave this particular loop and parallel processing can not be done.

srivel.m
Member
Member
on

Answere for the Questions:

1.{1,4,3,2,1,0,8,6,2}

2. - Enable auto - ndexing in a for or while loop

    - Use Build array function 

     - Use initialize array function and use Replace array element to modify the elements

3. Wait function is used to free the processor time for doing some other activity

swetha_sadula
Member
Member
on

1Ans:[0,1,8,6,2]

2Ans:by usibg for loop we can create the arrays,

         by using build array function also we can create arrays

         directly placing array control on front pannel

3Ans:giving the time to the processor to execute other tasks

Giridhaya
Member
Member
on

Q1) The resulting array has the element of 0 in every index .

Q2) The array can be created by creating a control from the front panel

        By the functions

           cluster to array, Matrix to array, Initialize array, build array, and creating an indicator for number of values

Q3) by using wait function

         (1) we can get the values one by one with the time specified by us (during data acquisition in the loop)

          (2) To introduce a time difference between present and next iteration of the loop

Thank you for your webinar...

V-SOLAPUR
Member
Member
on

Answers for webcast on 8 th may 2013.

1. 143210862

2.array can be obtain using following methods.

i.for loop auto indexing.

ii.using initialize array  function

iii. drag  const array function on block diagram.

3.

i. to control loop frequency
ii. provide the processor with time to complete other tasks.

Omi_30
Member
Member
on

Q.1 Output Array : 1 3 2 1 0 8 6 2

Q.2 Creating array , Build array, initialize array, String to Array, Matrix to array, Index array, Insert into array,

Q.3 To wait for specified time duration in seconds.Wire Zero to input of wait to current thread to yield control of the CPU.

Karthick.Smile
Member
Member
on

Answer-1:0

Answer-2: 1.Through Controls >> Modern>>Array, Matrix, & Cluster and drag the Array shell onto the front panel.

               2.On the Functions >> Programming>>Array>>Array Constant onto the block diagram.

Answer-3: To understanding the programming flow and for synchronization with external interfacing

muralimb
Member
Member
on

Answer 1) The program inserts the subarray [4,3,2,1] after the first elementr of the array [1,8,6,2] as the index is 1. ( [4,3,2,1 ] subarray corresponds to i=1,i=2,i=3,i=4 i.e., the iteration values of the for loop for N=5

2) Using loops and using Build array function in the array tool palatte, or convertfrom cluster to array using function in the tool palatte.

3) It is used to delay the iteration by a specific time i.e., in timing related applications or building timer VI's etc.

M.Lotfi.Der
Member
Member
on

question 1 : 1 - 4 - 3 - 2 - 1 - 0 - 8 - 6 - 2

question 2 : we can create array by :

1/ adding an array shell to the front panel and dragging a data object or element into the array shell. (for control and indicator)

2/ adding an array shell to the block diagram and dragging a constant data into the array shell. (for constant)

this is for 1 dimension array. To add dimension to the array, we can select add diension from the shortcut menu or resize the index display.

question 3 : we use a wait function in while loop to control the iteration frequency or timing. even if we not need that the execution occur at certain frequency, we need to provide the processor with time to complete other tasks.

Test System Expert
Certified LabVIEW Developer & Certified TestStand Developer
Ahmed_Zahran
Member
Member
on

Question 1:

The Result of the Array will be [1 4 3 2 1 0 8 6 2]

# Since the Insert into Array is at Index 1, so all the new values will be inserted at that index, while shifting the rest of the array downwards.

# The increment "i" starts with value = 0 till 4, after finishing the 5 iterations of the For loop.

# The Feedback node acts as the Shift Register; reinserting the new array in the input of the "Insert into array"

---------------------------------------------------------

Question 2:

# Offline Array Creation

1. Creating an array Constant and dragging any datatype inside (Front Panel & Block Diagram).

2. In the Block Diagram, Create an Array by: Right Click then Create (Constant, Control or Indicator) on any of the Array Palette functions' inputs or Other Functions accepting or releasing an array.

# Programatically

1. Using the Build Array Function with any Data Type.

2. Using a For Loop and Enable Indexing on Output for any data type

3. Using a Math-Script or Matlab Script and Writing down a Variable in the Array text Format : X = [1 2 3; 4 5 6] (2D Array)

4. Using any conversions to array (Cluster of specific data type to Array), (Number to Boolean Array), ...

---------------------------------------------------------

Question 3:

1. The main role of the Wait function is to give the processor the chance to complete other tasks on the Operating System.

2. It gives the code a kind of synchronization, thus the loop is expected to finish one iteration at a specific periodic time.

chandu208
Member
Member
on

1) array size  is 1*5 and all the array element is zeros.

2)By placing the array controls in the front panel and perform different array operations on the block diagram like build array and insert into array.

3)To reduce the cpu burden.

sknaveen6999
Member
Member
on

Answer 1: The Result in Array after the code was executed is a one dimensional Array with output as

                  [1,4,3,2,1,0,8,6,2]      

                   

Answer 2: Different ways of creating array in LabVIEW are

1. Build Array

2. Custom Array

3. Array Functions

Answer 3: The purpose is that when the wait function is attached to a while loop it extends the total time taken to execute the loop. This total time includes the time taken to execute the code and the wait function time. The Wait function and the code executes simultaneously together.

Ammouri
Member
Member
on

Q1) [1 4 3 2 1 0 8 6 2]

Q2) Initialize array, Build array, loop tunnel with indexing enabled,

Q3) add delay to loop excution time (not recommended since it prevents user interaction during the wait period)

santha02
Member
Member
on

1.   1

      4

      3

      2

      1

      0

      8

      6

      2

2.

Functions Palette → All-Functions → Array → Array

Constant

• Right-Click on the box → Arith/Compare → Numeric →

Num Const → Drag into the empty array

3.delay for a particular period of a time

bharathgodi
Member
Member
on

1.13210862 will be the result in output array

2.we can create an array in control panel and block diagram

IN FRONT PANEL:

in controls pallette(right click on frontpanel to get control panel) select : modern >> Array, Matrix & Cluster >> Array.drag and drop it on Front panel, now select control or indicator of any data type or data structures (numeric, boolean, string, array, cluster) and drop it into the array to create array of control or indicator.

IN BLOCK DIAGRAM:

1. funtion pallette >> programming >> array >>Initialize Array.

2. funtion pallette >> programming >> array >>Build Array.

3. In programming using a while or forloop by enabling indexing technique we can create array of different dimensions.

using any above 3 different ways we can create array.

3. when the While loop will finishes executing one iteration, it immediately starts executing the next iterations

  1. using Wait functions we adjust the frequency of execution of iterations.
  2. Timing a loop allows the processor time to complete other tasks such as updating and responding to the user interface.
  3. The Wait (ms) function forces the loop to wait for a user-specified amount of time, in milliseconds, before running the next iteration
  4. Using Wait Until Next ms Multiple function we can synchronize different activities
alnabulsi
Member
Member
on

Q1)it will be the array [1 4 3 2 1 0 8 6]

Q2)Depending on the type of array different ways can be followed:

A)One-Dimension Array.
1) input or output array : Controls Palette → All-Controls → Array & Cluster → Array

2) constant array: Functions Palette → All-Functions → Array → Array

Constant

B) Multi-Dimensional Array.

1)Creating a matrix (same ways as one-dimensional array)

Q3)

1)It acts like a sampling period for the while loop

2) It is used as timing control for a While Loop to prevent LabVIEW from using too much of the processor.

sandy.
Member
Member
on

Answer 1)  Result in Array after the given code has executed:- 186211 

Answer 2)  On Back panel

                      a) Goto Functions click on Programming click on Array and select Array constant and drop it on block diagram then select any kind                     of data( int, float etc...) by dropping any controllers in array constant

                               Functions - Programming - Array - Array constant 


                 On Front panel

                b) Goto Controls click on Classic click on Array,Matrix... and select Array constant and drop it on Front panel then select any kind                     of data(int,float etc...) by dropping any controllers in array constant

                    Controls - Classic - Array,Matrix... - Array constant 

 

Answer 3) Without using Wait Function in While loop the recursion is going to be done with maximum capability or max speed of the                 processor(depends on the machine cycle) which gives more pressure on processor and That much speed is not necessary for                           common use so we use wait function to decrease speed of loop and increasing performance of processor

                     

                To interface hardware modules like(LCD display,Microcontrollers,Ultrasonic sensor) wait is used. Since the speed of hardware                           modules like(LCD display,Microcontrollers,Ultrasonic sensor) is very slow comparing to the processors that we use in PC, by using                 WAIT function we can match up the speed and make communication with them

Finally I just want to say thanks a lot for conducting such programs to educate students like me and providing such a big platform to interact with each other  .....

MoatazKamel
Member
Member
on

- The result will be

[1,4,3,2,1,0,8,6,2]

-Creating arrays:

1) control arays:

A-On the front panel, from the aray toolbox, place an array on the front panel; then define the type by dragging a [numeric/text/boolean/etc]-control inside the array

B-on the block digram with a relevant function, click the input node of the function and right click, choose create > control [works only if the input type is determined either due to the function's specifications or by wiring another terminals that consequently determines the data type and array dimension of the node under consideration]

2) constant arrays

Same as above but with the (A) option only applicable in the block diagram rather than the front panel and by dragging a constant to the array in order to define the data type

For option (B), choose create>constant

3)Indicator array

A- from the front panel as mentioned before but by dragging an indicator to define the data type

B- from the black diagram by clicking the relevant function block's output terminal and create>indicator

C- by rightclicking on any datawire and create>indicator

Note: option (C) if applied to create a control or a constant array will create an unwired array of the same type and dimenstion of the data in the selected wire

-The wait function allows to freeze the loop for a some time between iterations if a single iteration is finished in less than this specified time to allow for some processing time for other pending OS and/or other applications processes

Rahul123
Member
Member
on

Question 1) What is the result in Array after the following code has executed ?

question 1.png

Answer: 1D Array = 143210862

Question 2) Mention all the different ways of creating an array in LabVIEW ?

Answer:- 1.By Using "For Loop/While Loop" with Enable Indexing by generating Random Number as well as Number of Loop Iterations.

  1. By Using "Build Array" Function
  2. By Using "Initialized Array" Function
  3. By Using "Matrix to Array Function"
  4. By Using "Cluster to Array " Function

Question 3) What is the purpose(s) of using the Wait function in while loop ?

Answer:-

Without a delay, the loop rate can be in the millions of iterations per second range depending on what is inside it. So that means that your CPU has about 1/1000th as much work to do and can go off and tend to other tasks. If your loop was already taking several ms, then the 1ms delay is likely in parallel and it won't affect the loop speed noticeably. So placing the delay in the loop can drop your CPU usage noticably and allow time for the OS to do other work like send messages that your application may be waiting for, etc.

Rahul123
Member
Member
on

Question 1) What is the result in Array after the following code has executed ?

question 1.png

Answer: 1D Array = 143210862

Question 2) Mention all the different ways of creating an array in LabVIEW ?

Answer:- 1.By Using "For Loop/While Loop" with Enable Indexing by generating Random Number as well as Number of Loop Iterations.

2. By Using "Build Array" Function

3. By Using "Initialized Array" Function

4. By Using "Matrix to Array Function"

5. By Using "Cluster to Array " Function

Question 3) What is the purpose(s) of using the Wait function in while loop ?

Answer:-

Without a delay, the loop rate can be in the millions of iterations per second range depending on what is inside it. So that means that your CPU has about 1/1000th as much work to do and can go off and tend to other tasks. If your loop was already taking several ms, then the 1ms delay is likely in parallel and it won't affect the loop speed noticeably. So placing the delay in the loop can drop your CPU usage noticably and allow time for the OS to do other work like send messages that your application may be waiting for, etc.

Contributors