importing an empty text column rather than a number column
2 ビュー (過去 30 日間)
古いコメントを表示
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
2020 年 8 月 10 日
Use the num2str command and change every NaN to ' ':
Data=num2str(Data);
Data(Data=='NaN')=' ';
採用された回答
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 Center および File Exchange で Spreadsheets についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!