Thanks Werner,

Both work fine. First seems more legible to me and I don't need DhbVector properties yet. My error was using #numberOfRows #numberOfColumns as constructors instead of #rows and #columns.

Cheers,

Offray

On 24/10/15 03:21, Werner Kassens wrote:
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




Reply via email to