add to extra elements every 4 values and enter particular values
    3 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Nikolas Spiliopoulos
 el 7 de Feb. de 2020
  
    
    
    
    
    Comentada: Nikolas Spiliopoulos
 el 7 de Feb. de 2020
            Hi all, 
I have a vector [1x24]  and I would like to add 2 extra elements every 4 elements, so the new vector will be [1x32].
The two extra elements will be the first two number of the first group pf 4 numbers, an example:
vector_1=[ 1 2 4 5 7 8 9 3......]
Vector_2=[1 2 4 5 1 2 7 8 9 3 7 8.....]
thanks in advance
Nikolas
0 comentarios
Respuesta aceptada
  Walter Roberson
      
      
 el 7 de Feb. de 2020
        temp = reshape(vector_1, 4, []);
temp = [temp; temp(1:2,:)];
Vector_2 = reshape(temp, 1, []);
Más respuestas (0)
Ver también
Categorías
				Más información sobre Specialized Power Systems en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

