SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 8 of 8
  1. #1
    Member
    Join Date
    Jan 2009
    Posts
    67
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    two dimension array

    Hello,

    Please help me this.

    I have two array A and B each contains many rows (but don't know how many before loading data from external file), and would like to define a two dimension array C, then assign all A's values to C's first column and B's values to C's second column. Can any one tell how to do it?

    Thanks,

  2. #2
    Moderator
    Join Date
    Jun 2003
    Location
    Hollis, NH, USA
    Posts
    1,551
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: two dimension array

    When you read values from the data file, count them (e.g. in a variable called numRecords). The one quirk about SCL is that when you reach the end of the file, you won't get an error. There are many examples of reading values from a file in this and other forums. Make sure you use mutexes to synchronize NEXT requests.

    Executing a NEXT statement will cause the file pointer to wrap around to the beginning of the file if you go past the last record. So, to know when you are at the end of a file, you must put a special value as the last record of the file to indicate the end and test for it in your code. Once you count them, do something simple like;


    <font class="small">Code:</font><hr /><pre> integer a[10000]
    integer b[10000]
    integer c[2,10000]
    integer numRecords
    integer i

    do i = 1,numRecords
    set c[1,i]=a[i]
    set c[2,i]=b[i]
    end do</pre><hr />

  3. #3
    Member
    Join Date
    Jan 2009
    Posts
    67
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: two dimension array

    Thanks Bernie! do you have any resource / web site which talk about multiple dimension array, and its predifined functions I can use?

  4. #4
    Moderator
    Join Date
    Jun 2003
    Location
    Hollis, NH, USA
    Posts
    1,551
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: two dimension array

    The help in the SCL modeler isnt too bad. Start there. In the modeler, menu-&gt;Help-&gt;SCL reference-&gt;Index

    Then search for arrays, integer, character. Search the site for discussions on files and mutexes. What more do you need to know about an array besides how to dimension it (up to 3 dimensions) and how to reference array elements?

  5. #5
    Member
    Join Date
    Feb 2009
    Posts
    46
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: two dimension array

    Hi Bernie,

    Can we define a multidimensional array and load the responses to that array ? Hope this may helpful when the response size exceeds than 65K?

    Thanks and regards
    Hiran.S

  6. #6
    Moderator
    Join Date
    Jun 2003
    Location
    Hollis, NH, USA
    Posts
    1,551
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: two dimension array

    You can do it, but no array element can be larger than 64KB. I don't see this as a way to get around the 64KB variable size.

  7. #7
    Member
    Join Date
    Feb 2009
    Posts
    46
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: two dimension array

    thanks bernie,

    but in opensta help document it shows there is no such limits..? correct me if i am wrong?

    thanks and regard
    Hiran.S

  8. #8
    Moderator
    Join Date
    Jun 2003
    Location
    Hollis, NH, USA
    Posts
    1,551
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: two dimension array

    HEBY,

    If you don't believe my answer, give it a try and report back here on what you find. There are only two ways to attempt what you want. Either declare a character array with size &gt; 64KB or try to load a string larger than the array element size and see if the result is that the larger string somehow spans array elements. I think you will find that neither works the way you hope it would.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 02:20 PM.

Copyright BetaSoft Inc.