matrix cells indexing

5 views
Skip to first unread message

Suhad Faisal

unread,
Jul 4, 2014, 5:08:43 AM7/4/14
to
Hello 

please can you help me to correct this error 
in my model 

/**
 *  Matrix
 *  Author: suhad
 *  Description: 
 */

model Matrix
global { 
file Peoplefile4<-file('../includes/41821.csv');
int pos_x;
     int pos_y;
 //    point location;
init
{  matrix data<- matrix(Peoplefile4);
    loop i from: 1 to:  data.rows -1
     {
       loop j from: 0 to: data.columns -1
        {  
        create People from: data header:true ;
   //     with:[pos_x::int(read('pos_x')),pos_y::int(read('pos_y'))];
        write "data rows:"+ i +" colums:" + j + " = " + data[j,i];
      location.x<-data[i,3];
      location.y<-data[i,4];
                
       }
          }
       }  
       
        
  entities { 
  species People
  { int pos_x;
      int pos_y;
      
      
 aspect basepeople {draw circle(0.5) color:rgb("green") at:{location.x, location.y};
      //location+rnd(300);
      }
      }
                 
experiment Citymatrix type: gui {output { display disp { species People
                                                    aspect: basepeople;
                                                                                                        
                                                    }
                                                    }
                                                   
                                                   
                                                   }
                                                   
                                                   }
                                                                                                     }
indeed I want to use location facet as a reference to matrix cells (refer to coordinate locations using matrix cells), how can I do that? , since my code doesn't work 

thanks in advance 
suhad
Reply all
Reply to author
Forward
0 new messages