Can I define more than 26 constants?

MEDState Notation Repository Forums Coding Help Archive Can I define more than 26 constants?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #13003
    Med_Support
    Moderator
    blee13

    I am writing a program which utilizes more than 26 constants (A – Z).
    I am in need of a few more letters to complete my code. Is there a way to define constants in another way?

    For example, instead of DIM D = 1000
    something like the following DIM DG = 1000

    Thanks!

    #13004
    Med_Support
    Moderator
    Gary Bamberger

    Unfortunately not.  There are only 26 letters from A-Z.  Each letter can be either a variable or an array.  By using arrays you can have up to 1,000,000 data elements.

    If that still proves to not be enough, then what I have done in the past is declare two arrays.  When one array fills up or a certain amount of time has passed I use the COPYARRAY command (Ex: COPYARRAY C,D,250000).  This copies the data from one array to another.  I then zero out the original array (Ex: ZEROARRAY C) which allows the program to continue collecting data using the C Array.  Remember to reset the index variable.  Finally I execute the FLUSH command to save the data in the D Array.

    When using this technique make sure to use the DISKVARS command so that only the data that you care about is saved to the disk.

     

    Another technique for condensing variables that I have used is to turn my index variables into an array:

    DIM I = 1
    
    SET C(I(0)) = S; ADD I(0);
    
    ADD D(I(1)), I(1);
    

     

    I also like to use Arrays for all of my Var_Alias commands:

    DIM A = 5
    
    Var_Alias Session Length (min)                       = A(0)  \ Default = 60 minutes
    Var_Alias Correct Lever (1=Left  2=Right)            = A(1)  \ Default = 1-Left
    Var_Alias Fixed Ratio Value                          = A(2)  \ Default = 1
    Var_Alias Reward Device (1=Pellet  2=Dipper  3=Pump) = A(3)  \ Default = 1-Pellet
    Var_Alias Reward Time (sec)                          = A(4)  \ Default = 0.05 seconds
    Var_Alias Time Out Following Reward (sec)            = A(5)  \ Default = 0 seconds
    

     

    I hope that this information helps.  If you post your program or email it to me I can possibly give you more specific ways of condensing the variables in your program.

    Gary

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.