arrayfun num2cell structure

1 vue (au cours des 30 derniers jours)
Trader
Trader le 10 Avr 2012
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

Réponses (1)

Sean de Wolski
Sean de Wolski le 10 Avr 2012
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{:})
?

Catégories

En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by