Hello
I have a problem with reading a specific fields from csv file as in the following model : where I need to deal with just the pos_x, pos_y fields to assign them as a matrix cell but gama read them differently
any advice to adjust it
model Matrix
/* file my_csv_file <- csv_file("../includes/iris.csv",",");
init {
matrix data <- matrix(my_csv_file);
loop i from: 1 to: data.rows -1{
loop j from: 0 to: data.columns -1{
write "data rows:"+ i +" colums:" + j + " = " + data[j,i];
*/
global {
file Peoplefile4<-file('../includes/41821.csv');
int i;
int j;
{ matrix data<- matrix(Peoplefile4);
loop i from: 1 to: data.rows
{
loop j from: 4 to: 5
{
write "data rows:"+ i +" colums:" + j + " = " + data[j,i];
create People from: data header:true
with:[i::int(read('pos_x')),j::int(read('pos_y'))];
location<-data[i, j];
}
}
}
entities { species People
{
int i;
int j;
aspect basepeople {draw circle(0.5) color:rgb("yellow") at:location;}
}
}
experiment Citymatrix type: gui {
output { display disp
{
species People aspect: basepeople;
} }
} }
thanks in advance
suhad