How I can modify this code to split the cells of a cell array?
Vous suivez désormais cette question
- Les mises à jour seront visibles dans votre flux de contenu suivi.
- Selon vos préférences en matière de communication il est possible que vous receviez des e-mails.
Une erreur s'est produite
Impossible de terminer l’action en raison de modifications de la page. Rechargez la page pour voir sa mise à jour.
0 votes
Partagez un lien vers cette question
Réponse acceptée
1 vote
Partagez un lien vers cette réponse
11 commentaires
Partagez un lien vers ce commentaire
- Figure out the maximum number of splits ahead of time by scanning each file, throwing away the content each time and just retaining knowledge of the maximum number of splits seen so far; then constructing a cell array with that number of columns and going back and re-reading the files; this requires re-reading and re-splitting each file
- Figure out the maximum number of splits ahead of time as you go, by reading the file and figuring out the splits, and keeping the unsplit tables and the knowledge of the maximum number of splits so far; then constructing a cell array with that number of columns and going back and splitting the saved table into the cell array. This requires re-splitting each file but not re-reading it
- Read and split the tables into cell array like I already posted; afterwards, scan to find the maximum number of splits, and repack the cell of splits into columns, without having to re-read or re-split, and never needs to grow an array dynamically
- Read and split the tables as you go. As you read in one and split it, if the number of splits it would need is greater than the maximum number of splits so far, then pad out the existing cell to the required number of columns; then either way, store into only the number of columns needed for the data, leaving the other columns for the row empty. The logic for this approach is relatively easy, but it does mean that you are not pre-allocating the cell array and need to grow it from time to time
Partagez un lien vers ce commentaire
Partagez un lien vers ce commentaire

Partagez un lien vers ce commentaire
Partagez un lien vers ce commentaire
Partagez un lien vers ce commentaire
Plus de réponses (0)
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
