How to fill a cell array without using a loop
Afficher commentaires plus anciens
Hi,
Assuming that we have an array of integers, for example a = [2 4 3], I am trying to create a cell array where each
cell contains arrays given by [-a(i) : 1 : a(i)] where a(i) is an arbitrary element i in the array a. So the example
a = [2 4 3] would result in a cell array c = {[-2 : 1 : 2], [-4 : 1 4], [-3 : 1 : 3]}.
I know how this can be done with a for loop but I was wondering if there is a way to do it without loops?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur MATLAB 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!