matlab - Multiple elements in a 0-d Numpy array -


i'm reading *.mat file (not sure of matlab version used) scipy.io.loadmat in python 2.6, , i'm not able work arrays read due array dimensioning. seems attempt access elements, end 0-d array still has multiple elements. i've looked @ this , this, still stuck how work elements.

let's read array,

data = scipy.io.loadmat(filename,squeeze_me=false) .... b = data[0][0]['somevar'] 

after this, have

b=  [[ array([[ 1.0884988 ,  1.08116209,  1.07364911,  1.06662874,  1.06008637,                 1.0530468 ,  1.04619028,  1.03984295,  1.03342865,  1.02715746,                 1.02114066,  1.01496634,  1.00904967,  1.00316573,  0.99803184,                 0.99262961 ]])]] 

now, if attempt b.squeeze() or b = b[0][0], have

b=  [[ 1.0884988   1.08116209  1.07364911  1.06662874  1.06008637          1.0530468   1.04619028  1.03984295  1.03342865  1.02715746          1.02114066  1.01496634  1.00904967  1.00316573  0.99803184          0.99262961]] 

which 0-d array, , naturally end error

indexerror: 0-d arrays can't indexed 

or like, , cannot access elements of b.

how can access elements of array read loadmat without producing 0-d array, , preferably more elegance using multiple [0] indices? or suggestions.

if type b @ python prompt show, structure can access "real" array via b[0][0].squeeze() - regardless of whether inner array array python library or numpy.array. in other words, works me.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -