ccelt09 has asked for the wisdom of the Perl Monks concerning the following question:
Hello all, I am a bit confused with the approach to nesting arrays. What my program does: randomly select a string with four elements from a data frame with 1553 strings, 1553 times and store the new order of these strings within an array or data frame. Then I would like to repeat this 1,000 times.
I have written this to output each rearranged assembly of 1553 strings into a separate output file because I do not understand how to store a matrix within a matrix. Could someone help explain the concept behind this idea?
# Inputs my $runs = 100000; # 1e5 - the num of times we repeat the exper +iment # Program vars my $i; # a looping variable my $j; # another looping var my $range = 1553; # the number of total window +s with data my $count = 0; # variable tracking pseudo X output + files # Outer loop: Repeat "$runs" times for ($j = 0; $j < $runs; $j++) { for ($i = 0; $i < $range + 1 ; $i++) { # choose a randomly selected string chomp @X_info; my @get_X = split('\s+', $X_info[int(rand($range))]); my $output_file = "/Users/statistical_analysis/pseudo_X/pseuo_ +X_"."$count".".txt"; open (OUT, ">$output_file") or die "can't open output file"; print OUT "@get_X\n"; } } $count++;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: A Question with Nesting Arrays
by Kenosis (Priest) on Dec 06, 2013 at 19:02 UTC | |
Re: A Question with Nesting Arrays
by toolic (Bishop) on Dec 06, 2013 at 18:25 UTC | |
by Happy-the-monk (Canon) on Dec 06, 2013 at 18:38 UTC | |
by hdb (Monsignor) on Dec 06, 2013 at 19:50 UTC | |
by taint (Chaplain) on Dec 06, 2013 at 18:55 UTC | |
Re: A Question with Nesting Arrays
by BrowserUk (Patriarch) on Dec 06, 2013 at 23:39 UTC | |
Re: A Question with Nesting Arrays
by ww (Archbishop) on Dec 06, 2013 at 22:47 UTC | |
Re: A Question with Nesting Arrays
by jethro (Monsignor) on Dec 06, 2013 at 21:20 UTC | |
Re: A Question with Nesting Arrays
by marinersk (Priest) on Dec 06, 2013 at 22:43 UTC | |
by jethro (Monsignor) on Dec 07, 2013 at 02:11 UTC | |
by marinersk (Priest) on Dec 27, 2013 at 14:30 UTC |
Back to
Seekers of Perl Wisdom