how to generate and cover all the possible arrays using two enties
1 回表示 (過去 30 日間)
古いコメントを表示
Hi Dear All,
I have an array of 1*4, in which each array can be of two strings 'H' or 'C'. to elaborate on it more this can be like below:
[H H H H] or [H H H C] or [H C C C] or ..........[C C C C}
in total there would be 2*2*2*2=16 case for that.
I would like to generate all the 16 cases and following that I want to proceed the calculations. I dont know how to form these 16 cases and cover all the possible cases for that.
I would appreciate your support in advance.
0 件のコメント
採用された回答
その他の回答 (1 件)
Akira Agata
2021 年 10 月 1 日
Another possible solution:
[p,q,w,s] = ndgrid({'H','C'});
A = [p(:),q(:),w(:),s(:)];
disp(A)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!