PRO VAL_COUNT,A,x,count,ROWS=rows ;+ ; QUESTION 1 ; You should write the necessary IDL statements ; to complete this procedure. After you have thoroughly ; tested the procedure and inserted your comments in ; the code, please use the simg211-submit tool to ; submit the results. ; ; By submitting this procedure for a grade you ; attest that this is your own work. ; ; PURPOSE ; This procedure counts the number of times the value ; given by x appears in rows of an array A. If the ; value of rows is not specified then all the count is ; given for every row. ; ; USAGE EXAMPLE: ; Assume that A is an array with 4 rows and you ; want to know the number of times that the value ; 2 occurs in each row. ; ; The array A in this example is ; 1 2 1 2 1 2 1 2 1 2 ; 2 1 2 1 2 1 2 1 2 1 ; 1 2 3 1 2 3 1 2 3 1 ; 3 2 1 3 2 1 3 2 1 3 ; ; VAL_COUNT,A,2,count ; PRINT,'count=',count ; ; The result should be ; count=5,5,3,3 ; ; Suppose that you want to know the number of times ; that 2 occurs in 0 and 3. Then use ; ; rows=[0,3] ; VAL_COUNT,A,2,count,ROWS=rows ; PRINT,' rows=',rows ; PRINT,'count=',count ; ; The result should be ; rows=0,3 ; count=5,3 ; ; NOTE: The program should work even if A has only ; one column. ; ; NOTE: The program should return -1 if the number ; of dimensions of A is not 1 or 2. ; ; HINT ; You can test whether a value has been assigned to ; cols by using the function N_ELEMENTS(rows). If ; N_ELEMENTS(rows) is less than or equal to zero then ; you have search all rows. ; ; PROGRAMMED BY: ; ; DATE: ;-