www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/FindStringsThatAreNotEmptyExample.m
%% Find Strings That Are Not Empty % Find strings that do have characters and display only those strings. str = string({'Amy','Charles','';... 'Mark','','Sarah'}) %% % Use the |~| operator to invert |tf|, so that |tf| contains |1| wherever % |str| contains a string with more than zero characters. tf = str==''; tf = ~tf %% % Display only the strings that are not empty. str(tf)