Select all entries in first N-1 dimensions of array
이전 댓글 표시
hi, i have a loop in which cell array V keeps expanding:
for it=1:10;
V{it}= ..... % the number of dimension of V{it} is 'it'
% so if it=3: size(V{it})=[2 2 2];
end
later im going to loop through V again, but i want to select only the first N dimensions:
for id=1:9;
Y{id}= ... % select first 'id' dimensions of V{id+1}
%so if id=2, W{id}=V{id+1}(:,:,1), but if id=3, W{id}=V{id+1}(:,:,:,1)
end
I just dont know how to adjust the number of ':' i want to be there. Or equivalently to adjust the numer of times to put in 1:2, ie. W{4}=V{5}(1:2,1:2,1:2,1:2,1).
댓글 수: 3
Sean de Wolski
2012년 5월 23일
ARGGGHHHH!!
I just went to compliment Oleg for his answer and to up-vote it and it somehow got deleted. My apologies, Oleg and Sargondjani. Hopefully you have the Comma Separated List Expansion somewhere. Oleg, I owe you a beer.
Sargondjani
2012년 5월 23일
Sargondjani
2012년 5월 23일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!