convert values to string
古いコメントを表示
I have a vector with values to define groups (groupValue, in this case 1000x1 array with values from 1 to 5) I also have a cell array with strings for each of these values (labels, 5x1 cell array) I want to have a 1000x1 cell array with strings for the labels instead of values. How can I do this more efficiently i.e. without a for loop?
for kk = 1:nElements
groupLabels{kk} = labels{groupValue(kk)};
end
採用された回答
その他の回答 (2 件)
Geoff Hayes
2015 年 12 月 21 日
Ingrid - if labels is your cell array of string labels and groupValue is your integer array of group values (or indices into labels) then perhaps you could try something like
groupLabels = labels(groupValue);
Renato Agurto
2015 年 12 月 21 日
hello. This should work
groupLabels = labels(groupValue);
カテゴリ
ヘルプ センター および File Exchange で Data Distribution Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!