how to skip a cell when output a matrix with varying size to a excel file
    1 view (last 30 days)
  
       Show older comments
    
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 Comments
Accepted Answer
  the cyclist
      
      
 on 22 Nov 2015
        Here's one way:
a = [1,2,3,4,5,6,7,8]' 
a = [a, nan(size(a))]'
a = a(:)'
0 Comments
More Answers (1)
  Walter Roberson
      
      
 on 22 Nov 2015
        You cannot mix numeric and string in a numeric array.
a_cell = num2cell(a);
a_cell(:,2) = {'NaN'};
0 Comments
See Also
Categories
				Find more on Spreadsheets in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

