Is there a quick and easy way to insert/delete values into the middle or beginning of a cell array and/or a numerical array
Afficher commentaires plus anciens
I have a cell array and a numerical array. I want to insert values into the beggining, middle and end of the cell array or the numerical array. Is there an easy way to do this.
I also want to be able to delete array elements at the beginning, middle or end of the arrays. Same question...
Réponse acceptée
Plus de réponses (1)
madhan ravi
le 16 Déc 2018
Modifié(e) : madhan ravi
le 16 Déc 2018
a=1:11;
a(1) = somevalue%first element [] square bracket removes that element
a(fix(mean(a))) %mid element
a(end) % last element
4 commentaires
Robert Garneau
le 16 Déc 2018
madhan ravi
le 16 Déc 2018
I am having trouble understanding you please give an example.
Robert Garneau
le 16 Déc 2018
Stephen23
le 17 Déc 2018
"is there an easier way to do it using MATLAB Functions/abilities."
Not really. Indexing is the easiest way.
Catégories
En savoir plus sur Creating and Concatenating Matrices 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!