First time here? Check out the FAQ!

Ask Your Question
0

structure similar to Matlab Cells

asked 13 years ago

mariano.real gravatar image

Hi I'm quite new in SAGE, I'm trying to learn it to migrate from Matlab. The problem I'm having is with Matlab cell structures, I couldn't find any similar structure in SAGE. The Matlab cells allows me to gather data of different sizes and styles in a single structure (matrices of different sizes for example) which I find really useful since my measurement data tends to change in size, headers, etc. Any feedback will be appreciated.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
4

answered 13 years ago

Jason Grout gravatar image

A python list can handle heterogenous data.

sage: a=[random_matrix(ZZ,3), random_matrix(ZZ,2), 'test string']
sage: a
[
[ -1   0  -1]                        
[  2  -1  -2]  [ 1  2]               
[ -8  -2 -18], [-3  2], 'test string'
]
sage: a[0]
[ -1   0  -1]
[  2  -1  -2]
[ -8  -2 -18]
Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 13 years ago

Seen: 421 times

Last updated: Oct 22 '11