25
에 빈 배열을 연결 나는이 작업을 수행 :매트랩 NumPy와
이>> E = [];
>> A = [1 2 3 4 5; 10 20 30 40 50];
>> E = [E ; A]
E =
1 2 3 4 5
10 20 30 40 50
지금 내가 NumPy와에서 같은 일을 원하지만 내가 이것 좀 봐, 문제가 :
>>> E = array([],dtype=int)
>>> E
array([], dtype=int64)
>>> A = array([[1,2,3,4,5],[10,20,30,40,50]])
>>> E = vstack((E,A))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/shape_base.py", line 226, in vstack
return _nx.concatenate(map(atleast_2d,tup),0)
ValueError: array dimensions must agree except for d_0
내가 비슷한 상황이
>>> E = concatenate((E,A),axis=0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: arrays must have same number of dimensions
또는 :
나는이 작업을 수행 할 때
에서 MATLAB 배열은 항상 2D 이상입니다. numpy에서는 1 또는 0 차원을 가질 수 있습니다. – hpaulj