I want to replace all missing strings in a table with a string of my choice, say 'unknown'. I use R2016a (without an upgrade option), so functions like fillmissing are not available to me, in case they could be of help. Eg:
dblVar = [NaN; 3; 7; 9]; cellstrVar = {'one'; 'three'; ''; 'nine'}; categoryVar = categorical({''; 'red'; 'yellow'; 'blue'}); A = table(dblVar, cellstrVar, categoryVar)A = dblVar cellstrVar categoryVar ______ __________ ___________ NaN 'one' <undefined> 3 'three' red 7 '' yellow 9 'nine' blue
I would like to end up with this:
A = dblVar cellstrVar categoryVar ______ __________ ___________ NaN 'one' unknown 3 'three' red 7 'unknown' yellow 9 'nine' blue
Note I also replaced the categorical '<undefined>' as well, if you can please include in your answer.
Is there a way to do this without changing A's structure, eg from table to cell, in the process? The reason I want to avoid the transformation is my table is large, and transformation may cause memory issues.
Edit to add: the location of the missing string value has to be identified as well, there may be several such columns in the table.
Many thanks.
Best Answer