How to replace strings in a cell array
49 次查看(过去 30 天)
显示 更早的评论
Hello,
I an wondering how to replace strings in a cell array based on the content of the previous cell. Every time that a cell in 'input' starts with the characters QQQQ, that cell is renamed with Q_ and the content of the previous cell. For example QQQQ_01 would be renamed Q_D and QQQQ_02 would be renamed Q_E and so on. How would I do that ? The input and the desired output are illustrated below.
input = {'A', 'B', 'C', 'D', 'QQQQ_01', 'E', 'QQQQ_02'}
output = {'A', 'B', 'C', 'D', 'Q_D', 'E', 'Q_E'}
1 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Programmatic Model Editing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!