Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matrix Smalltalk矩阵零误差_Matrix_Smalltalk - Fatal编程技术网

Matrix Smalltalk矩阵零误差

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

所以我在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 numberOfColumns: 3.
aMatrix numberOfRows: 3. 
?

我检查了代码,但不明白为什么它是以这种方式实现的。
numberOfColumns:
numberOfRows:
只需将参数分配给实例变量,但不要更改内部数据结构

你应该这样做:

aMatrix := Matrix rows: 8 columns: 10.   
aMatrix at: 2 at: 2 put: 6.

嘿,谢谢你的帮助。我如何通过写流打印这个矩阵?