Converting 2-d[:,45] matrix to 3-d[:,45,246] matrix based on unique values in 2nd column of 2d matrix
1 回表示 (過去 30 日間)
古いコメントを表示
I have a 2-d matrix with [:, 45] dimension, which I want to convert into a 3-d matrix of dimension [:,45,246] based on 246 unique values on 2nd column of 2-d matrix.
3 件のコメント
Jan
2018 年 5 月 10 日
Please give a short example. It is impossible to guess, which operation you want.
回答 (1 件)
Walter Roberson
2018 年 5 月 10 日
[uniquevals, ~, idx] = unique(YourMatrix(:,2));
for J = 1 : length(YourMatrix,1)
NewMatrix(J, :, idx(J)) = YourMatrix(J, :);
end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!