How can I replace "" entries in a table?

조회 수: 1 (최근 30일)
Kamal Premaratne
Kamal Premaratne 2020년 5월 28일
댓글: Kamal Premaratne 2020년 5월 28일
I imported a large table (300 x 450) and some of the blank entries were imported as "". For the purpose of this question, let me take a part of one column:
>> TT = T(end-4:end,end)
TT =
5×1 table
vm2PR
_____
VC02 ""
VC03 ""
VC04 "6"
VC05 "2"
VC06 ""
How do I replace these "" entries with numerical value 0.0 and the "2" and "6" entries as numerical values 2 and 6 respectively? This has to be done for the whole large table (which is named T). Thank you.

채택된 답변

madhan ravi
madhan ravi 2020년 5월 28일
iX=str2double(TT.vm2PR);
TT.vm2PR(isnan(iX))=0
  댓글 수: 1
Kamal Premaratne
Kamal Premaratne 2020년 5월 28일
This works perfectly. Thank you so much Madhan.

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by