python - Different in List size -


could explain me difference in list size? once (x,1) , other (x,). think idexerror due that.

thanks enter image description here

print(annotation_matrix)    [array([[1],    ...,     [7],    [7],    [7]], dtype=uint8)]  print(idx) [array([ true,  true,  true, ..., false, false, false], dtype=bool)] 

p.s. left 1 created with

matlabfile.get(...) 

the right 1

in1d(...)  

an array of size (x,1) matrix of x rows , 1 columns (2 dimensions), differs a.t of size (1,x). have same elements in different 'orientation'. array b of size (x,) vector of x coordinates (1 dimension), without orientation (it's not row nor column). it's list of elements.

in first case, 1 can access element a[i,:] same of a[i,0] (because has 1 column). in later, call b[i,:] causes error because array b has 1 dimension. correct call b[i].

i hope helps solve problem.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

unity3d - Fatal error- Monodevelop-Unity failed to start -