[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC: method for storing data
From: |
Judd Storrs |
Subject: |
Re: RFC: method for storing data |
Date: |
Fri, 25 Jun 2010 11:30:37 -0400 |
I think something like a struct could work for this (and may already
be possible unbeknownst to me). Consider:
L3.x = [1,2,3,4,5,6,7,8,9,10] ;
L3.y = [1,1,1,1,1,1,1,1,1,1] ;
L3.fac = "AABAABCABB" ;
What's probably missing is the concept of forcing all elements of the
struct to have the same length, and enforcing an order on the elements
and a clever display routine. I think most of this could be covered by
a @class so that
L3(1,1) returns L3.x(1) or L3.x{1} depending on the type of x.
size(L3) returns [10,3]
disp(L3) does something sane
L3(1,1) = a validates the type of a before inserting the value
L3(20,1) expands the length of all columns
L3.newcolumn = b creates a new column vector for holding type b.
This could probably be implemented as a simple wrapper around either
struct or a 2D cell array. Probably struct is more efficient for
column access and enforcing type uniformity.
--judd