필터 지우기
필터 지우기

importing an empty text column rather than a number column

조회 수: 2 (최근 30일)
Afolabi Fashola
Afolabi Fashola 2020년 8월 10일
댓글: Afolabi Fashola 2020년 8월 14일
Hello,
I have a excel spreadsheet with 12 columns that I imported into MATLAB using readtable. The issue is there are two text columns which could sometimes be empty and sometimes not. Whenever its empty and i run the code MATLAB imports the table and replaces the empty cells with NAN showing its not a text column but i want it to be replaces with single qoutes (' ') instead because it is a text column.
  댓글 수: 2
Stijn Haenen
Stijn Haenen 2020년 8월 10일
Use the num2str command and change every NaN to ' ':
Data=num2str(Data);
Data(Data=='NaN')=' ';
Afolabi Fashola
Afolabi Fashola 2020년 8월 10일
So is Data the name of the variable that stores my table?

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

채택된 답변

J. Alex Lee
J. Alex Lee 2020년 8월 11일
Are you already using something like detectImportOptions() or spreadsheetImportOptions()? If not, look at that
And then look at setVarType().

추가 답변 (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