Using cell fun to extract data from a cell containing objects
Al momento, stai seguendo questa domanda
- Vedrai gli aggiornamenti nel tuofeed del contenuto seguito.
- Potresti ricevere delle e-mail a seconda delle tuepreferenze per le comunicazioni.
Si è verificato un errore
Impossibile completare l'azione a causa delle modifiche apportate alla pagina. Ricarica la pagina per vedere lo stato aggiornato.
0 voti
Condividi un link a questa domanda
2 Commenti
Condividi un link a questo commento
Risposta accettata
0 voti
Condividi un link a questa risposta
10 Commenti
- calling a function clear is a bad idea. Readers of your code may think you're trying to call the built-in clear (which is overrused by beginners).
- global variables are extremely discouraged in standard non-OOP programming. in OOP programming, there's absolutely no need for them. Use class properties.
- deleting elements of an array while you're looping over its elements is going to fail. Imagine you have the array [1 2 4 6 8] and you'd like to delete all even values with a loop as you've done:
- I don't understand why you've got a for loop wrapped in a while loop.
- In my answer, the reason I use brackets in [shoot(1:i-1).x] in the hypot call is because shoot(1:i-1) is an array. The [] converts the comma separated list returned by shoot(1:-1).x back into an array. See Stephen's comment for more links on comma separated lists. However, if you do shoot(i).x, shoot(i) is a scalar and there's no point in wrapping that in [].
- I don't understand why you've got a for loop wrapped in a while loop.
Condividi un link a questo commento
Più risposte (0)
Categorie
Scopri di più su Data Type Identification in Centro assistenza e File Exchange
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)
