how to skip a cell when output a matrix with varying size to a excel file
조회 수: 1 (최근 30일)
이전 댓글 표시
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
채택된 답변
the cyclist
2015년 11월 22일
Here's one way:
a = [1,2,3,4,5,6,7,8]'
a = [a, nan(size(a))]'
a = a(:)'
댓글 수: 0
추가 답변 (1개)
Walter Roberson
2015년 11월 22일
You cannot mix numeric and string in a numeric array.
a_cell = num2cell(a);
a_cell(:,2) = {'NaN'};
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!