How to join two matrices together
    조회 수: 4 (최근 30일)
  
       이전 댓글 표시
    
I have two for loops that in each iteration is producing n & m series of data for Start_MS (i) & Duration_MS (i) & Start_DS (j) & Duration_DS (j).
n = randi([1, 5]);
for i=1:n
    Start_MS (i) = rand();
    Duration_MS (i) = Start_MS (i) +12;
end 
m = randi([1, 6]);
for j=1:m
    Start_DS (j) = rand();
    Duration_DS (j) = Start_DS (j) +12;
end
I want to bring all of the output in one matrix that started with first loop and followed by second loop. Also, first column to be Start_MS (!) and second column is Duration_SW (!) [! = i or j]. For example if n is 2 & m is 3, then:
Output: [3,14;5,18;7,10;5,10;2,16];
Furthermore, I need another description name matrix such that just name of array appear on it. For example if n is 2 % m is 3, then:
Legend = {'Start_MS','Duration_MS','Start_MS','Duration_MS','Start_DS','Duration_DS','Start_DS','Duration_DS''Start_DS','Duration_DS'};
댓글 수: 0
답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
