Turning array values into values on an x axis
    6 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
2 comentarios
  Matt Fig
      
      
 el 2 de Nov. de 2012
				Tom's question
Suppose I had a double array and the values were 2,3,6 and 9.
How would I create a double array where all of the values are 1, except the 2nd, 3rd, 6th and 9th, which are 2?
Respuesta aceptada
  Wayne King
    
      
 el 1 de Mayo de 2012
           x = ones(500,1);
   indices = [2 3 6 9];
   x(indices) = 2;
Or
   x = ones(500,1);
   x(indices) = x(indices)+1;
3 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre Logical en Help Center y File Exchange.
			
	Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!