Matrix Smalltalk矩阵零误差
所以我在pharos 6.0的操场上运行这段代码,它给了我一个错误,说“unindex对象不可访问。基本上,我试图生成一个8x10的矩阵。如何生成一个Matrix Smalltalk矩阵零误差,matrix,smalltalk,Matrix,Smalltalk,所以我在pharos 6.0的操场上运行这段代码,它给了我一个错误,说“unindex对象不可访问。基本上,我试图生成一个8x10的矩阵。如何生成一个 | aMatrix row col| aMatrix := Matrix new. aMatrix numberOfColumns: 3. aMatrix numberOfRows: 3. aMatrix at: 2 at: 2 put: 6. 如果您尝试制作矩阵8x10,为什么要这样做 aMatrix numberO
| aMatrix row col|
aMatrix := Matrix new.
aMatrix numberOfColumns: 3.
aMatrix numberOfRows: 3.
aMatrix at: 2 at: 2 put: 6.
如果您尝试制作矩阵8x10,为什么要这样做
aMatrix numberOfColumns: 3.
aMatrix numberOfRows: 3.
?
我检查了代码,但不明白为什么它是以这种方式实现的。numberOfColumns:
和numberOfRows:
只需将参数分配给实例变量,但不要更改内部数据结构
你应该这样做:
aMatrix := Matrix rows: 8 columns: 10.
aMatrix at: 2 at: 2 put: 6.
嘿,谢谢你的帮助。我如何通过写流打印这个矩阵?