The syntax of ind2sub is
[s1,s2,s3,...,sd]=ind2sub(size,i)
where s1,... are d vectors of size Nx1 when i has size Nx1 and size has d dimensions.
Is there a way to write something like s=ind2sub(size,i) where s has size Nxd?

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 4월 16일
편집: Azzi Abdelmalek 2016년 4월 16일

0 개 추천

A=randi(5,5,4,3)
id=[1 12 25 45]'
idx=cell(ndims(A),1)
[idx{:}]=ind2sub(size(A),id)
celldisp(idx)

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

제품

태그

질문:

2016년 4월 16일

편집:

2016년 4월 16일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by