フィルターのクリア

Structures and cells - how to modify and save

2 ビュー (過去 30 日間)
susan
susan 2012 年 6 月 21 日
Hello,
I have a simple question regarding the transform between struct and cell..
A
ans =
1x1158 struct array with fields:
type
latency
urevent
B = struct2cell(A);
B is now <3x1x1158 cell>
How do I know transform B back into struct?
I tried this:
fields={'type','latency','urevent'};
D=cell2struct(C,fields,1158);
??? Error using ==> cell2struct
Number of field names must match number of fields in new structure.
Help!

採用された回答

Walter Roberson
Walter Roberson 2012 年 6 月 21 日
D=cell2struct(C,fields,1);

その他の回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2012 年 6 月 21 日
if C cell array with size (3 x 1158) then
D=cell2struct(C,{'type','latency','urevent'},1);
or C cell array with size (1158 x 3) then
D=cell2struct(C,{'type','latency','urevent'},2);

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by