【发布时间】:2012-01-08 06:07:23
【问题描述】:
在 Matlab 或 GNU Octave 中,我想做这样的事情:
x=struct('a',1,'b',2,'c',[1 2;3 4])
y=x(:) % array-ification of a struct
save -ascii y.txt y
z=load('y.txt')
x(:)=z % struct-ification of an array
我想序列化/腌制一个结构并在以后重新创建它,以便用其他语言轻松读取/保存/操作。我更喜欢中间形式是 ascii 文本而不是二进制,以方便人类阅读/编辑/调试。
我是否忘记了一些巧妙的 (:) 式结构或元胞数组切片?
【问题讨论】:
标签: arrays matlab vector struct octave