How to create a cell array with constant data input without overwriting?
Afficher commentaires plus anciens
I’m running a code for different files, however I need to sore the results in a cell array without overwriting the info in each cell, I mean every time I run the code for a different file as a result it creates a second row of data in the cell array. Thanks.
6 commentaires
Nicolas B
le 9 Juin 2021
Couldn't you create a new dimension in your cell array?
For example:
x(end+1,:,:) = y;
Fercho_Sala
le 9 Juin 2021
Modifié(e) : Fercho_Sala
le 10 Juin 2021
Fercho_Sala
le 10 Juin 2021
Stephen23
le 10 Juin 2021
The MATLAB documentation shows how:
Fercho_Sala
le 10 Juin 2021
Stephen23
le 10 Juin 2021
"Apparently, it doesn't explain the fact how you can create a cell array or a vector without overwriting the results of the previous run. "
Here, I highlighted it for you:

How to use indexing in loops is explained here:
See also:
Réponses (1)
kishore kavuru
le 18 Juin 2021
0 votes
num_files = 10; cell_data = {}; for k = 1:num_files cell_data{end+1} = filenames(k);%example %file names end
1 commentaire
Fercho_Sala
le 25 Juin 2021
Catégories
En savoir plus sur Time Series Events 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!