How can i write any vector for many time from short form??
    5 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
i have a vector
 V1 = [ 45 -45 45 -45 45 -45 45 -45  45 -45 45 -45  45 -45 45 -45  45 -45]; 
 V2 = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
i want to enter just for 1 time 0 and multiple of 20 and automatically expand. for 45 and -45, just want to enter 45 and -45 and multiple of 9. and new vector v make automatically [V1, V2]; or suggest any program to automatically MATLAB ask to enter any value like 0 or 45 or -45... and how many times, and value how many times want to enter each value? and automatically create new vector
 V = [V1, V2....Vn] or V = [V(1), V(2)...V(n)];
0 Commenti
Risposta accettata
  KSSV
      
      
 il 29 Giu 2016
        function V = formvec
a = input('Enter the array to repeat:') ;
N = input('Number of times to repeat:') ;
V = repmat(a,[1 N]);
Vedere anche
Categorie
				Scopri di più su Logical in Help Center e File Exchange
			
	Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

