因为上帝只知道什么原因,我们被要求在AI课程中使用MATLAB。我想要做的就是初始化一个数组,并将数组推到它上面。在Ruby中,这将是:在MATLAB中将数组推向二维数组(矩阵)
multi_arr = []
an_arr = [1, 2, 3, 4]
multi_arr << an_arr
完成!不幸的是,我无法在MATLAB中找到类似的简单解决方案。
任何意见将不胜感激。
编辑:有兴趣的,这里的非正常而解决我到达:
child_states = []
child_state = [0,1,2,3,4,5,6,7,8]
% returns [rows, columns]
dimensions = size(child_states)
child_states(dimensions(1)+1, 1:9) = child_state
我完全理解的挫折。 –
好的,所以问题是你不知道在每次迭代中'child_state'的长度? – beaker
在这种情况下,我确实知道child_state的长度。我只是不知道会有多少个child_state数组(行)。我很沮丧,因为这在我用过的任何其他编程语言中都是微不足道的 – somecbusnerd