필터 지우기
필터 지우기

MLGetMatrix in Matlab2019 imports NaN values into Excel as a number

조회 수: 2 (최근 30일)
Anna
Anna 2019년 8월 7일
답변: Akshit Agarwal 2019년 10월 9일
Hi,
I am using a vba script to import a matrix from Matlab into Exel. The Matrix has NaN values in it, which previously (in Matlab2016b) have been imported as NaN into Excel. Now I switched to Matlab2019a and that same VBA code gives me a matrix in Excel where Matlab NaN values are replaced with a specific number 65535.
I've tried different spreadsheets, variables, rewrote the VBA code, etc. NaN is now always replaced with 65535 when using MLGetMatrix. How can I get it back to being imported into Excel as NaN?
Here is my sample VBA script:
Dim Err As String
Err = MLEvalString("some_code")
MatlabRequest
Application.Calculation = xlManual
MLGetMatrix "A", "some_existing_rangel"
MatlabRequest
Application.Calculation = xlAutomatic

답변 (1개)

Akshit Agarwal
Akshit Agarwal 2019년 10월 9일
Hi Anna,
Convert your NaN values to a string 'NaN' before exporting them to excel.
You may refer to a similar query that had been answered in this thread: How can I write the NaN values in the matrix to Excel using XLSWRITE?

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by