Saving strings (ex. 0222222) from MATLAB to Excel using xlswrite is saving as a numeric.
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
I am trying to save a string (i.e. 02222222) into excel. I need to keep the leading zero, but when I use xlswrite in MATLAB is converts it to a number, so I lose the leading 0.
I currently have my data saved in a cell array as a string.
Any clue if this is possible?
댓글 수: 2
Rik
2018년 3월 12일
Have you tried wrapping the values in double quotes? Excel has a tendency to be smart-ass and change the data type if you don't include " to denote strings.
답변 (1개)
Fangjun Jiang
2018년 3월 12일
Add a single quote in front to deal with Excel
a={'"022','''022','022'}
xlswrite('test.xls',a);
winopen test.xls
댓글 수: 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!