www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/EmptyStringsInStringArrayExample.m

    %% Empty Strings in String Array
% Find strings with no characters in a string array and assign them a value.
str = string({'Amy','Charles','';...
            'Mark','','Sarah'})
%%
% Return a logical array where the position of each element equal to |1|
% corresponds to the position of a string with no characters.
tf = str==''

%%
% Replace the empty strings with a new value.
str(tf) = 'me'