array with vectors as elements
    100 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    Jetty Rakesh Aditya
 il 24 Ott 2020
  
    
    
    
    
    Modificato: Ameer Hamza
      
      
 il 24 Ott 2020
            i have two column vectors
c1 = 1
        0
c2 = 0
        1
i want to store them as elements in an array. How can i do so?
0 Commenti
Risposta accettata
  Ameer Hamza
      
      
 il 24 Ott 2020
        
      Modificato: Ameer Hamza
      
      
 il 24 Ott 2020
  
      c = {}
c{1} = [1; 0];
c{2} = [0; 1];
Access them using brace indexing
c{1}; % first vector
c{2}; % second vector
The alternative is to create a matrix and assign these values as columns. However, this will only work if all elements have equal lengths.
c = zeros(2,2);
c(:,1) = [1; 0];
c(:,2) = [0; 1];
0 Commenti
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su Creating and Concatenating Matrices 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!

