How to join two matrices together

1 visualizzazione (ultimi 30 giorni)
Moe
Moe il 26 Giu 2015
Modificato: Moe il 26 Giu 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'};

Risposte (0)

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by