how to skip a cell when output a matrix with varying size to a excel file
    1 visualización (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Zcarfaz
 el 22 de Nov. de 2015
  
    
    
    
    
    Respondida: Walter Roberson
      
      
 el 22 de Nov. de 2015
            I have a matrix that varies its size depending on the user input. I need to output this to a specific column of a excel file(a table) and need to skip a cell after every element of the matrix. so let's say I have
a = [1,2,3,4,5,6,7,8]'
How do I make it
   a = [1,'NaN',2,'NaN',3,'NaN',4,'NaN',5,'NaN',6,'NaN',7,'NaN',8,'NaN']'
0 comentarios
Respuesta aceptada
  the cyclist
      
      
 el 22 de Nov. de 2015
        Here's one way:
a = [1,2,3,4,5,6,7,8]' 
a = [a, nan(size(a))]'
a = a(:)'
0 comentarios
Más respuestas (1)
  Walter Roberson
      
      
 el 22 de Nov. de 2015
        You cannot mix numeric and string in a numeric array.
a_cell = num2cell(a);
a_cell(:,2) = {'NaN'};
0 comentarios
Ver también
Categorías
				Más información sobre Spreadsheets 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!