필터 지우기
필터 지우기

How to export a large array from workspace to an excel sheet [Ed. so that NaNs are preserved] ?

조회 수: 3 (최근 30일)
I have an array with over a 100000 rows and columns whose values are mostly NaN's and variables. Hence, when I give the command xlswrite, only a single row is getting copied, and instead of NaN's, they are printed as a b c... and so on. Does anybody know how to properly export a large array file to an excel sheet?

채택된 답변

Arif Hoq
Arif Hoq 2022년 3월 23일
편집: Arif Hoq 2022년 3월 23일
try this:
A=[1 2 3; NaN 3 NaN; 4 NaN 7]; % made a matrix with Nan value
B=num2cell(A)
B(isnan(A)) ={'NaN'}; % NaN as a string
writecell(B,'myfile.xlsx')
  댓글 수: 2
Jaya Poornima
Jaya Poornima 2022년 3월 24일
Thank you very much. I tried it, and it worked perfectly fine. All the NaN's and variables were successfully exported to excel.
Arif Hoq
Arif Hoq 2022년 3월 24일
my pleasure. Please accept my answer as an "Accepted Answer"

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by