how can we construct different cells inside cell-array?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sushil Pokharel
il 26 Giu 2022
Commentato: Sushil Pokharel
il 27 Giu 2022
hi there,
I have a cell array of 1x6 size; 6 cell in one rows which contains a data set. Now, I want to construct a 7th cell in which I wanted to store some information regarding experiment. For that, I need to make different cell inside the 7th cell. for instance:
cell_array {1,7} ={ {Date :}, {Name :}, {Exp_time :}, {Remarks : }}
Your help will be greatly appreciated.
Best,
Sushil
0 Commenti
Risposta accettata
Voss
il 26 Giu 2022
Perhaps a structure would be useful for storing that information:
exp_info = struct( ...
'Date','2022.06.29', ...
'Name','experiment_1', ...
'Exp_time','00:05:00', ...
'Remarks','Wednesday morning at five o''clock, as the day begins');
Store it in the 7th cell of cell_array, like you plan to:
cell_array = repmat({rand(10)},1,6);
cell_array{1,7} = exp_info
cell_array{1,7}
Or rearrange the thing and store the experimental data in the same structure:
% - one possibility -
exp_info.Results = cell_array(1:6)
% - another possibility -
exp_info.Results = cell2struct(cell_array(1:6),sprintfc('Result_%d',1:6),2)
exp_info.Results
6 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Structures in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!