If i have a function to generate two matrix?

If i have
for k=1:2
C1 = randi ([0 1],3,3);
C2 = randi ([0 1],3,3);
end
How can put the C1 and C2 in the same matrix like this
Matrix = [{0 1 1;1 1 1; 0 1 1}, {1 1 1;0 1 1;1 0 1}, { 1 1 0 ; 1 0 1 ;0 0 1} , {0 1 1 ; 1 0 1 ; 1 1 0 }]

댓글 수: 3

Stephen23
Stephen23 2016년 5월 10일
편집: Stephen23 2016년 5월 10일
Just use one single randi call. There is no point to doing this in a loop.
c1 and c2 is come from the cross over from genetic algorithm
What is the rule for inserting each matrix into the new output matrix?

답변 (1개)

Walter Roberson
Walter Roberson 2016년 5월 10일

0 개 추천

Matrix = arrayfun(@(IDX) randi([0 1], 3, 3), 1:4, 'Uniform', 0);

이 질문은 마감되었습니다.

질문:

2016년 5월 10일

마감:

2021년 8월 20일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by