how to concatinate two array values in one array
    2 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    singh
      
 el 17 de Abr. de 2015
  
    
    
    
    
    Comentada: James Tursa
      
      
 el 17 de Abr. de 2015
            Suppose i have two arrays
A1=
   1
   2
   4
   7
   9
   12
   21
A2 =
   10.21   32.31
   43.54   30.12
   41.32   59.21
   47.11   43.94
   95.5    93.2
   86.32   90.2
   12.33   57.65
now i wish to make another array which store both array values acording this order
 A3=
 A1          A2
 1      10.21  32.31
 2      43.54  30.12
 4      41.32  59.21
 7      47.11  43.94
 9      95.5   93.2
 12     86.32  90.2
 21     12.33  57.65
0 comentarios
Respuesta aceptada
  James Tursa
      
      
 el 17 de Abr. de 2015
        A3 = [A1 A2];
2 comentarios
  James Tursa
      
      
 el 17 de Abr. de 2015
				Nothing is removed from the values, but being in a matrix vs being just a scalar can alter how the number is displayed. E.g.,
>> A = 1
A =
     1
>> B = 1e-5
B =
   1.0000e-05
>> C = [A B]
C =
    1.0000    0.0000
>> C(2)
ans =
   1.0000e-05
>> format long g
>> C
C =
                         1                     1e-05
>> format short
>> C
C =
    1.0000    0.0000
You can see from the example that the 1e-5, when first made part of the C matrix, displayed as 0.0000. But that is just an artifact of the short display format. The number hasn't changed or been truncated in any way, as can be seen by just displaying C(2) by itself, and by changing the display format to long g.
Más respuestas (0)
Ver también
Categorías
				Más información sobre Operators and Elementary Operations 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!