optimizing macro for many iterations

Hi all

I have a question regarding writing a simple macro. What I want to do is to construct matrices from two paired 1D waves (total four 1D waves).  

I want to do something like this…

For example, there are four 1D waves (1A, 1a, 2B, 2b) in which 1A&1a and 2B&2b are paired respectively, and each wave is composed of values determined by the rules below.

  • 1A, 1B: sequential increment from 1 to 1,000,000
  • 1a, 1b:  random value between 1 and 4096

Thus, the size (dimension) of each wave is 1,000,000.

1A

1a

2B

2b

1

0

1

500

2

1000

2

3000

3

4095

3

10

 

For each specific difference between 1A and 2B, I want to make 2D histograms in which X and Y coordinates correspond to components associated from 1a and 2b. After 1,000,000 x 1,000,000 iterations, the size of the final output wave would be 4096x4096x999,999. It may take too much time to complete this procedure because of too many iterations. is it possible to complete this procedure in Igor? I would really appreciate any feedback on this matter.

Thank in advance.

Best wishes,

YC

I don't fully understand what you are trying to do. In answer to your question, it is possible to do this in Igor and those are not too many iterations you are talking about. From what I understand it is possible to write your function in a more simplified way so that you don't need to iterate so much. Some advice:

  • From your description there's a mix up between the names of the waves and what you are describing
  • Those names are a bad choice in Igor 1) because they start with a number and not a letter 2) Igor is case insensitive so 1A and 1a are treated similarly. You can use liberal names but this is best avoided.
  • If 1A and 1B are just indexes, you probably don't need them - you can just use the row/point number.
  • I'm guessing that you can probably generate the matrix directly in one line using the enoise function.

I sincerely appreciate those tips to make a better macro. I think I can figure it out. Thank you again.