How to join two matrices together

1 Ansicht (letzte 30 Tage)
Moe
Moe am 26 Jun. 2015
Bearbeitet: Moe am 26 Jun. 2015
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'};

Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by