Sponsored Content
Full Discussion: Returning start/end indices
Top Forums Programming Returning start/end indices Post 302487674 by kristinu on Thursday 13th of January 2011 08:07:27 AM
Old 01-13-2011
C will do

---------- Post updated at 08:07 AM ---------- Previous update was at 07:31 AM ----------

Have created a subroutine in fortran doing something like this.

Code:
    SUBROUTINE SWNA3D_IDXWIN(IVA, IVB, V, WLEN, N)
    IMPLICIT NONE
    INTEGER    N
    REAL    V(N)
    INTEGER    IVA(N)
    INTEGER    IVB(N)
    REAL    WLEN
C
    REAL, ALLOCATABLE :: VA(:)
    REAL, ALLOCATABLE :: VB(:)
    INTEGER I
    LOGICAL    L_ASCENDING
C
    ALLOCATE(VA(:))
    ALLOCATE(VB(:))
C
    L_ASCENDING = .TRUE.
    DO I = 1, N-1
      IF (V(I) > V(I+1)) THEN
        L_ASCENDING = .FALSE.
        EXIT
      ENDIF
    ENDDO
    IF (L_ASCENDING == .FALSE.) PRINT *, 'V not ascending order'
C
    DO I = 1, N
      VA(I) = V(i) - (WLEN/2.0)
      VB(I) = V(i) + (WLEN/2.0)
C
      J = 1
      ISTART = 0
      DO WHILE ((V(J) < VA(I)).AND.(J <= N))
        ISTART = ISTART + 1
        J = J + 1
      END DO
      ISTART = ISTART + 1
C
      J = 1
      IEND = 0
      DO WHILE ((V(J) <= VA(I)).AND.(J <= N))
        IEND = IEND + 1
        J = J + 1
      END DO

    ENDDO

    RETURN
    END SUBROUTINE SWNA3D_IDXWIN


Last edited by kristinu; 01-13-2011 at 10:46 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Complete dump from start to the end

Hi all... I was accidentally wipe off my iphone and lost all the data in it:(. So I tried to use dd to create an image from iphone and ssh to the Mac by using: dd if=/dev/disk | ssh user@MacIP of='image.img' Then I mount this image on Mac/Windows and run recovery software because most of the... (1 Reply)
Discussion started by: seraphc
1 Replies

2. Shell Programming and Scripting

searching between start and end time

Hello All, Below mentioned is my log file. I want to make a script which ask for start time and then end time and then search particular word between those lines. Like start time:2 end time: 4 and then search all values starting from cell 84 between this time. Please Help ... (2 Replies)
Discussion started by: wakhan
2 Replies

3. Shell Programming and Scripting

can I specifiy the start and end times manually

Hi I have a ksh script which fetches data from a db using a number of .arc files and creates CSV files for them and puts them on the server. Question is, how can I specifiy the start and stop times specifically so that data is fetched for a certain period? # Get the current time as the... (1 Reply)
Discussion started by: shajju
1 Replies

4. Shell Programming and Scripting

Perl regex using /START/../END/

I need help with perl code. I have a data file with lots of data example: data.txt file START DATA1 sjdfh kjhdf DATA2 sdkjfhk jds dshfgdf ... Around 20 - 30 lines END LDDDD awdkjasd a sdkahgdk jasdh SOME CRAP Some EMPTY lines etc START DATA1 sjdfh kjhdf DATA2 sdkjfhk jds... (2 Replies)
Discussion started by: chakrapani
2 Replies

5. Shell Programming and Scripting

Calculating start and end of UK summertime

I have a need to calculate when British Summer Time starts and ends. After messing around, the following seems to work in Bash. echo `date +%Y`-03-`cal 3 \`date +%Y\` | grep -oE "^]{2}" | tail -1`T01:00:00Zand echo `date +%Y`-03-`cal 10 \`date +%Y\` | grep -oE "^]{2}" | tail ... (10 Replies)
Discussion started by: esb4me
10 Replies

6. Shell Programming and Scripting

Remove lines between the start string and end string including start and end string Python

Hi, I am trying to remove lines once a string is found till another string is found including the start string and end string. I want to basically grab all the lines starting with color (closing bracket). PS: The line after the closing bracket for color could be anything (currently 'more').... (1 Reply)
Discussion started by: Dabheeruz
1 Replies

7. Shell Programming and Scripting

Get the lines from logfile within start and end date

Hi guys, I am having the below logfile,date in yyyy-mm-dd 2013-08-02 *some content* 2013-08-02 *some content* 2013-08-02 *some content* 2013-08-03 *some content* 2013-08-05 *some content* from the above logfile i need to get the lines between the two timestamps,if i give... (5 Replies)
Discussion started by: mohanalakshmi
5 Replies

8. Shell Programming and Scripting

How can I search with start and end criteria?

Hello I'm using cygwin and wouldlike extract information from an xml file according specific values, but don't know how. Let's say in a file content looks like this: <tab> SURNAME=Mustermann NAME=Max CUSTOMER SINCE= 18.01.2000 ADDRESS=Birmingham ... (2 Replies)
Discussion started by: witchblade
2 Replies

9. Shell Programming and Scripting

Split a file by start and end row.

I have a file which looks something as following, I would like to split to several files, The start and end of each file is 'FILE' and end with 'ASCII... ' . At the same time for each file in the first column add 100 and also second column add 100 the rest of the column as it is , see example of... (2 Replies)
Discussion started by: tk2000
2 Replies

10. UNIX for Beginners Questions & Answers

Splitting week start date and end date based on custom period start dates

Below are my custom period start and end dates based on a calender, these dates are placed in a file, for each period i need to split into three weeks for each period row, example is given below. Could you please help out to achieve solution through shell script.. File content: ... (2 Replies)
Discussion started by: nani2019
2 Replies
buffer_get(3)						     Library Functions Manual						     buffer_get(3)

NAME
buffer_get - read binary data from buffer SYNTAX
#include <buffer.h> ssize_t buffer_get(buffer* b,char* x,size_t len); DESCRIPTION
Normally buffer_get copies data to x[0], x[1], ..., x[len-1] from the beginning of a string stored in preallocated space; removes these len bytes from the string; and returns len. If, however, the string has fewer than len (but more than 0) bytes, buffer_get copies only that many bytes, and returns that number. If the string is empty, buffer_get first uses a read operation to feed data into the string. The read operation may indicate end of input, in which case buffer_get returns 0; or a read error, in which case buffer_get returns -1, setting errno approporiately. The preallocated space and the read operation are specified by b. You must initialize b using buffer_init before calling buffer_get (or use the pre-initialized buffer_0). SEE ALSO
buffer_init(3), buffer_feed(3), buffer_peek(3), buffer_seek(3), buffer(3) buffer_get(3)
All times are GMT -4. The time now is 08:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy