How to select element in cell array, based on non-zero entries in another vector?
显示 更早的评论
Let's say I have two arrays:
a = [1 0 0 1];
b = {'ada', 'bob', 'carl', 'dana'};
where the first is a numerical array of zeros and ones, and the second is a cell array of character arrays. How can I achieve the following result:
{'ada','dana'}
where the resulting cell array only contains the elements based on the one values in a?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!