Trouble vectorizing cell access
이전 댓글 표시
Hi, I have the following loop which I would like to vectorise: Here C is an array of integers, M is a cell of integer arrays.
For example : for one case M is a 1x8 cell, with contents =
M = {1, 2, [3,4,7,9,10], [5,6,8,11,12], [13,14,17,19,20], [15,16,18,21,22], 23, 24}
for i=1:length(data)
j= C(i);
n = M{j};
end
I was thinking of a solution like n = M{C}, however that didnt workout. Neither did n = M{C(:)}. Can someone help in vectorising this loop ?
Thanks
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!