ind2sub output dimension
古いコメントを表示
My question is regarding the output of the ind2sub function. In my code, since the input dimention of ind2sub changes, i should expect the output dimention to change. But a code like this is not working.
B = rand(6,6,6);
A(1:ndims(B)) = ind2sub(size(B),56);
The output of the above code is [56 56 56] while I'm expecting something like [2 4 2].
Any suggestion?
採用された回答
その他の回答 (1 件)
bym
2011 年 12 月 10 日
you need multiple assignments for that function.
[r,c,p]=ind2sub(size(B),56)
r =
2
c =
4
p =
2
2 件のコメント
Paulo Silva
2011 年 12 月 10 日
that one was bugging me for some time, +1 vote
Mohsen Davarynejad
2011 年 12 月 10 日
カテゴリ
ヘルプ センター および File Exchange で Graph and Network Algorithms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!