Removing elements of a cell array that start with a specific letter
22 次查看(过去 30 天)
显示 更早的评论
采纳的回答
更多回答(1 个)
Image Analyst
2022-12-14
Unfortunately you didn't read the posting guidelines and therefore forgot to attach your data. But I'll take a stab at it with no data.
numCells = numel(ExpModOutVariables);
indexesToDelete = false(numCells, 1);
for k = 1 : numCells
thisCell = ExpModOutVariables{k};
if startsWith(thisCell, 'R')
indexesToDelete(k) = true;
end
end
% Do the deletion
ExpModOutVariables(indexesToDelete) = [];
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!