Delete rows from string array with just one value
7 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a string array like this:
x=[Na,Mg,Si ; V ; Na,Mg,Si,S ; Si ; Na,Mg,Al,P]
I want to delete all the rows which contain just one Value. Does somebody has an idea how it could work? Because I reached my limit of knowledge (really new in matlab).
I appreciate any idea :-)
采纳的回答
Arif Hoq
2022-3-24
编辑:Arif Hoq
2022-3-24
as i don't have your data so i have added NaN string to make the same dimension cell array
x={'Na','Mg','Si' NaN; 'V' NaN NaN NaN; 'Na','Mg','Si','S' ; 'Si' NaN NaN NaN; 'Na','Mg','Al','P'};
a=string(x);
y=rmmissing(a,1,'MinNumMissing',2);
output=cellstr(y)
8 个评论
Arif Hoq
2022-3-24
~ supposed to mean not.
~= menas not equal.
isequal function returns empty cell. so ~ which is used before isempty fucntion returns not empty cell
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!