Indexing of cell array containing class
    2 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    Andrea Stevanato
      
 il 19 Giu 2018
  
    
    
    
    
    Commentato: Fangjun Jiang
      
      
 il 19 Giu 2018
            It's possible to index property of class that it's in cell array. If i have a class with a property value and i have a cell array that containig one instances of class for each cell there is a way to do (like a struct):
{cell.value} or [cell.value]
0 Commenti
Risposta accettata
  Fangjun Jiang
      
      
 il 19 Giu 2018
        I tried this. It looks better to construct an array of objects, not a cell array of objects.
a=[timer,timer]
a.Period
c={timer,timer}
c{1}.Period
c.Period
2 Commenti
  Fangjun Jiang
      
      
 il 19 Giu 2018
				What do you mean " it doesn't work"?
My example was trying to suggest putting multiple objects of a class into an array (using []), not a cell array (using {}). Then you can get the same property of the multiple objects in one shot like a.Period above.
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su Structures in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

