I want to make matrix 512 columns x 256 rows, with the pattern like this as:
I was trying it with this one:
$b = 0;
matrik = [[]];
for ($i=0; $i < 512; $i++) {
for ($j=0; $j < 256; $j++) {
if ($j=$b) {
$matrik[$j][$j] = 1;
}else{
$matrik[$j][$j] = 0;
}
$b++;
}
}
return $matrik;
but output of this code was:
[
[
0
],
{
1: 1
},
{
2: 1
},
{
3: 1
},
{
4: 1
},
{
5: 1
},
Aucun commentaire:
Enregistrer un commentaire