How to insert a column in a cell array
89 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello everyone,
I am trying to insert a new empty column inside a cell array between two existing columns without deleting one of them. I basically want to perform the task ('Insert column to the left') shown in the picture below by code:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/273766/image.png)
I hope someone can help me with this.
Thanks in advance.
0 commentaires
Réponse acceptée
David Hill
le 26 Fév 2020
Cell arrays can contain anything in there cells. Inserting a empty holder for a column vector:
b={a{1:2},[],a{3:end}}
2 commentaires
F
le 12 Oct 2022
Open variable in variable editor and right click to get menu, select column to the left (or right) or whatever you want.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Shifting and Sorting Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!