Ask Your Question
0

structure similar to Matlab Cells

asked 2011-10-21 20:08:44 -0500

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.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
4

answered 2011-10-21 21:15:20 -0500

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]
edit flag offensive delete link more

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: 2011-10-21 20:08:44 -0500

Seen: 127 times

Last updated: Oct 21 '11