Function 'subsindex' is not defined for values of class 'cell'.
1 回表示 (過去 30 日間)
古いコメントを表示
Please guide me.
a = [1,0,1;1,1,0;1,1,1];
b = [0,1;1,0];
allcomb = [];
When I run this below command
cell2mat(allcomb(num2cell(a,2),num2cell(b,2)))
I have error "Function 'subsindex' is not defined for values of class 'cell'."
5 件のコメント
Geoff Hayes
2017 年 5 月 17 日
Asad - how do you expect to get the answer (that you have posted) given a and b? it looks like b is the repeated (column-wise) three times, but what happens with a? You probably should describe the steps or rules that you expect to be followed.
採用された回答
Guillaume
2017 年 5 月 17 日
One possible way of generating your desired output:
a = [1,0,1;1,1,0;1,1,1];
b = [0,1;1,0];
[rowa, rowb] = ndgrid(1:size(a, 1), 1:size(b, 1));
allcomb = [a(rowa, :), b(rowb, :)]
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!