[Pharo-users] Matrix error

Werner Kassens wkassens at libello.com
Sat Oct 24 04:21:12 EDT 2015


Hi Offray,
you could try this:

medMatrix:=Matrix rows: 5 columns: 7.
1 to: medMatrix numberOfRows do: [:row |
     1 to: medMatrix numberOfColumns do: [ :column |
         medMatrix at: row at: column  put: 0.
         Transcript show: row asString, ',', column asString, '|'.
     ].
     Transcript  cr.
]."see transcript"
medMatrix.
"(0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0 )"
"in scismalltalk:"
m2:=DhbMatrix rows: ((1 to: 5) collect:[:i|(Array new:7)]).
1 to: m2 numberOfRows do: [:row |
     1 to: m2 numberOfColumns do: [ :column |
         m2 at: row at: column  put: 0.
         Transcript show: row asString, ',', column asString, '|'.
     ].
     Transcript  cr.
]."see transcript"
m2.
"a DhbVector(0 0 0 0 0 0 0)
a DhbVector(0 0 0 0 0 0 0)
a DhbVector(0 0 0 0 0 0 0)
a DhbVector(0 0 0 0 0 0 0)
a DhbVector(0 0 0 0 0 0 0)"


werner




More information about the Pharo-users mailing list