ind2sub output in arrayform
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Bananach
am 16 Apr. 2016
Bearbeitet: Azzi Abdelmalek
am 16 Apr. 2016
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?
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 16 Apr. 2016
Bearbeitet: Azzi Abdelmalek
am 16 Apr. 2016
A=randi(5,5,4,3)
id=[1 12 25 45]'
idx=cell(ndims(A),1)
[idx{:}]=ind2sub(size(A),id)
celldisp(idx)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!