arrayfun num2cell structure
2 ビュー (過去 30 日間)
古いコメントを表示
I'd like to take my structure 'r' and convert each child into cell matrix with the goal of horzcat everything into on cell array.
r =
bar_count: [256x1 double]
date: [256x1 double]
time: [256x1 double]
position: [256x1 double]
After converting date and time to datestrs I'd like to
full_data = horzcat(bar_count, date, time, position)
how can I convert bar_count and position to num2cell with arrayfun()? I have several other arrays in my structure that I have to convert as well.
Thanks
0 件のコメント
回答 (1 件)
Sean de Wolski
2012 年 4 月 10 日
Something like:
x.a = num2cell(pi*ones(4,1));
x.b = {'hello'; 'world';'Tuesday';'coffee'};
x.c = num2cell((1:4).')
y = struct2cell(x); %first to cell then concatenate
y = horzcat(y{:})
?
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!