table2struct関数の挙動に疑問があります.「構造体→テーブル→構造体」の順でデータを変換しても元に戻らないのはおかしいのではないでしょうか?
Afficher commentaires plus anciens
s = struct('a',{1,2},'b',{3,4})
st = struct2table(s)
sts = table2struct(st)
上のコードを実行した場合,構造体sは1x2 structですが,復元した構造体stsは2x1 structになります.
s(2)とsts(2)は同じ値を示しますが,sとstsでサイズが異なるというのは違和感があります.sts'のように転置をすれば解決しますが,table2struct関数の出力サイズを1xNにするべきではないでしょうか?
1 commentaire
1xNの行ベクトルにすると元に戻ります。しかしこれは求めている table の形でしょうか?
s = struct('a',[1,2,3,4],'b',[5,6,7]);
st = struct2table(s)
sts = table2struct(st)
Réponses (0)
Catégories
En savoir plus sur 構造体 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!